Files
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

12 KiB
Raw Permalink Blame History

Environment Description

Reference for other agents/automata working on this repo. Describes the homelab Kubernetes cluster's shape, conventions and gotchas. No secrets or credentials are included — see Secrets section below for how they are handled.

Repository

Type: Plain Kubernetes manifests (no Helm/kustomize/build for the majority of the tree; two exceptions managed by Helm). Applied directly with kubectl apply -f <path>. No CI/lint/test pipeline — verify by applying and inspecting kubectl get/describe/logs.

Platform: Homelab cluster on Hetzner Cloud.

Repo root layout:

Directory Purpose
Cilium/ Cilium networking: LoadBalancerIPPool, L2AnnouncementPolicy, ingress example
Cluster_admin/ Operational notes (node reboot/update sequences, firewall/egress, kubectl cp example) — not manifests applied to cluster
Docker/PostgreSQL/ Custom PostgreSQL image build (Dockerfile + build script)
DockerRegistry/ Private Docker registry Deployment + Service + PVC, and a registry UI subdirectory
Email/ Mailu mail server (Helm) + namespace + Cilium LB pool manifests
Gitea/ Gitea Deployment/Service/Ingress/Namespace/PVC/DB-secret
HomeAccess/ DaemonSet that routes 192.168.8.0/24 (home LAN) through the master's WireGuard + README
Immich/ Immich server + machine-learning + redis Deployments/Services, config + secret
Monitoring/ kube-prometheus-stack Helm values + hand-managed Grafana manifests
PostgreSQL/ PostgreSQL manifests (only hetzner/ subdir currently present)
Secrets/ Docker registry login credentials (gitignored — not committed)
volume/ PVC and SMB volume examples

Cluster Infrastructure

  • CNI/LB: Cilium. Provides pod networking and Layer 2-announced LoadBalancer IPs via CiliumLoadBalancerIPPool + CiliumL2AnnouncementPolicy.

  • L2 Announcement: l2-policy in Cilium/L2AnnouncementPolicy.yaml — announces externalIPs and loadBalancerIPs on nodes that are not control-plane (node-role.kubernetes.io/control-plane DoesNotExist).

  • LoadBalancer IP Pools (CiliumLoadBalancerIPPool):

    Pool Range File Purpose
    lan-pool 10.1.0.101–10.1.0.199 Cilium/LoadBalancerIPPool.yaml General Cilium ingresses / services
    mailu-pool 10.4.0.0–10.4.0.255 Email/mailu_lbippool.yaml Mailu mail LB (SMTP/IMAP/Submission)
  • LB IP pinning: Annotation lbipam.cilium.io/ips: <ip> on a Service, backed by a matching pool. Example: Mailu front service pins 10.4.0.122 (see Email/mailu.values.yaml).

  • Ingress class: cilium. Ingresses use ingress.cilium.io/loadbalancer-mode: "dedicated".

Network / IP Layout

  • Node IPs: 10.1.0.x (previously 10.0.2.x — old addresses are unreachable from current nodes).
  • Any manifest referencing the old registry 10.0.2.119:5000 is stale; use the public image name rg.mariushome.lt/custom-postgres instead.
  • LB pool ranges are RFC1918 and announced via L2 on worker nodes.

Firewall / egress

Public IPs are kept on all nodes (Option A). Hetzner Cloud Firewalls are applied to every node:

  • allow-all-internal — inbound from 10.0.0.0/8
  • allow-all-home — inbound from 192.168.8.0/24, 192.168.5.0/24
  • Home-ip — inbound from 78.58.8.250/32 (home WAN)

There are no outbound rules, so Hetzner allows all outbound. Inbound NEW from the internet is dropped; IPv6 has no inbound rules and is egress-only. Nodes pull images/packages directly over Hetzner, and the slow SMB Storage Box stays on direct IPv6.

Gotcha: adding a single outbound rule flips Hetzner outbound to deny-by-default. Add the complete allowlist in one call, or leave outbound open. See Cluster_admin/firewall.md for the rules, API commands and validation.

The master's WireGuard (wg0, 192.168.5.0/24) is the only path between the cluster and the home LAN; it is not an internet path. It carries both directions: home → cluster (kubectl, LB IPs) and cluster → home (HomeAccess/: each worker gets a point-to-point GRE tunnel to the master because Hetzner's private network is routed and drops non-private sources, and the master masquerades the traffic to 192.168.5.3). The private-only-worker design remains deferred: the home router does not forward the WG subnet, so home devices reach workers only through the master. Mailu is not deployed and its SMTP/IMAP ports are not open to the internet.

Storage

Three StorageClasses exist:

StorageClass Driver Default? Notes
slow SMB CSI Yes PVCs that omit storageClassName land here (SMB share).
hcloud-volumes Hetzner CSI No Block storage; set storageClassName: hcloud-volumes explicitly.
local-storage no-provisioner No Requires a matching manual PersistentVolume with nodeAffinity.

Gotchas:

  • slow (SMB) is the default; hcloud-volumes is not. Omitting storageClassName puts a PVC on SMB. When block storage is wanted, set it explicitly.
  • Only one default StorageClass may exist. If kubectl get sc shows two (default), patch the unwanted one: kubectl patch sc <name> -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
  • Examples of both PVC and SMB volume usage live in volume/.

Workloads

