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
- 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
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
maininside 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 →