Building a Bare-Metal Kubernetes Cluster on Raspberry Pis, Part 1
Why I’m doing this
I wanted to learn how a real bare-metal Kubernetes cluster is put together, not just how to use one. Cloud and managed Kubernetes hide the interesting parts: bootstrapping the control plane, certificates, etcd, load balancing with no cloud provider, and upgrades. So I’m building a small cluster at home from Raspberry Pi 5 boards, on a budget of roughly $600-700, and documenting what I learn along the way.
k3s or full Kubernetes?
My first instinct was k3s: it’s lightweight, installs in minutes, and is still conformant Kubernetes, so everything I’d run on it works the same. On 4GB boards it also leaves more memory for workloads.
But my goal was to learn the real setup, and k3s hides a lot of it by bundling the control plane into one binary and shipping its own defaults. So I’m going with kubeadm, the tool underneath much of the industry’s bare-metal tooling.
The tradeoff is memory. Upstream control plane components (API server, etcd, controller manager, scheduler) use noticeably more RAM than k3s’s single process. On 4GB nodes, that matters.
The plan
- Three Raspberry Pi 5 boards (4GB each). Larger models were expensive, and adding nodes later beats overbuying RAM.
- Three control plane nodes with stacked etcd, because production bare-metal clusters are almost always HA, and I want to practice quorum, failover and rolling upgrades. A virtual IP (kube-vip) sits in front of the API servers.
- SD cards first, SSDs later. I planned NVMe for etcd through the M.2 HAT+, but SSDs are expensive right now because of memory prices, and the official Raspberry Pi SSDs were out of stock where I looked. An SD card copes with an idle etcd, so I’m starting on SD cards I already had and will add SSDs later.
- GitOps with Argo CD managing everything on the cluster once it’s up.
I started with a single-node test on one Pi, then reset that node to become the first member of the HA cluster.
Hardware notes
A few things I learned while shopping:
- The 4GB Pi 5 was about $110 at one US reseller (limit one per order). Memory prices have pushed Raspberry Pi pricing up, and numbers varied a lot between sources.
- The standard M.2 HAT+ (not the Compact one) takes 2230 and 2242 NVMe drives. The drive must be M-key NVMe, since SATA M.2 drives won’t work.
- The Pi 5 is picky about power, so use the official 27W supply.