Directory Workload(s) Namespace Image / Notes
PostgreSQL/hetzner/ postgres-hetzner Deployment + ClusterIP Service + PVC + ConfigMap database rg.mariushome.lt/custom-postgres (custom image, see Build below). PVC on hcloud-volumes. Creds via postgres-secret. app: postgres-hetzner selector. Recreate strategy.
Gitea/ Gitea Deployment + Service + Ingress + Namespace + PVC gitea docker.io/gitea/gitea:latest. Uses external Postgres at postgres.database.svc.cluster.local:5432, DB gitea, user admin, pwd from gitea-db-secret. Ingress host git.mariushome.lt. PVC gitea-hetzner-pvc.
Immich/ Immich server + machine-learning + redis Deployments/Services + config + secret immich ghcr.io/immich-app/immich-server:v3; ML image separate. Init container waits on postgres.database.svc.cluster.local:5432. Uses immich-env ConfigMap + immich-db-secret. Library PVC immich-lib.
DockerRegistry/ Registry Deployment + Service + PVC + UI (Deployment/Service/Ingress) registry registry:2. htpasswd auth mounted from registry-htpasswd Secret. PVC registry-pvc.
Email/ Mailu (Helm release) mailu Helm chart mailu v2.7.1 (appVersion 2024.06.51). Domain mariushome.lt. Reuses external postgres-hetzner; bundled postgres subchart disabled. Mail LB pinned to 10.4.0.122. TLS terminated upstream by Cloudflare.
Monitoring/Grafana/ Hand-managed Grafana Deployment + Service + Ingress + PVC + datasource + DB/app secrets monitoring docker.io/grafana/grafana:latest. Datasource points at prometheus-operated.monitoring.svc.cluster.local:9090.

Postgres is the shared database backend: Gitea, Immich, and Mailu all connect to the same postgres-hetzner instance via the postgres Service in the database namespace (postgres.database.svc.cluster.local:5432).

Monitoring Stack

  • kube-prometheus-stack Helm release (namespace monitoring), chart version pinned 87.3.0. Values in Monitoring/kube-prometheus-stack.values.yaml.
    • Prometheus: 15d retention, 10Gi PVC on hcloud-volumes, selects all ServiceMonitors/PodMonitors/Rules/Probes ({}SelectorNilUsesHelmValues: false).
    • Alertmanager: disabled.
    • Bundled Grafana: disabled (grafana.enabled: false) — a hand-managed Grafana lives in Monitoring/Grafana/.
    • Node Exporter + kube-state-metrics: enabled via chart subcharts.
  • Monitoring/Prometheus/ is empty — the previous hand-rolled Prometheus manifests were removed when the Helm chart replaced them. Do not recreate.
  • To add a scrape target, create a ServiceMonitor/PodMonitor CR anywhere; the Prometheus CR selects all of them.
  • Install/upgrade commands are in README.md. Do not re-apply Grafana via both kubectl apply and Helm — Grafana is hand-managed, Prometheus is Helm-managed.

Container Image Build

  • Docker/PostgreSQL/ holds the custom PostgreSQL image: base postgres:18.4
    • pgvector v0.8.2 built from source, plus rclone/python helpers.
  • Build/push handled by Docker/PostgreSQL/PostgreSQL_Build.sh, which pushes to rg.mariushome.lt/custom-postgres. Run the script from the Docker/PostgreSQL/ directory so the Docker build context is correct.
  • rg.mariushome.lt is the public-facing name for the registry formerly served from 10.0.2.119:5000; the old path is unreachable from current nodes.

Secrets — handling (values are NOT shared here)

  • Secrets/ and any *secret*.yaml/*secret*.yml are gitignored; secret manifests are created out-of-band and are not committed. Do not git add a secret manifest.
  • Secret objects consumed by workloads (names only, values held out-of-band):
    • database/postgres-secret — PostgreSQL credentials.
    • gitea/gitea-db-secret — Gitea DB password.
    • immich/immich-db-secret — Immich DB credentials.
    • registry/registry-htpasswd — htpasswd file for the private registry.
    • mailu/mailu-secret + mailu/mailu-db-secret — Mailu app + DB secrets.
    • monitoring/grafana-secret + monitoring/grafana-db-secret — Grafana app + DB secrets.
  • registry-creds imagePullSecret (one per namespace pulling from rg.mariushome.lt, e.g. database) is required for workloads referencing the private registry. Created out-of-band via kubectl create secret docker-registry registry-creds ....
  • Read existing secret values from the cluster with kubectl get secret if a migration step needs them.

Conventions

  • Manifests use app label selectors; do not introduce app.kubernetes.io/* labels mid-stream without updating every consumer (Services, ServiceMonitors).
  • Per-resource file naming pattern: <thing>_deployment.yaml, <thing>_service.yaml, <thing>_pvc.yaml.
  • Filenames are kept verbatim, including intentional typos and oddities (move _data_example.txt has a leading space). Other docs reference these names directly.
  • Helm-managed pieces (kube-prometheus-stack, Mailu) are upgraded via helm upgrade ... -f <values.yaml>, not kubectl apply for the values file. Their accompanying Namespace/LBIPPool manifests are still applied with kubectl apply.

Cluster Admin (operational, not manifests)

  • Cluster_admin/nodes_restart_commands.txt — drain/reboot/uncordon sequence per node. Follow that order.
  • Cluster_admin/nodes_update_commands.md — node update procedure.
  • Cluster_admin/move _data_example.txt — kubectl cp example (leading space in the filename is intentional).

Quick Reference — Commands

  • Apply a manifest: kubectl apply -f <path>
  • Apply Mailu non-Helm pieces: kubectl apply -f Email/mailu_namespace.yaml and kubectl apply -f Email/mailu_lbippool.yaml
  • Upgrade Mailu: helm upgrade mailu mailu/mailu -n mailu --version 2.7.1 -f Email/mailu.values.yaml
  • Upgrade monitoring: see README.md (kube-prometheus-stack, version 87.3.0)