k3s-rpi-cluster icon indicating copy to clipboard operation
k3s-rpi-cluster copied to clipboard

Setting up a K3S Kubernetes cluster using RPI4

Kubernetes on Raspbian

Build a Kubernetes (k3s) cluster with RPis and utilize GitOps for managing cluster state.

Thanks to the following pages

  • https://gist.github.com/elafargue/a822458ab1fe7849eff0a47bb512546f
  • https://github.com/onedr0p/homelab-gitops
  • https://github.com/billimek/k8s-gitops

Pre-reqs:

  • This was done using a cluster of 4 x RPi 4 4GB
  • All Pi's are connected via a local ethernet switch on a 10.0.0.0/24 LAN
  • The master node connects to the outside world on WiFi, and provides NAT for the the rest of the cluster.

Directory layout description

.
│   # Flux will scan and deploy from this directory
├── ./deployments
│   # Initial setup of the cluster
├── ./setup
│   │   # Scripts for setting things up
│   ├── ./bin
│   │   # Config for RPI
│   └─ ./nodes
│   # Docker builds for ARM devices
└── ./docker

Network topology

IP Function MAC Address
192.168.1.1 Router
192.168.1.18 Master wifi interface
10.0.0.0/24 k3s cluster CIDR
10.0.0.1 k3s master (master) dc:a6:32:67:76:f1
10.0.0.2 k3s worker (node-1) dc:a6:32:67:77:06
10.0.0.3 k3s worker (node-2) dc:a6:32:67:76:b8
10.0.0.4 k3s worker (node-3) dc:a6:32:67:77:3e

Hardware list