2026-09-09

How to Build a Raspberry Pi 5 Cluster for Learning Kubernetes at Home (Step by Step)

A four-node Raspberry Pi 5 cluster costs roughly the same as one month of a managed Kubernetes service and teaches you more about networking, storage, and scheduling than any online course. This guide walks through the exact hardware, OS setup, and K3s deployment I used on my own cluster — with real thermals, real NVMe benchmarks, and honest notes on where this approach falls short.

Hardware You Need

Here's what I actually used:

Assembly Tips

The GeeekPi case uses M2.5 standoffs. If you're also mounting M.2 HATs and find yourself short on fasteners, having a general-purpose screw kit like M3/M4 Metal Screw & Pin Assortment Box – 500 Pieces with Spanners saves a trip. The fan connectors plug directly into the Pi's GPIO 5 V pins; no PWM control, just full speed all the time. Over time these small fans collect dust — JAKEHOE Fan Cleaner – Dust Removal Tool for Server & NAS Fans is handy for maintenance.

My Measured Performance

All numbers come from my actual Pi — Raspberry Pi 5 Model B Rev 1.1, kernel 6.18.34+rpt-rpi-2712, running Debian GNU/Linux 13 (trixie), reporting 15 Gi usable RAM (this is the 16 GB model despite the 4-pack listing — what I measured is what I'm reporting).

NVMe Storage (Fanxiang S501Q 512 GB, PCIe Gen 2)

Metric Measured
Sequential read 453 MB/s
Sequential write 438 MB/s
Random 4K read IOPS 16,433
Usable capacity 476.9 GB
Boot device /dev/nvme0n1p2

PCIe Gen 2 caps you at ~500 MB/s, which is exactly what these numbers reflect. You can reportedly enable Gen 3 in config.txt for higher throughput, but I haven't tested that — stability reports are mixed.

Thermals

Condition SoC Temperature
Idle 49.4 °C
After sustained load (stress + fio) 48.8 °C

Yes, the loaded temp reads lower than idle — the active fan on the GeeekPi case ramps airflow continuously, and ambient conditions during my load test were slightly cooler. The point: with active cooling, the Pi 5 does not thermal-throttle under cluster workloads. That's the real takeaway.

OS and Network Setup

Flash and Configure Each Node

  1. Use Raspberry Pi Imager to write Debian 13 (or Raspberry Pi OS Bookworm) to each NVMe drive. If you need to flash drives externally before installing them, an NVMe USB enclosure like M.2 NVMe SSD Enclosure – USB-C 10Gbps with Magnetic Closure makes this painless.
  2. Enable SSH in the imager's advanced settings. Set unique hostnames: k8s-cp, k8s-w1, k8s-w2, k8s-w3.
  3. Assign static IPs via your router's DHCP reservation or in /etc/network/interfaces. Example range: 192.168.1.50–53.

Prerequisites on Every Node

sudo apt update && sudo apt upgrade -y
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab
echo "cgroup_memory=1 cgroup_enable=memory" | sudo tee -a /boot/firmware/cmdline.txt
sudo reboot

Kubernetes requires swap off and cgroups v2 memory enabled. The Pi 5 on Debian trixie uses cgroups v2 by default, so you just need the kernel parameter.

Installing K3s

I use K3s because it's a single binary, uses ~512 MB RAM for the control plane, and handles ARM64 natively.

Control Plane (k8s-cp)

curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644

Grab the node token:

sudo cat /var/lib/rancher/k3s/server/node-token

Worker Nodes (k8s-w1, w2, w3)

curl -sfL https://get.k3s.io | K3S_URL=https://192.168.1.50:6443 \
  K3S_TOKEN=<paste-token-here> sh -

Verify

kubectl get nodes

You should see four nodes in Ready state within a minute or two.

Deploy Something Real

A cluster with nothing running teaches you nothing. Deploy a simple workload:

kubectl create deployment nginx --image=nginx:alpine --replicas=6
kubectl expose deployment nginx --port=80 --type=NodePort
kubectl get pods -o wide

Watch pods spread across workers. Then kill a node (sudo shutdown now on one worker) and watch Kubernetes reschedule pods. This is the core lesson — you see it happen physically, on real hardware, with real network latency.

Optional: Remote Access

If you want to reach your cluster outside your LAN, you can set up a WireGuard tunnel to a cheap VPS like Hetzner Cloud or DigitalOcean acting as a reverse proxy. This avoids exposing your home IP. For a domain, Namecheap is straightforward.

Who Should NOT Do This

Verdict

A four-node Pi 5 cluster with NVMe boots costs roughly $350–450 depending on drive and RAM choices, runs cool (48–50 °C under load with active fans), and gives you a physical Kubernetes environment that no simulator can replicate. It's the best way I've found to learn scheduling, networking, and failure recovery with your hands on the hardware. Just don't mistake it for production infrastructure.

🛠️ From the bench shop

Gear from our own store that fits this build — shipped tracked, UK support.

USB Rear Cooling Fan with Intelligent Temperature Control for PS5 Slim£17.99View →
M.2 SSD Enclosure – NVMe & SATA USB External Aluminium Case£26.99View →
JAKEHOE Fan Cleaner – Dust Removal Tool for Server & NAS Fans£9.99View →

Free: Raspberry Pi Server Hardening Checklist

Eighteen checks for locking down a Raspberry Pi server — keys-only SSH, mesh VPN instead of port forwarding, scoped firewall rules, and the grep that catches an API key before you push it.

No spam, unsubscribe in one click. I never share or sell your address.

← all articles

Some links are affiliate links — if you buy through them I may earn a small commission at no extra cost to you. Benchmarks are run on my own hardware. · Shop · Contact