This is a monorepository is for my home kubernetes clusters. I try to adhere to Infrastructure as Code (IaC) and GitOps practices using tools like Terraform, Kubernetes, Flux, Renovate, and GitHub Actions.
The purpose here is to learn k8s, while practicing Gitops.
My Kubernetes clusters are deployed with Talos. One is a test clkuster, one is a low-power utility cluster, running important services, and the other is a semi-hyper-converged cluster, workloads and block storage are sharing the same available resources on my nodes while I have a separate NAS with ZFS for NFS/SMB shares, bulk file storage and backups.
There is a template over at onedr0p/cluster-template if you want to try and follow along with some of the practices I use here.
- Networking & Service Mesh: cilium provides eBPF-based networking, while envoy powers service-to-service communication with L7 proxying and traffic management. cloudflared secures ingress traffic via Cloudflare, and external-dns keeps DNS records in sync automatically.
- Security & Secrets: cert-manager automates SSL/TLS certificate management. For secrets, I use external-secrets with 1Password Connect to inject secrets into Kubernetes, and sops to store and manage encrypted secrets in Git.
- Storage & Data Protection: rook provides distributed storage for persistent volumes, with volsync handling backups and restores. spegel improves reliability by running a stateless, cluster-local OCI image mirror.
- Automation & CI/CD: actions-runner-controller runs self-hosted GitHub Actions runners directly in the cluster for continuous integration workflows. For IaC, I use tofu-controller as additional Flux component used to run Terraform from within a Kubernetes cluster.
Flux watches the clusters in my kubernetes folder (see Directories below) and makes the changes to my clusters based on the state of my Git repository.
The way Flux works for me here is it will recursively search the kubernetes/${cluster}/apps folder until it finds the most top level kustomization.yaml per directory and then apply all the resources listed in it. That aforementioned kustomization.yaml will generally only have a namespace resource and one or many Flux kustomizations (ks.yaml). Under the control of those Flux kustomizations there will be a HelmRelease or other resources related to the application which will be applied.
Renovate watches my entire repository looking for dependency updates, when they are found a PR is automatically created. When some PRs are merged Flux applies the changes to my cluster.
This Git repository contains the following directories under Kubernetes.
π kubernetes
βββ π apps # app configurations
β βββ π base # base app configuration
β βββ π main # cluster specific overlay
β βββ π utility
βββ π clusters # Cluster flux configurations
β βββ π main
β βββ π utility
βββ π components # re-useable componentsWhile most of my infrastructure and workloads are self-hosted I do rely upon the cloud for certain key parts of my setup. This saves me from having to worry about two things. (1) Dealing with chicken/egg scenarios and (2) services I critically need whether my cluster is online or not.
The alternative solution to these two problems would be to host a Kubernetes cluster in the cloud and deploy applications like HCVault, Vaultwarden, ntfy, and Gatus. However, maintaining another cluster and monitoring another group of workloads is a lot more time and effort than I am willing to put in.
| Service | Use | Cost |
|---|---|---|
| 1Password | Secrets with External Secrets | ~$80/yr$ |
| Cloudflare | Domain, DNS, WAF and R2 bucket (S3 Compatible endpoint) | ~$40/yr |
| GitHub | Hosting this repository and continuous integration/deployments | Free |
| Healthchecks.io | Monitoring internet connectivity and external facing applications | Free |
| Total: ~$10/mo |
In my cluster there are two instances of ExternalDNS running. One for syncing private DNS records to my UDM-SE using ExternalDNS webhook provider for UniFi, while another instance syncs public DNS to Cloudflare. This setup is managed by creating ingresses with two specific classes: internal for private DNS and external for public DNS. The external-dns instances then syncs the DNS records to their respective platforms accordingly.
| Name | Device | CPU | OS Disk | Local Disk | Rook Disk | RAM | OS | Purpose |
|---|---|---|---|---|---|---|---|---|
| Ayaka | MS-01 | i9-13900H | 960GB NVMe | 1TB NVMe | 1.92TB U.2 | 128GB | Talos | k8s control-plane |
| Eula | MS-01 | i9-13900H | 960GB NVMe | 1TB NVMe | 1.92TB U.2 | 128GB | Talos | k8s control-plane |
| Ganyu | MS-01 | i9-13900H | 960GB NVMe | 1TB NVMe | 1.92TB U.2 | 128GB | Talos | k8s control-plane |
OS Disk: m.2 Samsung PM9A3 960GB Local Disk: m.2 WD SN770 1TB Rook Disk: u.2 Samsung PM9A3 1.92TB
Total CPU: 60 Cores/60 Threads Total RAM: 384GB
| Name | Device | CPU | OS Disk | Local Disk | RAM | OS | Purpose |
|---|---|---|---|---|---|---|---|
| Celestia | Bosgame P1 | Ryzen 7 5700U | 500GB SSD | 1TB NVMe | 32GB | Talos | k8s control-plane |
OS Disk: 2.5" Samsung 870 EVO SSD Local Disk: m.2 WD SN770 1TB
Total CPU: 8 Cores/16 Threads Total RAM: 32GB
| Name | Device | CPU | OS Disk | Data Disk | RAM | OS | Purpose |
|---|---|---|---|---|---|---|---|
| Voyager | MS-01 | i5-12600H | 32GB USB | - | 96GB | Unraid | NAS/NFS/Backup |
| DAS | Lenovo SA120 | - | - | 6x14TB Raidz2 | - | - | ZFS |
| Venti | Raspberry Pi5 | Cortex A76 | 250GB NVMe | - | 8GB | Raspbian | NUT/SSH (Main) |
| Sayu | Raspberry Pi5 | Cortex A76 | 500GB NVMe | - | 8GB | Raspbian | NUT/SSH (Utility) |
| PiKVM | Raspberry Pi4 | Cortex A72 | 64GB mSD | - | 4GB | PiKVM (Arch) | KVM (Main) |
| JetKVM | JetKVM | RV1106G3 | 8GB EMMC | - | 256MB | Linux 5.10 | KVM (Utility) |
| PDU | UniFi USP PDU Pro | - | - | - | - | - | PDU |
| TESmart | 8 port KVM | - | - | - | - | - | Network KVM |
| Device | Purpose |
|---|---|
| Unifi UDM-SE | Network - Router |
| Back-UPS 600 | Network - UPS |
| Unifi USW-Enterprise-24-PoE | Server - 2.5G Switch |
| Unifi USW-Aggregation | Server - 10G Switch |
| Tripp Lite 1500 | Server - UPS |
| Ecoflow Delta 3 Plus | Server - UPS |
Big shout out to the cluster-template, and the Home Operations Discord community. Be sure to check out kubesearch.dev for ideas on how to deploy applications or get ideas on what you may deploy.