Files
Kubernetes/Email
gitea_admin 36fbaf171a Add firewall and home LAN access docs, ComfyUI image generation, and backup plan
Document the Hetzner Cloud Firewall posture (inbound from private/home only, outbound allow-all, egress-only IPv6, public IPs on workers) in a new `Cluster_admin/firewall.md` and reference it from `AGENTS.md`, `Environment.md`, and `README.md`. Update the Mailu README to note that SMTP/IMAP ports are not currently exposed.

Add `HomeAccess/` with a privileged DaemonSet and README that give cluster nodes a route to `192.168.8.0/24` via point-to-point GRE tunnels to the master and its WireGuard tunnel.

Wire Open WebUI to ComfyUI on pop-os through a new `openwebui-imagegen` ConfigMap consumed via `envFrom`, with migration notes covering the PersistentConfig DB override.

Bump kube-prometheus-stack to 88.6.1 with an 8GB `retentionSize` cap, grow the postgres PVC to 50Gi, and add a PostgreSQL backup plan for pg_dumpall/rclone streaming to a Hetzner Storage Box.
2026-12-01 12:36:14 +02:00
..

Email / Mailu

Mailu mail server deployed via the official Helm chart (mailu 2.7.1, appVersion 2024.06.51). Managed by Helm, not kubectl apply — same model as the kube-prometheus-stack release in Monitoring/.

Layout

File Kind How to apply
mailu_namespace.yaml Namespace kubectl apply -f
mailu_lbippool.yaml CiliumLoadBalancerIPPool (10.4.0.0/24) kubectl apply -f
mailu.values.yaml Helm values helm upgrade ... -f (do NOT kubectl apply)

Two non-Helm manifests (namespace + LBIP pool) are applied once with kubectl apply -f. Everything else is rendered by the Helm chart.

Prerequisites — do these first (in order)

1. Apply the namespace + Cilium LB pool

kubectl apply -f Email/mailu_namespace.yaml
kubectl apply -f Email/mailu_lbippool.yaml

2. Create the Mailu databases on the existing PostgreSQL

Mailu reuses the existing postgres-hetzner instance in the database namespace (Service postgres.database.svc.cluster.local:5432, admin user admin). The chart does NOT create databases/users when externalDatabase is enabled, so do it manually before helm install.

Get a shell on the postgres pod and create the mailu + roundcube databases and users. Replace <MAILU_PW> and <ROUNDCUBE_PW> with strong generated values (you'll reuse them in the secret below).

# Generate the two passwords once and keep them for the next step:
MAILU_PW=$(pwgen 24 1);     echo "mailu:    $MAILU_PW"
ROUNDCUBE_PW=$(pwgen 24 1); echo "roundcube: $ROUNDCUBE_PW"

# Create databases + users on the existing postgres-hetzner:
kubectl exec -n database deploy/postgres-hetzner -- psql -U admin -d postgres <<SQL
CREATE USER mailu    WITH LOGIN PASSWORD '$MAILU_PW';
CREATE USER roundcube WITH LOGIN PASSWORD '$ROUNDCUBE_PW';
CREATE DATABASE mailu    OWNER mailu;
CREATE DATABASE roundcube OWNER roundcube;
\c mailu
CREATE EXTENSION IF NOT EXISTS citext;
SQL

citext is required by Mailu on the mailu database (case-insensitive text). The roundcube database needs no extension.

3. Create the out-of-band secrets (gitignored — never git add)

Following the repo convention (see root README "Private registry authentication" and AGENTS.md "Secrets are gitignored"), these are created manually and are NOT committed.

# Mailu secret-key + initial admin password
kubectl create secret generic mailu-secret -n mailu \
  --from-literal=secret-key="$(pwgen 16 1)" \
  --from-literal=initial-admin-password="$(pwgen 24 1)"

# Mailu + Roundcube DB credentials against the existing postgres-hetzner.
# Reuse the exact MAILU_PW / ROUNDCUBE_PW from step 2.
kubectl create secret generic mailu-db-secret -n mailu \
  --from-literal=database=mailu \
  --from-literal=username=mailu \
  --from-literal=password="$MAILU_PW" \
  --from-literal=roundcube-password="$ROUNDCUBE_PW"

If pwgen is not installed: apt-get install -y pwgen (or use openssl rand -base64 24).

3. External (non-repo) prerequisites — you must do these outside k8s

  1. Hetzner PTR record. In the Hetzner Cloud Console, set the reverse DNS of the LoadBalancer IP 10.4.0.122 to mail.mariushome.lt. Without a PTR, receivers (Gmail/Outlook) silently drop your mail.
  2. DNS records at your DNS provider (NOT in this repo):
    • A mail.mariushome.lt -> <public IP that 10.4.0.122 routes to>
    • MX mariushome.lt -> mail.mariushome.lt (prio 10)
    • TXT mariushome.lt "v=spf1 mx ~all"
    • TXT _dmarc.mariushome.lt "v=DMARC1; p=quarantine; rua=mailto:postmaster@mariushome.lt"
    • DKIM: generated by the Mailu admin UI on first boot — add the TXT record Mailu shows you (typically mail._domainkey.mariushome.lt).
    • Optional: MTA-STS (TXT _mta-sts.mariushome.lt + a /.well-known/mta-sts.txt served over HTTPS — chart supports it via front.overrides).
  3. Cloudflare: only the web UIs (mail.mariushome.lt, and the /admin + /webmail paths) are proxied through Cloudflare (orange cloud). The SMTP / IMAP / Submission / ManageSieve ports must NOT go through Cloudflare — they need a direct, DNS-only route (grey cloud) to the Hetzner-announced IP. Mail clients should be configured against mail.mariushome.lt directly.
  4. Hetzner Cloud firewall: the current firewalls only allow inbound from the private network and home (allow-all-internal, allow-all-home, Home-ip). There are no public inbound rules for 25/465/587/143/993/ 4190, so Mailu is not reachable directly from the internet as-is. To expose it, add explicit inbound TCP rules for those ports (this reopens the public IPs for those ports) while keeping the private/home rules. See Cluster_admin/firewall.md. Mailu is not currently deployed (no pods in mailu), so this is preparatory. Outbound is allow-all now, but Hetzner may still block outbound 25 for new accounts — confirm before relying on direct delivery.

Install / upgrade

# One time:
helm repo add mailu https://mailu.github.io/helm-charts
helm repo update

# Install:
helm install mailu mailu/mailu -n mailu --version 2.7.1 -f Email/mailu.values.yaml

# Upgrade after editing Email/mailu.values.yaml:
helm repo update
helm upgrade mailu mailu/mailu -n mailu --version 2.7.1 -f Email/mailu.values.yaml

The chart version 2.7.1 and mailuVersion: "2024.06" in the values are pinned deliberately — a mail server should move conservatively. To bump, edit both the --version here and (if needed) mailuVersion in the values, then test against a non-production domain first.

Verification after install

helm status mailu -n mailu
kubectl get pods -n mailu                    # front, admin, imap, smtp, antispam, webmail, redis
kubectl get svc -n mailu
kubectl get ingress -n mailu
kubectl get pvc -n mailu                     # mail storage (10Gi) only; DB lives on existing postgres-hetzner
kubectl get ciliumloadbalancerippool mailu-pool

# Confirm the pinned mail LB IP allocated to the front external Service:
kubectl get svc -n mailu -l app.kubernetes.io/component=front \
  -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.loadBalancer.ingress}{"\n"}{end}'
