Notes on Building a Raspberry Pi Kubernetes Cluster (Part 3: Installing Kubernetes)
For the first post in this series, see Part 1: the Hardware.
Kubernetes is not famous for simplicity, so when I discovered that Canonical published a curated configuration of Kubernetes that I could install as a single package, microk8s became my system of choice for running my cluster.
I found the installation instructions clear, including some specific configuration required for Raspberry Pi.
I’m using the 1.21/stable channel, so I installed microk8s on each node with:
sudo snap install microk8s --channel=1.21/stable --classic
Next I picked one node to initially configure and went through the next two steps in the docs (“join the group” and “check the status”).
This involved first adding my user to the microk8s group:
sudo usermod -a -G microk8s $USER
(Verify this by running
groups — the output should include
Then I fixed the permissions on the
~/.kube directory, which was created by
microk8s and was initially owned by root.
sudo chown -f -R $USER ~/.kube
Then I started adding nodes to the cluster, following these instructions. Originally I set things up with three nodes, but one thing led to another and now I’m up to nine:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
strange Ready <none> 9d v1.19.7-34+fa60fe11bf77d0
stark Ready <none> 19d v1.19.7-34+fa60fe11bf77d0
murdock Ready <none> 15d v1.19.7-34+fa60fe11bf77d0
vers Ready <none> 23h v1.19.7-34+fa60fe11bf77d0
parker Ready <none> 9d v1.19.7-34+fa60fe11bf77d0
banner Ready <none> 9d v1.19.7-34+fa60fe11bf77d0
romanova Ready <none> 9d v1.19.7-34+fa60fe11bf77d0
fury Ready <none> 19d v1.19.7-34+fa60fe11bf77d0
coulson Ready <none> 11d v1.19.7-34+fa60fe11bf77d0