I Built a Kubernetes Cluster at Home (and Why You Should Too)

4 months ago 12
Raspberry Pi Kubernetes Cluster

Why Use Raspberry Pi for Kubernetes?

  • Great for learning, CI/CD, edge computing, or IoT
  • Cost-efficient and energy-saving
  • Grows with the ARM-based cloud ecosystem

What You’ll Need (2025 Hardware Recommendations)

  • Raspberry Pi 5 or Pi 4 (8GB recommended)
  • 1x MicroSD or SSD per Pi
  • USB 3.0 to SATA adapter (for SSD)
  • Ethernet cables and switch
  • Reliable power supply or PoE hat
  • Cooling: fans, heatsinks, or Argon One case
  • Optional: Cluster case

Networking Considerations

Installing the OS

OS Setup

  • Download the Raspberry Pi Imager and flash Raspberry Pi OS Lite (64-bit) onto each SD card.
  • Create an empty file named ssh in the boot partition to enable SSH.
  • Create a userconf file in the boot partition with {name}:{encrypted-password}.
  • Generate the password with: echo 'yourpassword' | openssl passwd -6 -stdin
  • Insert SD cards, connect to network and power on the Pi units.
  • Log in to each Pi via SSH and add your user to the sudo group: sudo usermod -aG sudo node
  • Use raspi-config to enable console autologin.

Setting Up Kubernetes

Prerequisites

  • Edit /boot/cmdline.txt and append: cgroup_enable=memory cgroup_memory=1
  • Add the Kubernetes repo: curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list sudo apt update && sudo apt upgrade -y
  • Install Docker: curl -sSL https://get.docker.com | sh sudo usermod -aG docker node
  • Install cri-dockerd: wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.4/cri-dockerd-0.3.4.arm64.tgz tar -xvzf cri-dockerd-0.3.4.arm64.tgz sudo mv cri-dockerd/cri-dockerd /usr/bin/cri-dockerd sudo chmod +x /usr/bin/cri-dockerd wget https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.service wget https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.socket sudo mv cri-docker.service /etc/systemd/system/ sudo mv cri-docker.socket /etc/systemd/system/ sudo systemctl enable cri-docker.service cri-docker.socket sudo systemctl start cri-docker.service cri-docker.socket
  • Disable swap: sudo apt-get install dphys-swapfile && \ sudo dphys-swapfile swapoff && \ sudo dphys-swapfile uninstall && \ sudo systemctl disable dphys-swapfile

Install Kubernetes components

sudo apt install -y kubelet=1.26.6-00 kubeadm=1.26.6-00 kubectl=1.26.6-00 sudo apt-mark hold kubelet kubeadm kubectl

Initialize the master node

sudo kubeadm init --config kubeadm-config.yaml

Apply Flannel CNI for networking:

kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml

Join other nodes using the outputted kubeadm join command with --cri-socket specified.

Adding Storage

  • Use Longhorn or hostPath for persistent volumes
  • Avoid NFS if performance is critical

Monitoring the Cluster

Useful Helm Charts

Maintenance & Backups

  • Use Velero for backing up CSI volumes
  • Keep cluster updated
  • Consider using k3sup for easy reboots
  • Use a UPS for power protection

Final Thoughts

  • Keep a cloned SD card ready for quick recovery
  • Thermal throttling is real—cool your Pis

Affiliate Disclaimer: Some links may earn us a commission at no extra cost to you. We only recommend gear we’ve tested or trust.

Read Entire Article