I’ve recently got a Raspberry Pi 4 Model B 8GB. I wanted to have one just to try running Kubernetes on Raspberry Pi. Most resources on the web seem to be for a huge cluster with a dozen nodes but I wanted to do it with a single node.
Operating system
As the operating system I chose Ubuntu because of its Pi support even though I prefer Red Hat based distros.
Upstream choice
I initially tried mikrok8s because it’s promoted on Ubuntu motd but had some issues with it. I don’t remember exactly but it might be because of storage. Also official Mikrok8s tutorial for installing on Raspberry Pi requires minimum 2 cluster nodes.
I ended up using minikube as it’s more for single node clusters. I wasn’t sure how good it would work on Raspberry Pi but I’ve been using it for 5 months.
Setup process
Install Ubuntu server for Raspberry Pi
Install Ubuntu server for Raspberry Pi by following the official guide: https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview
Note: You should install arm64 version of Ubuntu as steps below are also for arm64
Install docker
Follow the official Docker guide to install docker on ubuntu for arm64: https://docs.docker.com/engine/install/ubuntu/
Install minikube
Install the latest minikube binary using the following commands:
# Get the latest minikube binary for arm64 wget -O minikube_arm64.deb https://storage.googleapis.com/minikube/releases/latest/minikube_latest_arm64.deb sudo dpkg -i minikube_arm64.deb
Setup the cluster
On first time the cluster is started it will be set up. I used “none” driver with minikube which uses docker. You’ll also need to specify kubelet.resolv-conf on newer ubuntu versions for CoreDNS to work.
Setup/start the cluster using this command:
minikube start --driver=none --extra-config=kubelet.resolv-conf=/run/systemd/resolve/resolv.conf
For subsequent starts you don’t need to provide any arguments and you can just use the following:
minikube start
Enable minikube storage addons
To be able to have any kind of persistent storage you need to enable storage addons using minikube.
Use the following commands:
minikube addons enable storage-provisioner minikube addons enable default-storageclass
Last thoughts on running Kubernetes on Raspberry Pi
For Kubernetes experiments, Raspberry Pi is great as it is cheap to acquire and run. Considering its low clock speed it may not be the best choice for single-threaded applications even in a large cluster. As the space It uses is minimal it’s easy to store. For development it’s not as easy to work with since most tools work with local clusters.
Another thing to mention I discovered a lack of container images for arm architecture. I imagine it’ll get better because of Apple’s arm based M series chips.
I’ll keep running minikube on my Raspberry Pi and do more Kubernetes experiments on it.
Links
- Ubuntu for Raspberry Pi
- Raspberry Pi 4 8GB – Amazon
- Raspberry Pi 4 Model B official case black – Amazon
- Raspberry Pi 4 Model B official case red/white – Amazon
- Kubernetes: Up and Running – 2nd Edition – Amazon
You can use https://storage.googleapis.com/minikube/releases/latest/minikube_latest_arm64.deb to get the latest version
thanks Anders. I’ve just updated the post to use that instead