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.
6.8 KiB
AGENTS.md
Guidance for OpenCode agents working in this repo. Read this before editing manifests.
What this repo is
Plain Kubernetes manifests (no Helm, no kustomize, no build step) for a homelab
cluster on Hetzner Cloud. Cilium is the CNI/LB; Hetzner CSI (hcloud-volumes)
and a SMB CSI (slow) provide storage. There is no application source code —
every file is YAML/TXT applied with kubectl apply -f.
Commands
- Apply a manifest:
kubectl apply -f <path> - No lint/typecheck/test pipeline exists. Verify changes by applying against the
cluster and checking
kubectl get/describe/logs. - Monitoring stack only: install/upgrade via Helm (see
README.mdfor exact commands and the pinned chart version87.3.0). Do not re-apply the Grafana manifests viakubectl applyand Helm together — Grafana is hand-managed (Monitoring/Grafana/), Prometheus is Helm-managed.
Storage — gotchas that bit us
slowis the default StorageClass (SMB CSI).hcloud-volumesis not default. PVCs that omitstorageClassNameland on SMB, not Hetzner volumes — set it explicitly when you want Hetzner block storage.local-storage(no-provisioner) requires a matching manualPersistentVolumewithnodeAffinity; it only binds on the node hosting the PV. Used by the legacy postgres StatefulSet.- Only one default StorageClass may exist. If
kubectl get scshows two(default), patch the unwanted one:kubectl patch sc <name> -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
Network / IP layout (non-obvious)
- Cilium
LoadBalancerIPPools hand out LB IPs from two pools:lan-pool10.1.0.101–10.1.0.199— Cilium ingresses.postgres-pool10.2.0.0/24— dedicated postgres LB, stable IP10.2.0.122.
- A LB IP is pinned via annotation
lbipam.cilium.io/ips: <ip>on the Service, backed by a matchingCiliumLoadBalancerIPPool. Keep both in sync or the IP won't allocate. - Node IPs have moved (
10.0.2.x→10.1.0.x). Any manifest referencing the old registry10.0.2.119:5000is unreachable from current nodes; use the public imagepgvector/pgvector:pg18-trixieinstead (see PostgreSQL migration). - Hetzner Cloud Firewalls (
allow-all-internal,allow-all-home,Home-ip) are applied to every node: inbound only from10.0.0.0/8and home (192.168.8.0/24,192.168.5.0/24,78.58.8.250/32). There are no outbound rules, so outbound is allow-all. Adding one outbound rule flips outbound to deny-all — if you restrict egress, add the full allowlist in one call. SeeCluster_admin/firewall.md. - IPv6 is egress-only (no inbound IPv6 rules). The
slowSMB CSI Storage Box mount uses IPv6 directly; keep it that way. - Public IPs are kept on workers (Option A). Do not remove Primary IPs or
repoint worker default routes without reading
Cluster_admin/firewall.mdand the "Firewall / egress" section inEnvironment.md. - Cluster → home LAN goes through the master's WireGuard (
wg0). Hetzner's private network is routed (/32per node) and drops non-private sources, so each worker gets a point-to-point GRE tunnel (169.254.8.0/24) to the master; the master masquerades the traffic to192.168.5.3onwg0.HomeAccess/home_lan_router_daemonset.yamlkeeps the tunnels, routes and NAT in place, and hardcodes the worker private IPs — updateWORKERSwhen nodes change. The master'swg0peerAllowedIPsmust include192.168.8.0/24(host config). SeeHomeAccess/README.md.
Secrets are gitignored
.gitignore drops Secrets/ and any *secret*.yaml. Secret manifests in the
tree are expected to be created out-of-band and are not committed. Do not
git add a *_secret.yaml/*_secret.yml. Read existing secret values from the
cluster with kubectl get secret if you need them for a migration step.
PostgreSQL directory — read the runbook first
PostgreSQL/MIGRATION_RUNBOOK.md is the source of truth for the postgres
StatefulSet → postgres-hetzner Deployment migration (logical dump/restore,
downtime required, IP repoint 10.0.2.116 → 10.2.0.122). Do not edit
PostgreSQL/ manifests without reading it.
Layout:
PostgreSQL/Old/— legacy StatefulSet manifests (postgress_deplay.yamlkeeps the original typo'd filename deliberately; used as rollback reference).PostgreSQL/hetzner/— new Deployment/PVC/Service onhcloud-volumes.PostgreSQL/postgres_service.yaml,postgres_lb_service.yaml— the two Services repointed atapp: postgres-hetznerafter cutover.
Monitoring directory
- Prometheus is managed by the kube-prometheus-stack Helm release; values in
Monitoring/kube-prometheus-stack.values.yaml. Bundled Grafana is disabled (grafana.enabled: false); the Grafana inMonitoring/Grafana/is hand-managed and points its datasource atprometheus-operated.monitoring.svc.cluster.local:9090. Monitoring/Prometheus/is empty — the old hand-rolled Prometheus manifests were removed when the Helm chart replaced them. Don't recreate them.- To add a scrape target, create a
ServiceMonitor/PodMonitorCR anywhere; the Prometheus CR selects all (serviceMonitorSelector: {}).
Docker directory
Docker/PostgreSQL/holds the custom PostgreSQL image build (basepostgres:18.4+pgvectorv0.8.2 built from source, plus rclone/python helpers). The image is built and pushed byDocker/PostgreSQL/PostgreSQL_Build.shto the private registryrg.mariushome.lt/custom-postgres.- This is the only build step in the repo; everything else is plain manifests.
Run the shell script from the
Docker/PostgreSQL/directory so the Docker build context is correct. - The registry
rg.mariushome.ltis the public-facing name for the image formerly served from10.0.2.119:5000. Prefer pullingrg.mariushome.lt/custom-postgresover the legacy10.0.2.119:5000/...path (the latter is unreachable from current nodes — see Network / IP layout).
Cluster admin notes (operational, not manifests)
Cluster_admin/nodes_restart_commands.txt— drain/reboot/uncordon sequence per node. Follow that order; node names are real hostnames.Cluster_admin/move _data_example.txt— one-linekubectl cpexample (the leading space in the filename is intentional).
Editing conventions
- Keep filenames as committed, including typos (
postgress_deplay.yaml,move _data_example.txt). Other docs and the runbook reference them by name. - Manifests use
applabel selectors; do not introduceapp.kubernetes.io/*labels mid-stream without updating every consumer (Services, ServiceMonitors). - Prefer editing existing files over creating new ones; new manifests should
follow the per-directory pattern (e.g.
<thing>_deployment.yaml,<thing>_service.yaml,<thing>_pvc.yaml).