Setting up the first node
I flashed Raspberry Pi OS (64-bit) to an SD card with Raspberry Pi Imager and configured everything before first boot, so the Pi comes up headless with no monitor or keyboard:
- Hostname:
node-1. - SSH with a public key.
- Wi-Fi for the test. Fine for one node, but the real cluster will be wired, because etcd is latency-sensitive and Wi-Fi jitter can cause missed heartbeats and leader elections.
- No Raspberry Pi Connect. SSH does the job.
Preparing the OS
Kubernetes depends on kernel features that a stock Pi doesn’t always enable.
The memory cgroup
Kubernetes enforces memory limits through Linux cgroups. The Pi’s firmware disables the memory controller by default (cgroup_disable=memory), so I appended cgroup_memory=1 cgroup_enable=memory to the single line in /boot/firmware/cmdline.txt and rebooted. Afterward, memory appeared in /sys/fs/cgroup/cgroup.controllers, and stat -fc %T /sys/fs/cgroup printed cgroup2fs, confirming cgroup v2.
# On node-1: append the cgroup flags to the kernel command line (it's a single line)
$ sudo nano /boot/firmware/cmdline.txt
# Confirm the flags are at the end of the line
$ cat /boot/firmware/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=... rootfstype=ext4 ... cgroup_memory=1 cgroup_enable=memory
# Reboot so the kernel picks them up
$ sudo reboot
# (reconnected over SSH after the reboot)
# The memory controller should now be listed
$ cat /sys/fs/cgroup/cgroup.controllers
cpuset cpu io memory pids
# Confirm the system uses cgroup v2
$ stat -fc %T /sys/fs/cgroup
cgroup2fs
Swap
Kubernetes manages memory on the assumption that what a pod is given is real RAM. The scheduler places pods by their memory requests, and kubelet evicts pods when a node runs low. With swap on, a pod can spill past its limit into swap instead, so the node looks healthier than it is and slows down rather than evicting cleanly. That’s why kubelet refuses to start with swap enabled by default (failSwapOn: true). Newer releases can be configured to use swap, but I’m keeping the default.
My Pi had zram swap on, and swapoff -a only lasts until the next boot, because the units that create it (rpi-swap and systemd-zram-generator, with the swap unit dev-zram0.swap) bring it back. Masking them in systemd keeps swap off.
# On node-1: zram swap is on
$ swapon --show
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 2G 0B 100
# Turn it off now, and mask the units that would turn it back on at boot
$ sudo swapoff -a
$ sudo systemctl mask dev-zram0.swap systemd-zram-setup@zram0.service rpi-zram-writeback.timer
Created symlink '/etc/systemd/system/dev-zram0.swap' → '/dev/null'.
Created symlink '/etc/systemd/system/systemd-zram-setup@zram0.service' → '/dev/null'.
Created symlink '/etc/systemd/system/rpi-zram-writeback.timer' → '/dev/null'.
$ sudo reboot
# (reconnected over SSH after the reboot)
# Swap should stay off
$ swapon --show
Without the masking step, zram swap came back after my first reboot (/dev/zram0, 2G). After masking the units and rebooting again, swapon --show printed nothing, and systemctl list-units showed dev-zram0.swap and rpi-zram-writeback.timer as masked.
Kernel modules and sysctls
Kubernetes needs two kernel modules and three sysctl settings that a stock Pi doesn’t turn on:
overlayis the OverlayFS filesystem. A container image is a stack of read-only layers, and containerd’s default snapshotter uses OverlayFS to merge them with a thin writable layer for each container. That’s how ten containers from the same image share one copy on disk instead of ten.br_netfilterand the twobridge-nf-callsettings make traffic crossing a Linux bridge pass through iptables. Pods on the same node are connected through a bridge, and a bridge normally forwards packets at layer 2, below where iptables looks. kube-proxy implements Services as iptables rules that rewrite the Service’s virtual IP to a pod’s IP. If pod A calls a Service and the backend is pod B on the same node, B’s reply crosses the bridge straight back to A without being rewritten, so it arrives from B’s own IP. A never asked B anything, so it drops the reply. The sysctls only exist once the module is loaded, which is why the module comes first.ip_forwardlets the node route packets that aren’t addressed to it. By default, Linux drops them. A Kubernetes node acts as a router for its pods: traffic from a pod to a pod on another node, or out to the internet, comes in on the pod’s virtual interface and has to be forwarded out ofwlan0oreth0. kubeadm’s preflight checks refuse to run if it’s off.
# On node-1: load the kernel modules now, and at every boot
$ cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
overlay
br_netfilter
$ sudo modprobe overlay
$ sudo modprobe br_netfilter
# Set the networking sysctls
$ cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
# Apply them without rebooting
$ sudo sysctl --system
* Applying /etc/sysctl.d/k8s.conf ...
...
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
The files under /etc/modules-load.d/ and /etc/sysctl.d/ make the settings survive reboots, and modprobe and sysctl --system apply them right away. Checking the result:
# On node-1
$ lsmod | grep -E 'overlay|br_netfilter'
br_netfilter 65536 0
bridge 344064 1 br_netfilter
overlay 180224 0
ipv6 622592 52 bridge,br_netfilter
$ sysctl net.bridge.bridge-nf-call-iptables net.ipv4.ip_forward
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
Installing containerd
kubelet doesn’t run containers itself. It asks a container runtime through the CRI interface, and containerd is the standard choice. I used Debian’s packaged version.
# On node-1: install containerd from Debian's repository
$ sudo apt-get update
Hit:1 http://deb.debian.org/debian trixie InRelease
...
$ sudo apt-get install -y containerd
...
Setting up containerd (1.7.24~ds1-6+deb13u1) ...
Created symlink '/etc/systemd/system/multi-user.target.wants/containerd.service' → '/usr/lib/systemd/system/containerd.service'.
...
# Write out the default config, then switch to the systemd cgroup driver
$ sudo mkdir -p /etc/containerd
$ containerd config default | sudo tee /etc/containerd/config.toml
...
$ sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
$ grep SystemdCgroup /etc/containerd/config.toml
SystemdCgroup = true
# Restart containerd to load the config, and start it at every boot
$ sudo systemctl restart containerd
$ sudo systemctl enable containerd
# It should be active
$ systemctl status containerd --no-pager
● containerd.service - containerd container runtime
Loaded: loaded (/usr/lib/systemd/system/containerd.service; enabled; preset: enabled)
Active: active (running) since Sun 2026-10-11 01:12:52 PDT; 7s ago
...
Memory: 12.2M (peak: 14.2M)
...
The edit that matters is SystemdCgroup = true: kubelet and containerd must use the same cgroup driver, or pods become unstable. Debian’s package installed containerd 1.7.24, which matters later (see the warnings under kubeadm init).
Installing kubeadm, kubelet and kubectl
Debian’s repositories don’t carry current Kubernetes releases, so Kubernetes publishes its own apt repository at pkgs.k8s.io, with one repo per minor version. I used v1.36. apt-mark hold stops a routine apt upgrade from bumping the version, because cluster upgrades have ordering rules.
# On node-1: install what's needed to add an apt repository
$ sudo apt-get install -y apt-transport-https ca-certificates curl gpg
...
$ sudo mkdir -p -m 755 /etc/apt/keyrings
# Add Kubernetes' signing key and the v1.36 repository
$ curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
$ echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /
# Install the three packages
$ sudo apt-get update
...
$ sudo apt-get install -y kubelet kubeadm kubectl
...
# Hold them so a routine upgrade can't bump the version
$ sudo apt-mark hold kubelet kubeadm kubectl
kubelet set on hold.
kubeadm set on hold.
kubectl set on hold.
# Start kubelet (it restarts in a loop until kubeadm gives it a config)
$ sudo systemctl enable --now kubelet
The install also pulled in kubernetes-cni and iptables. Checking the result (output trimmed):
# On node-1
$ kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"36", ... GitVersion:"v1.36.5", ... Platform:"linux/arm64"}
$ kubectl version --client
Client Version: v1.36.5
Kustomize Version: v5.8.1
During kubeadm init, kubeadm reported that the newest release is v1.37.1 and fell back to stable-1.36. I’m one minor version behind, which is supported, and it gives me a real upgrade to practice with kubeadm upgrade later.
Reserving the IP and running kubeadm init
kubeadm bakes the node’s IP into the API server certificate, so the address must not change. I reserved the Pi’s Wi-Fi address (10.0.0.150) in my router’s DHCP settings first, then pinned it on init:
# On node-1
$ sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=10.0.0.150
The --pod-network-cidr matches Flannel’s default range. The certificate line in the output shows the address baked in:
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local node-1] and IPs [10.96.0.1 10.0.0.150]
Init ran preflight checks, generated certificates and kubeconfig files, wrote static pod manifests for etcd and the control plane, configured bootstrap tokens, and applied the CoreDNS and kube-proxy addons. It ended with “Your Kubernetes control-plane has initialized successfully!” (I left out the join command at the end, since it contains a token.)
Three warnings appeared, and none of them stopped init:
- Container runtime version. Debian’s packaged containerd (1.7.24) doesn’t implement the CRI
RuntimeConfigmethod, so kubeadm fell back to reading the cgroup driver from kubelet’s config. kubeadm says that fallback is removed in 1.37, so for newer Kubernetes releases I’ll need containerd 2.x from upstream instead of Debian’s package. - Pause image. containerd’s default sandbox image is
registry.k8s.io/pause:3.8, while kubeadm recommendspause:3.10.2. This is harmless for now and can be aligned inconfig.toml. - Missing optional cgroup: hugetlb. Optional and harmless. containerd’s default config already tolerates a missing hugetlb controller.
Then I set up kubectl for my user:
# On node-1
$ mkdir -p $HOME/.kube
$ sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
admin.conf is the cluster-admin credential, which is why I copy it and take ownership instead of running kubectl with sudo.
What kubeadm init created, and what each piece does
Right after kubeadm init, this is what my single node looked like:
# On node-1
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
node-1 NotReady control-plane 33s v1.36.5
$ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-589f44dc88-5p5b8 0/1 Pending 0 21s
kube-system coredns-589f44dc88-7t7b5 0/1 Pending 0 21s
kube-system etcd-node-1 1/1 Running 0 36s
kube-system kube-apiserver-node-1 1/1 Running 0 36s
kube-system kube-controller-manager-node-1 1/1 Running 0 36s
kube-system kube-proxy-br2bt 1/1 Running 0 21s
kube-system kube-scheduler-node-1 1/1 Running 0 36s
The node is NotReady and CoreDNS is Pending because there is no network plugin yet. That’s expected, and installing one fixes both.
The control plane
- kube-apiserver is the front desk. Every request goes through it (
kubectl, kubelet, the scheduler, the controllers). It authenticates and validates the caller, then reads or writes state. It is the only component that talks to etcd directly. - etcd is the record book: a distributed key-value store holding all cluster state, such as every Deployment, Pod and Secret. It uses the Raft algorithm to agree on writes across members, which is why high availability needs three of them. The
-node-1suffix onetcd-node-1is just kubeadm appending the hostname to static pod names. - kube-scheduler assigns pods to nodes. It watches for pods with no node yet, filters nodes by resources, taints and affinity, picks the best one, and records the choice through the API server. It doesn’t start anything.
- kube-controller-manager runs many control loops in one process. Each compares desired state with actual state and acts: the Deployment controller creates ReplicaSets, the ReplicaSet controller creates pods, the node controller notices dead nodes. It also gives each node its slice of the pod address range.
On every node
- kubelet is the node agent, running as a systemd service rather than a pod. It reads the static pod manifests in
/etc/kubernetes/manifeststhat start the control plane, and it asks containerd to run every other pod. - kube-proxy makes Services work. A Service has a virtual IP that no machine owns, so kube-proxy watches Services and endpoints and programs iptables rules that spread traffic across the real pod IPs. This is where the
br_netfiltersysctls from earlier matter. - CoreDNS is the cluster’s DNS server. It lets pods resolve names like
my-service.my-namespace.svc.cluster.localto the Service’s virtual IP. It is a regular pod, so it can’t start until networking exists.
CNI and Flannel
Kubernetes requires that every pod gets its own IP and can reach every other pod directly, on any node, without NAT. It doesn’t implement that itself. It hands the job to a plugin through the Container Network Interface (CNI).
When a pod starts, kubelet asks containerd to create it, and containerd creates an empty network namespace for it. containerd then reads the CNI config from /etc/cni/net.d and runs the plugin binary from /opt/cni/bin with an ADD command. The plugin creates a virtual cable (a veth pair) between the pod’s namespace and the node, assigns the pod an IP, and sets up routes. When the pod is deleted, the runtime calls the plugin again to clean up. With no CNI config present, kubelet reports the node’s network as not ready, which is exactly the state shown above.
Flannel is the simplest popular CNI. It runs as a DaemonSet with one pod per node, hands each node a slice of the 10.244.0.0/16 pod range I passed to kubeadm init, and by default carries cross-node traffic over VXLAN, which wraps pod packets inside ordinary UDP packets. It doesn’t enforce NetworkPolicy, which is one reason I plan to use Cilium for the real cluster.
How they fit together
When I run kubectl create deployment hello --image=nginx:
- kubectl sends the request to the API server, which stores it in etcd.
- The controller manager sees the new Deployment and creates a ReplicaSet, then a Pod object.
- The scheduler sees the unassigned pod and picks a node.
- kubelet on that node sees the assignment and asks containerd to start the container, which calls the CNI plugin to give it an IP.
- If the pod is exposed as a Service, kube-proxy adds the rules and CoreDNS answers for its name.
Installing Flannel
# On node-1
$ kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml
namespace/kube-flannel created
serviceaccount/flannel created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created
$ kubectl get pods -A -w
Applying the manifest created a kube-flannel namespace and a DaemonSet. Watching the pods, the Flannel pod went from Init:1/2 through PodInitializing to Running, and the two CoreDNS pods moved from Pending to ContainerCreating as it came up:
kube-flannel kube-flannel-ds-swrqb 0/1 Init:1/2 0 12s
kube-flannel kube-flannel-ds-swrqb 0/1 PodInitializing 0 17s
kube-flannel kube-flannel-ds-swrqb 1/1 Running 0 17s
kube-system coredns-589f44dc88-5p5b8 0/1 Pending 0 5m26s
kube-system coredns-589f44dc88-5p5b8 0/1 ContainerCreating 0 5m26s
That’s the CNI doing its job. Until a network plugin was installed, the node stayed NotReady, which kept CoreDNS from being scheduled.
CoreDNS stuck in ContainerCreating
After Flannel started, the two CoreDNS pods sat in ContainerCreating for 14 minutes:
# On node-1
$ kubectl get pods -A
...
kube-system coredns-589f44dc88-5p5b8 0/1 ContainerCreating 0 14m
kube-system coredns-589f44dc88-7t7b5 0/1 ContainerCreating 0 14m
kubectl describe on one of them had the answer in its events:
# On node-1
$ kubectl -n kube-system describe pod coredns-589f44dc88-5p5b8 | tail -15
...
Warning FailedCreatePodSandBox 10m kubelet Failed to create pod sandbox: ... plugin type="loopback" failed (add): failed to find plugin "loopback" in path [/usr/lib/cni]
Warning FailedCreatePodSandBox 10m kubelet Failed to create pod sandbox: ... plugin type="flannel" failed (add): failed to find plugin "flannel" in path [/usr/lib/cni]
...
Normal SandboxChanged 47s (x586 over 10m) kubelet Pod sandbox changed, it will be killed and re-created.
The cause was a mismatch between two directories. When containerd creates a pod sandbox, it reads the network config from /etc/cni/net.d, where Flannel writes its config, and then looks for the plugin executables named in that config, such as flannel and loopback, in its CNI bin_dir. The default config that Debian’s containerd package generated back in the containerd step set bin_dir = "/usr/lib/cni", but Flannel and the kubernetes-cni package install their binaries into /opt/cni/bin. containerd looked in the wrong place, couldn’t find any plugin, and failed every sandbox creation, while kubelet kept retrying.
The fix was to point containerd at the right directory, restart it, and recreate the stuck pods:
# On node-1: point containerd at the directory where the CNI plugins actually are
$ sudo sed -i 's#bin_dir = "/usr/lib/cni"#bin_dir = "/opt/cni/bin"#' /etc/containerd/config.toml
# Restart containerd so it reads the new config
$ sudo systemctl restart containerd
# Delete the stuck CoreDNS pods so they're recreated right away
$ kubectl -n kube-system delete pod -l k8s-app=kube-dns
# CoreDNS comes up within seconds
$ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-flannel kube-flannel-ds-swrqb 1/1 Running 0 12m
kube-system coredns-589f44dc88-k95ck 1/1 Running 0 17s
kube-system coredns-589f44dc88-rpm47 1/1 Running 0 17s
...
The other pods were never affected because the control plane pods, kube-proxy and Flannel itself use the host’s network instead of a pod network, so they never go through the CNI plugin. CoreDNS was the first pod that needed one. This is the kind of integration detail that k3s hides by bundling its own containerd and CNI binaries, and that a kubeadm build leaves to you.
Removing the taint and running a test workload
kubeadm taints control plane nodes with node-role.kubernetes.io/control-plane:NoSchedule so regular pods stay off them. On a one-node cluster that would leave nowhere to run anything, so I removed the taint (the trailing - means remove) and created a test deployment:
# On node-1
$ kubectl taint nodes --all node-role.kubernetes.io/control-plane-
node/node-1 untainted
$ kubectl create deployment hello --image=nginx
deployment.apps/hello created
$ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default hello-558494cd6d-967z4 1/1 Running 0 14s
...
The hello pod was Running 14 seconds after I created it. That exercises the whole path: the scheduler placed it, containerd pulled an arm64 nginx image, and the CNI plugin gave it a pod network.
Testing Services and DNS
A running nginx pod only proves scheduling and pod networking. To test Services and DNS as well, I exposed it as a Service and curled it by name from a throwaway pod:
# On node-1
$ kubectl expose deployment hello --port=80
service/hello exposed
$ kubectl run curl --rm -it --image=curlimages/curl --restart=Never -- curl -s http://hello
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
...
</html>
pod "curl" deleted from default namespace
That one request exercised most of what I’d set up. CoreDNS resolved the name hello to the Service’s virtual IP, kube-proxy’s forwarding rules sent the traffic to the nginx pod’s IP, and the packets crossed the Flannel network between the two pods. It also confirms the br_netfilter and ip_forward settings from earlier are doing their job.
How much memory does it use?
I took a baseline right after the first boot, before installing anything, and measured again with the control plane, Flannel, CoreDNS and kube-proxy running:
# On node-1: before Kubernetes (fresh Raspberry Pi OS install, zram swap still on)
$ free -h
total used free shared buff/cache available
Mem: 4.0Gi 429Mi 2.8Gi 34Mi 836Mi 3.5Gi
Swap: 2.0Gi 0B 2.0Gi
# With the control plane running, Flannel and CoreDNS up, and swap disabled
$ free -h
total used free shared buff/cache available
Mem: 4.0Gi 1.0Gi 607Mi 110Mi 2.5Gi 2.9Gi
Swap: 0B 0B 0B
The column that matters is available, not free. Linux uses idle RAM as cache and gives it back on demand, so a low free number is normal. Running Kubernetes added roughly 600MB of used memory: etcd, the API server, the controller manager, the scheduler, kubelet, containerd, kube-proxy, Flannel and CoreDNS together. That leaves about 2.9Gi available on a 4GB Pi.
This is a single snapshot of an idle cluster. I’ll measure again after the rebuild.
Installing Argo CD and measuring its cost
I installed Argo CD with the upstream manifests to see what it would cost on a 4GB node. The --server-side flag is required because some of its CRDs are too large for a normal kubectl apply:
# On node-1
$ kubectl create namespace argocd
$ kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Right after the install, free -h showed 1.4Gi used and 2.5Gi available, and ps turned up something I hadn’t expected: the Raspberry Pi desktop (labwc, wf-panel-pi, pcmanfm) was running. The OS I’d flashed was the desktop edition, not Lite. I switched the node to boot headless with sudo systemctl set-default multi-user.target, scaled Argo CD’s Dex server and notifications controller to zero (I log in with the built-in admin account and haven’t configured notifications), and later removed Argo CD entirely to measure the node on its own:
| State | Used | Available |
|---|---|---|
| Control plane + Flannel, desktop running | 1.0Gi | 2.9Gi |
| Control plane + Flannel, headless | 911Mi | 3.1Gi |
| Plus Argo CD without Dex and notifications, headless | 1.0Gi | 2.9Gi |
free rounds to 0.1Gi, so these are rough, but they point the same way. The desktop and the trimmed Argo CD each cost somewhere around 100 to 200MiB of real memory. Adding up their processes’ resident sizes suggested more, about 270MiB for the desktop and 400MiB for Argo CD, but summing RSS overstates because shared pages are counted in every process that maps them. Argo CD also runs once for the whole cluster, while the control plane components run on every control plane node, so its cost isn’t multiplied by three. The headless numbers without Argo CD, 911Mi used and 3.1Gi available, are the baseline I’ll compare Cilium against.
Swapping Flannel and kube-proxy for Cilium
Flannel was the simple choice for the first run, but I want the industry-representative stack for the real cluster, so I rebuilt the node with Cilium. I reset and re-initialized instead of swapping the CNI in place, because Flannel leaves its config, interfaces and iptables rules behind. Cilium can also replace kube-proxy, so kubeadm init has to skip the kube-proxy addon.
# On node-1: tear down the old cluster, then reboot to clear Flannel's
# network interfaces and iptables rules
$ sudo kubeadm reset -f
$ sudo rm -rf /etc/cni/net.d $HOME/.kube
$ sudo reboot
# (reconnected over SSH after the reboot)
# Download and install the Cilium CLI for arm64, verifying its checksum
$ CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
$ CLI_ARCH=arm64
$ curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
$ sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
$ sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
$ rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
# Re-initialize the cluster, skipping kube-proxy because Cilium will replace it
$ sudo kubeadm init --skip-phases=addon/kube-proxy --apiserver-advertise-address=10.0.0.150 --pod-network-cidr=10.244.0.0/16
# (set up kubectl and removed the control-plane taint, as before)
# Install Cilium, pointing it at the API server directly because there's no kube-proxy
$ cilium install --version 1.19.5 \
--set kubeProxyReplacement=true \
--set k8sServiceHost=10.0.0.150 \
--set k8sServicePort=6443 \
--set ipam.mode=kubernetes
# Wait until Cilium reports healthy
$ cilium status --wait
Three of those settings matter. --skip-phases=addon/kube-proxy stops kubeadm from installing kube-proxy, whose iptables rules would conflict with Cilium’s eBPF service routing. k8sServiceHost and k8sServicePort point Cilium directly at the API server, because with no kube-proxy the kubernetes Service isn’t reachable until Cilium itself is running. And ipam.mode=kubernetes keeps pod addresses inside the 10.244.0.0/16 range kubeadm allocated, because Cilium’s default pod range (10.0.0.0/8) would overlap my 10.0.0.x home network.
The check that Cilium had taken over:
# On node-1
$ kubectl -n kube-system exec ds/cilium -- cilium-dbg status | grep KubeProxyReplacement
KubeProxyReplacement: True [wlan0 10.0.0.150 <IPv6 addresses omitted> (Direct Routing)]
There’s no kube-proxy pod in the list any more, and a cilium-envoy pod appeared that I hadn’t seen before. A few minutes after the install:
# On node-1
$ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system cilium-7wrqm 1/1 Running 0 7m4s
kube-system cilium-envoy-6vhtz 1/1 Running 0 7m4s
kube-system cilium-operator-9fd48fcf7-kmc4b 1/1 Running 2 (5m24s ago) 7m4s
kube-system coredns-589f44dc88-fbr55 1/1 Running 0 7m11s
kube-system coredns-589f44dc88-h58xk 1/1 Running 0 7m11s
kube-system etcd-node-1 1/1 Running 3 7m18s
kube-system kube-apiserver-node-1 1/1 Running 3 7m18s
kube-system kube-controller-manager-node-1 1/1 Running 5 (6m9s ago) 7m18s
kube-system kube-scheduler-node-1 1/1 Running 6 (5m23s ago) 7m18s
The restart counts looked alarming at first. Two and a half minutes in, the scheduler had restarted 6 times and the controller manager 5, and CoreDNS was still 0/1. Four minutes later the counts hadn’t moved, CoreDNS was 1/1, and the most recent restarts all dated from the first minute or two after the pods started. My guess is startup churn while the SD card was busy pulling and unpacking Cilium’s images, but I didn’t capture events at the time, so I can’t confirm it.
What Cilium costs
# On node-1
$ free -h
total used free shared buff/cache available
Mem: 4.0Gi 1.1Gi 508Mi 20Mi 2.5Gi 2.9Gi
Swap: 0B 0B 0B
$ ps -eo rss,comm --sort=-rss | grep cilium
185824 cilium-agent
106144 cilium-operator
50960 cilium-envoy
| State | Used | Available |
|---|---|---|
| Flannel + kube-proxy, headless | 911Mi | 3.1Gi |
| Cilium replacing kube-proxy, headless | 1.1Gi | 2.9Gi |
Cilium cost roughly 150 to 250MiB more than Flannel plus kube-proxy. The process list agrees: the agent, operator and Envoy add up to about 335MiB of resident memory, and the Flannel daemon plus kube-proxy they replaced were about 90MiB, a net difference near 250MiB.
For the HA design, that cost isn’t spread evenly. The Cilium agent and Envoy run on every node, about 230MiB of resident memory each, while the operator runs once for the cluster (I haven’t checked how many replicas the HA install will run). By comparison, Flannel and kube-proxy came to about 90MiB per node.
How slow is the SD card for etcd?
After the Cilium install, the control plane pods had restarted several times, and I suspected the SD card. etcd syncs every write to disk before confirming it, so its disk latency is the thing to measure. etcd exposes it on a local metrics port as a histogram of WAL fsync times. Here is everything since etcd started, which includes the Cilium install:
# On node-1
$ curl -s http://127.0.0.1:2381/metrics | grep etcd_disk_wal_fsync_duration_seconds_bucket
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.001"} 417
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.002"} 526
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.004"} 2014
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.008"} 2530
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.016"} 2642
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.032"} 2680
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.064"} 2701
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.128"} 2716
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.256"} 2731
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.512"} 2739
etcd_disk_wal_fsync_duration_seconds_bucket{le="1.024"} 2741
etcd_disk_wal_fsync_duration_seconds_bucket{le="2.048"} 2748
etcd_disk_wal_fsync_duration_seconds_bucket{le="4.096"} 2750
etcd_disk_wal_fsync_duration_seconds_bucket{le="8.192"} 2751
etcd_disk_wal_fsync_duration_seconds_bucket{le="+Inf"} 2753
The average was 23.56ms over 2,753 syncs. That average hides the shape: most syncs were fast, but a small number were very slow, including 12 over a second and 2 over eight seconds. To see whether that was the install or the card itself, I took two snapshots five minutes apart on an idle cluster and subtracted them:
# On node-1
$ snap() { curl -s http://127.0.0.1:2381/metrics | grep -E '^etcd_disk_wal_fsync_duration_seconds_(bucket|count)'; }
$ snap > /tmp/a.txt; sleep 300; snap > /tmp/b.txt
$ paste /tmp/a.txt /tmp/b.txt | awk '{print $1, $4-$2}'
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.001"} 53
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.002"} 73
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.004"} 580
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.008"} 680
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.016"} 686
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.032"} 686
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.064"} 686
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.128"} 687
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.256"} 687
etcd_disk_wal_fsync_duration_seconds_bucket{le="0.512"} 688
etcd_disk_wal_fsync_duration_seconds_bucket{le="1.024"} 688
etcd_disk_wal_fsync_duration_seconds_bucket{le="2.048"} 688
etcd_disk_wal_fsync_duration_seconds_bucket{le="4.096"} 688
etcd_disk_wal_fsync_duration_seconds_bucket{le="8.192"} 688
etcd_disk_wal_fsync_duration_seconds_bucket{le="+Inf"} 688
etcd_disk_wal_fsync_duration_seconds_count 688
The percentiles below are my interpolation between histogram buckets, so treat them as estimates:
| Fsync time | Since etcd started (includes the Cilium install) | Idle 5-minute window |
|---|---|---|
| Median | about 3ms | about 3ms |
| 90th percentile | about 8ms | about 6ms |
| 95th percentile | about 14ms | about 7ms |
| 99th percentile | about 200ms | about 9ms |
| Slowest | over 8 seconds | between 256ms and 512ms |
The guidance I remember from etcd’s documentation is that the 99th percentile should stay under about 10ms. At idle, the SD card just meets that, with little headroom. The bad tail appeared during busy periods like the install, which is also when the control plane pods restarted. That fits, but I never captured events to prove the connection.
So the card handles a quiet etcd and struggles when something else is hammering it. Routine operations like image pulls, upgrades and Argo CD syncs will keep producing those bursts. I haven’t yet run the fio disk benchmark to compare this card against a better one or against NVMe.
How much does the SD card get written?
Latency is only half of the SD card question. Wear depends on how many bytes get written, and the kernel keeps a running count of sectors written per disk. Since boot, it showed this:
# On node-1
$ awk '{printf "%.0f MiB written since boot\n", $7*512/1048576}' /sys/block/mmcblk0/stat; uptime -p
2102 MiB written since boot
up 37 minutes
That number is misleading, because it includes the whole rebuild: downloading the Cilium CLI, running kubeadm init, and pulling and unpacking images. To get a steady-state rate, I took two readings five minutes apart on an idle cluster:
# On node-1
$ a=$(awk '{print $7}' /sys/block/mmcblk0/stat); sleep 300; b=$(awk '{print $7}' /sys/block/mmcblk0/stat)
$ awk -v a=$a -v b=$b 'BEGIN{printf "%d KiB written in 5 min, about %.2f GiB/day at this rate\n", (b-a)*512/1024, (b-a)*512*288/1073741824}'
43052 KiB written in 5 min, about 11.82 GiB/day at this rate
That is about 42MiB every five minutes, or roughly 12GiB a day, on a cluster that is doing nothing. It counts everything that writes to the card, not just etcd, and real use only adds to it. At that rate the card absorbs more than 4TiB a year.
To see who was doing the writing, I added up the bytes each process had written to storage since it started:
# On node-1
$ sudo bash -c 'for p in /proc/[0-9]*; do w=$(awk "/^write_bytes/{print \$2}" $p/io 2>/dev/null); n=$(awk "/^Name:/{print \$2}" $p/status 2>/dev/null); [ -n "$w" ] && echo "$((w/1048576)) MiB $n"; done | sort -rn | head -10'
10009 MiB etcd
1600 MiB containerd
257 MiB jbd2/mmcblk0p2-8
223 MiB systemd
80 MiB containerd-shim
2 MiB kubelet
0 MiB wpa_supplicant
0 MiB wireplumber
0 MiB watchdogd
0 MiB systemd-udevd
etcd accounts for roughly four-fifths of the writes in that list. containerd’s 1,600MiB is mostly image pulls from the install, which won’t repeat at that rate. jbd2 is the ext4 filesystem journal, and systemd includes the system journal, so tuning log settings wouldn’t change much. The main writer is etcd, which means moving only etcd’s data directory onto better storage would take most of the wear off the SD card.
Eighteen hours later, and a disk cleanup
After about 18 hours on the SD card, the restart counts hadn’t moved since the first few minutes after the Cilium install, and rebooting the node raised each one by exactly one. So the early restarts really were startup churn, not ongoing instability.
The 16GB card was 83% full, mostly because I’d flashed the desktop edition. Purging the desktop packages freed about 2G, but the bigger win was a 2GB swap file at /var/swap: masking the swap units had stopped it from being used, but didn’t delete it. With swap off and no swap line in /etc/fstab, I deleted it:
# On node-1: delete the leftover swap file
$ sudo rm /var/swap
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 15G 7.8G 5.7G 58%
That took the card from 83% full to 58%. Most of what remained was containerd’s 3.5G image store, which the cluster actually uses, and etcd’s own data directory was only 252MB.
Next
That’s the end of the single-node trial. In Part 2, I add two more Pis running Raspberry Pi OS Lite, move all three onto Ethernet, and rebuild node-1 as the first member of a three-node HA control plane with kube-vip, Cilium and metrics-server.