# Expect 10.4.0.122 in the ingress list.

# Mail flow smoke test (from inside the cluster):
kubectl exec -n mailu deploy/mailu-smtp -- swaks --to <external-address> \
  --from admin@mariushome.lt --server mail.mariushome.lt

# DNS sanity (run from outside the cluster):
dig MX mariushome.lt
dig -x <mail-LB-public-IP>                   # must return mail.mariushome.lt (PTR)

Notes / gotchas

  • slow is the default StorageClass in this cluster (SMB). The mail PVC in mailu.values.yaml sets storageClassName: hcloud-volumes explicitly — do not remove it, or mail data lands on SMB. (The metadata DB now lives on the existing postgres-hetzner, whose PVC already uses hcloud-volumes.)
  • Only one default StorageClass may exist. If kubectl get sc ever shows two (default), patch the unwanted one (see AGENTS.md).
  • Mailu reuses the existing postgres-hetzner instance (database namespace) via externalDatabase. The chart's bundled PostgreSQL subchart is disabled (postgresql.enabled: false). The mailu and roundcube databases/users must be created manually before helm install — see step 2 above. The custom-postgres image's pgvector extension is irrelevant to Mailu; it works fine against the existing server.
  • L2AnnouncementPolicy (Cilium/L2AnnouncementPolicy.yaml) already announces LoadBalancer IPs, so no new policy is needed for 10.4.0.122.
  • The front chart subchart defaults to hostPort: true (assumes bare-metal nodes). This deployment disables hostPort and uses externalService instead, so the Cilium LBIPAM pool hands out the IP. Do not re-enable hostPort on a managed k8s cluster.
  • ingress.realIpFrom lists the Cloudflare CIDRs; if you ever switch the upstream proxy, update this list or front will rate-limit / ban the new proxy IPs (Mailu docs warn about this).
  • Roundcube's DB lives in the existing postgres-hetzner instance. The chart does NOT auto-create it for externalDatabase mode — step 2 above handles it manually.
  • kubectl apply -f does NOT apply to mailu.values.yaml — it is consumed only by helm. Applying it with kubectl does nothing useful and may confuse diff tooling.
  • Admin UI is at https://mail.mariushome.lt/admin, webmail at https://mail.mariushome.lt/webmail (default paths; configurable via admin.uri / webmail settings in the chart).