This is a mono repository for my home infrastructure and Kubernetes cluster. I try to adhere to Infrastructure as Code (IaC) and GitOps practices using the tools like Ansible, Kubernetes, Flux, Renovate and GitHub Actions.
My Kubernetes cluster is deploy with Talos. This is a semi-hyper-converged cluster, workloads and block storage are sharing the same available resources on my nodes while I have a separate server with on my Synology NAS for storage for bulk file storage and backups.
- actions-runner-controller: Self-hosted Github runners.
- cert-manager: Creates SSL certificates for services in my cluster.
- cilium: Internal Kubernetes container networking interface.
- cloudflared: Enables Cloudflare secure access to certain ingresses.
- external-dns: Automatically syncs ingress DNS records to a DNS provider.
- external-secrets: Managed Kubernetes secrets using Azure Keyvault.
- ingress-nginx: Kubernetes ingress controller using NGINX as a reverse proxy and load balancer.
- rook: Distributed block storage for peristent storage.
- sops: Managed secrets for Kubernetes and Terraform which are commited to Git.
- spegel: Stateless cluster local OCI registry mirror.
- teleport: Manage some network resources remotely
- tf-controller: Additional Flux component used to run Terraform from within a Kubernetes cluster.
- volsync: Backup and recovery of persistent volume claims.
Flux watches my kubernetes folder (see Directories below) and makes the changes to my cluster based on the YAML manifests.
The way Flux works for me here is it will recursively search the kubernetes/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. Those Flux kustomizations will generally have a HelmRelease
or other resources related to the application underneath it 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 # Kubernetes cluster defined as code
├─📁 apps # Apps deployed into my cluster grouped by namespace (see below)
├─📁 bootstrap # Flux installation
├─📁 flux # Main Flux configuration of repository
└─📁 templates # re-useable components
Name | CIDR |
---|---|
Server VLAN | 10.0.30.0/24 |
Kubernetes pods | 10.69.0.0/16 |
Kubernetes services | 10.96.0.0/16 |
While most of my infrastructure and workloads are selfhosted 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.
Service | Use | Cost |
---|---|---|
GitHub | Hosting this repository and continuous integration/deployments | Free |
Cloudflare | Domain, DNS and proxy management | Free |
UptimeRobot | Monitoring internet connectivity and external facing applications | Free |
NextDNS Pro | DNS with some ad-blocking and other features | ~$1.65.mo |
Azure Key Vault | Secrets with External Secrets | ~$0.10/mo |
Total: ~$1.75/mo |
Unifi with Ad-Blocking
Outside the external-dns
instance mentioned above another instance is deployed in my cluster and configured to sync DNS records to Cloudflare. The only ingress this external-dns
instance looks at to gather DNS records to put in Cloudflare
are ones that have an ingress class name of external
and contain an ingress annotation external-dns.alpha.kubernetes.io/target
.
Model | RAM | OS Disk Size | Data Disk Size | Operating System | Purpose | Rack Location |
---|---|---|---|---|---|---|
Dell Optiplex 7050 Micro | 16 GB | 500GB (SSD) | 1TB (NVMe) | Talos | Node 1 (K8s Control Plane) | 15U (Left) |
Dell Optiplex 7050 Micro | 16 GB | 500GB (SSD) | 1TB (NVMe) | Talos | Node 2 (K8s Control Plane) | 15U (Right) |
Dell Optiplex 7050 Micro | 16 GB | 500GB (NVMe) | 1TB (SSD) | Talos | Node 3 (K8s Worker) | 16U (Left) |
HP ProDesk 600 G3 Mini | 16 GB | 500GB (SSD) | 1TB (NVMe) | Talos | Node 4 (K8s Worker) | 17U (Right) |
HP ProDesk 600 G3 Mini | 16 GB | 500GB (SSD) | 1TB (NVMe) | Talos | Node 5 (K8s Control Plane) | 17U (Left) |
Dell Optiplex 3060 Micro | 16 GB | 500GB (SSD) | 1TB (NVMe) | Talos | Node 6 (K8s Worker) | 16U (Right) |
Big shout out to all the contributors to the flux-cluster-template projects that we are using in this repository.
Community member onedr0p for initially creating this amazing template and providing me with additional help.
See awful commit history
See LICENSE