When I built the in-house Kubernetes cluster with Raspberry PIs, I followed the kubeadm instructions and installed Raspberry PI OS on the PIs. It was all good except the RPI OS is 32-bit. Now I want to install a Ubuntu 20.04 Server ARM64 on this PI, below are steps with which I rebuilt the node with Ubuntu and without disrupting the workloads running in my cluster.
First, I didn’t need to shutdown the running node because I’ve got a spare MicroSD card to prepare the Ubuntu image. The instruction for writing the image to the MicroSD card is here. When the card is prepared by the Imager, I kept it in the card reader because I wanted to set the IP address instead of the automatic IP by default. A fixed IP makes more sense if I want to connect to it, right?
To set a static IP in the Ubuntu MicroSD card, open system-boot/network-config
file with a text editor and put in something like this:
version: 2
ethernets:
eth0:
# Rename the built-in ethernet device to "eth0"
match:
driver: bcmgenet smsc95xx lan78xx
set-name: eth0
addresses: [192.168.1.82/24]
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1]
optional: true
Now the new OS is ready. To gracefully shutdown the node, drain it with
kubectl drain node-name
# wait until it finishes
# the pods on this node will be evicted and re-deployed into other nodes
kubectl delete node node-name
Then I powered down the PI and replaced the MicroSD card with the one I just prepared, then I powered it back on. After a minute or 2, I was able to ssh
into the node with
# wipe the previous trusted server signature
ssh-keygen -R 192.168.1.82
# login, default password is ubuntu and will be changed upon first login
ssh [email protected]
# install ssh key, login with updated password
ssh-copy-id [email protected]
The node needs to be prepared for kubeadm, I used my good old ansible playbook for this task. The ansible-playbook command looks like
ansible-playbook -i inventory/cluster -l node-name kubeadm.yaml
At the moment I have to install less recent versions of docker and kubeadm to keep it compatible with the existing cluster.
When running kubeadm join
command I encountered an error message saying CGROUPS_MEMORY: missing
. This can be fixed with this. And one more thing is to create a new token from the master node with command:
kubeadm token create
At last the new node can be joined into the cluster with command:
kubeadm join 192.168.1.80:6443 --token xxx --discovery-token-ca-cert-hash sha256:xxx
The node will then be bootstrapped in a few minutes. I can tell it’s now ARM64
k get node node-name -o yaml |rg arch
beta.kubernetes.io/arch: arm64
kubernetes.io/arch: arm64
...
🙂