Skip to main content

Kubernetes on Raspberry Pi

· 2 min read
Principal, Axiom Design Studio

Raspberry Pi 4

"Challenge: Create a cheap Kubernetes cluster to run Kubernetes workloads."

Gathering the parts

The first step was selecting the components. With prior Kubernetes experience, the hardware needed to be specced appropriately while staying within budget. The parts list was built around gear from Australian Raspberry Pi reseller Core Electronics.

Raspberry Pi inventory

ComponentQty
Raspberry Pi 4 — 4GB4
Raspberry Pi 4 — 8GB4
Argon NEO cases8
Raspberry Pi 4 power supplies8

Rounding out the build: 8× 64GB SanDisk Extreme cards, a Netgear 16-port switch, and ten 1TB Samsung SSDs for distributed cluster storage.

:::tip Hindsight It would have been worth getting the PoE HAT to cut down on cabling — something to consider for a future 10-node cluster. :::

Software installation

Once assembled, each Raspberry Pi was set up with Ubuntu 20.04 across all eight SanDisk cards, with a personal user and an ansible user added for automation. To reduce SD card wear, log2ram was installed on every node — the foundation for building out the cluster.

Next came the real work: writing Ansible scripts to install Docker, then kubeadm and kubelet, across the fleet. Spread over roughly three weekends at about four hours each, this eventually produced a stable, repeatable set of scripts.

Running the finished playbooks installed Docker and the Kubernetes base software across all the machines in about 45 minutes. Bootstrapping the cluster itself — one master node and seven worker nodes — was a manual step that took only 10–15 minutes. Adding Calico for cluster networking completed the setup: a fully operational cluster.

Software still on the list to add:

  • Istio — no ARM build was available at the time
  • MetalLB — load balancer for cluster services (6 IPs allocated)
  • Tyk / Solo Gloo Edge — API gateway for deployed components
  • Longhorn — cluster storage management
  • Ceph — distributed storage

Like most homelab projects, this one is ongoing, with the long-term goal of building toward a software development capability.