Building a Production-Grade Kubernetes Cluster at Home
This post covers the complete setup of a production-grade Kubernetes cluster in a homelab environment, including hardware selection, networking, GitOps workflows, and storage solutions.
Building a Production-Grade Kubernetes Cluster at Home
After years of running Docker Compose for my homelab services, I decided it was time to level up. Here's my journey building a fully automated Kubernetes cluster on bare metal.
The Hardware Setup
I started with three Intel NUCs (10th gen i5, 32GB RAM each) as my control plane and worker nodes. Nothing fancy, but plenty of power for a homelab environment.
Network Architecture
- VLAN 10: Management network (192.168.10.0/24)
- VLAN 20: Kubernetes pod network (10.244.0.0/16)
- VLAN 30: Service network (10.96.0.0/12)
Installing Kubernetes
I went with kubeadm for installation because it gives me full control over the cluster configuration. Here's the basic setup:
# Initialize the control plane
sudo kubeadm init \
--pod-network-cidr=10.244.0.0/16 \
--service-cidr=10.96.0.0/12 \
--control-plane-endpoint=k8s.homelab.local:6443
# Install Calico for networking
kubectl apply -f calico.yaml
GitOps with ArgoCD
Everything in my cluster is managed through GitOps using ArgoCD. I have separate repositories for:
- Infrastructure components (ingress, storage, monitoring)
- Application deployments
- Cluster configuration
This means I can destroy and rebuild my entire cluster from Git in under an hour.
Storage Solution
I'm using Longhorn for distributed block storage across the nodes. It provides:
- Automatic replication across nodes
- Snapshot and backup capabilities
- Easy volume expansion
Next Steps
In the next post, I'll cover setting up automated backups and disaster recovery for the Kubernetes cluster.