Infrastructure In Progress 2024

Homelab Kubernetes Cluster

4-node k3s cluster on Raspberry Pi with Longhorn distributed storage, monitoring and self-hosted services.

Homelab Kubernetes Cluster
Kubernetesk3sLonghornRaspberry PiTraefik
Source code ↗

Context

I wanted to push my homelab beyond a simple NAS or single server. The goal: a resilient, reproducible infrastructure close to a real production environment, but on low-power ARM hardware.

Architecture

The cluster runs on 4 Raspberry Pi 4 (8 GB RAM each) connected over Gigabit Ethernet:

  • 1 dedicated control plane
  • 3 worker nodes with Longhorn distributed storage
  • Pi-hole for DNS/DHCP and network filtering
  • Traefik as ingress controller with automatic TLS certificates

Self-Hosted Services

  • Immich — photo management, Google Photos style
  • Gitea — private Git repository
  • Docker Registry — private image registry
  • Joplin — note synchronization
  • Radicale — CalDAV/CardDAV

Power Management

I built a DIY UPS with LiPo batteries and an Arduino controller to trigger a graceful cluster shutdown on mains failure. A script monitors battery voltage over I2C and sends sequenced shutdown commands.

Challenges

Longhorn recovery after reinstallation was the most complex challenge — I had to manually recreate volume mappings to preserve existing data without proprietary formats.

What I Learned

  • Fine-grained resource management on constrained ARM nodes
  • Deep network debugging (CNI, kube-proxy, CoreDNS)
  • Backup strategies without vendor lock-in