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.
8.5 KiB
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
- Hetzner PTR record. In the Hetzner Cloud Console, set the reverse DNS of
the LoadBalancer IP
10.4.0.122tomail.mariushome.lt. Without a PTR, receivers (Gmail/Outlook) silently drop your mail. - 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
TXTrecord Mailu shows you (typicallymail._domainkey.mariushome.lt). - Optional: MTA-STS (
TXT _mta-sts.mariushome.lt+ a/.well-known/mta-sts.txtserved over HTTPS — chart supports it viafront.overrides).
- Cloudflare: only the web UIs (
mail.mariushome.lt, and the/admin+/webmailpaths) 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 againstmail.mariushome.ltdirectly. - 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. SeeCluster_admin/firewall.md. Mailu is not currently deployed (no pods inmailu), 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
slowis the default StorageClass in this cluster (SMB). The mail PVC inmailu.values.yamlsetsstorageClassName: hcloud-volumesexplicitly — do not remove it, or mail data lands on SMB. (The metadata DB now lives on the existingpostgres-hetzner, whose PVC already useshcloud-volumes.)- Only one default StorageClass may exist. If
kubectl get scever shows two(default), patch the unwanted one (see AGENTS.md). - Mailu reuses the existing
postgres-hetznerinstance (databasenamespace) viaexternalDatabase. The chart's bundled PostgreSQL subchart is disabled (postgresql.enabled: false). Themailuandroundcubedatabases/users must be created manually beforehelm 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 for10.4.0.122.- The
frontchart subchart defaults tohostPort: true(assumes bare-metal nodes). This deployment disableshostPortand usesexternalServiceinstead, so the Cilium LBIPAM pool hands out the IP. Do not re-enablehostPorton a managed k8s cluster. ingress.realIpFromlists the Cloudflare CIDRs; if you ever switch the upstream proxy, update this list orfrontwill rate-limit / ban the new proxy IPs (Mailu docs warn about this).- Roundcube's DB lives in the existing
postgres-hetznerinstance. The chart does NOT auto-create it forexternalDatabasemode — step 2 above handles it manually. kubectl apply -fdoes NOT apply tomailu.values.yaml— it is consumed only byhelm. Applying it with kubectl does nothing useful and may confuse diff tooling.- Admin UI is at
https://mail.mariushome.lt/admin, webmail athttps://mail.mariushome.lt/webmail(default paths; configurable viaadmin.uri/ webmail settings in the chart).