How the homelab is built

A small Kubernetes platform at home, run the way I'd run one at work: everything in git, nothing public by accident, and no single credential that can change everything.

Network zones and the public path

Network zones and the public pathVisitors reach an edge VM at Hetzner over HTTPS. The cluster at home dials out to the edge over WireGuard, so the home router has no port forwards. Behind the router are four zones: DMZ-cluster, DMZ-dev, MGMT and HOME. The router blocks new connections from either DMZ to HOME or MGMT.VisitorsHTTPSEdge VM · HetznerTraefik · Let's Encrypt TLSCrowdSec · rate limitsWireGuard serverHome router: default drop,no port forwardsWireGuard, dialled outDMZ-clusterk3s · Flux · appspublic entrypointDMZ-devdev Pi · AI agentreads the clusterMGMTProxmox hostinfra runnerHOMEmy PC (admin)phones, Wi-Fi
Public traffic reaches cluster apps through a WireGuard tunnel the cluster opens to the edge. The firewall blocks new connections from either DMZ to HOME or MGMT. That limits where a compromised workload can connect next.
  • A new app starts out LAN-only. To publish it, I add the public entrypoint annotation to its ingress and put the manifest path on an allowlist. CI flags a public entrypoint in any unlisted manifest.
  • Pods need explicit rules to communicate. Every app namespace starts with a default-deny NetworkPolicy for incoming and outgoing connections. An allow rule lets pods look up names through cluster DNS.
  • The edge is replaceable. Only the VM and its firewall are provider-specific Terraform; everything on it is Ansible, and DNS is separate.
  • This site is served by the edge VM itself, so it stays up when the homelab is down.

From a commit to production

From a commit to productionWork starts on a topic branch. A merge request runs checks, and I review it. After I merge to main, Flux pulls main into the cluster, and a protected infra runner deploys the edge VM's software only when I start the job.Topic branch · agent or meMerge requestchecks · reviewI merge to mainFluxpulls main intothe clusterInfra runnerdeploys the edgewhen I start itk3s appsedge VM software
Branch pipelines only build and check. Flux applies merged cluster changes, and the edge software deploys only from a protected job on main that I start. Applied by hand, from runbooks: the router, the switch, Proxmox and, for now, the Terraform for the edge VM, its firewall and DNS.

How changes reach production

I designed the lab around a failure I want to contain. If the AI agent on my dev Pi is compromised, its Git credentials still only let it propose a change. Getting that change into production requires my review and a separate deployment identity.

  • The agent can propose changes. It can inspect workloads, push a topic branch and open a merge request. Kubernetes RBAC limits its cluster access, and I keep cloud, DNS and router credentials off the Pi.
  • I decide what reaches main. From my admin PC, I review the diff and CI results before merging. I also handle router and Proxmox changes through their runbooks.
  • Flux deploys reviewed cluster changes. Its Git key grants read-only access to the repository. Flux uses a separate Kubernetes identity to apply manifests from main inside the cluster.
  • Infrastructure changes need a separate approval. The protected runner on the management network deploys the edge VM's software from main, only when I start the job. The cloud and DNS credentials stay off the agent's Pi: for now I apply the Terraform for the VM, its firewall and DNS from my admin PC, and moving it onto the protected runner is next.

What gets checked before a merge

  • Exposed credentials. I encrypt cluster secrets with SOPS and age. A pre-commit hook and CI check cluster manifests for plaintext secret values. Gitleaks also scans Git history for credentials that a later commit may have removed.
  • Broken manifests. CI renders the Helm charts and checks the resulting Kubernetes manifests against their schemas. A template that fails to render or produces an invalid field shows up in the merge request.
  • Errors in infrastructure code. CI checks shell scripts for mistakes such as unsafe quoting, lints YAML and Ansible playbooks, and checks Terraform configuration.
  • Untested or moving images. CI builds each image from the commit and runs the site's image in a smoke test. Production runs a tag pinned in git, never a moving latest.

Every manifest, chart, check and runbook described here is in the public repository ↗. See my CV →