We have tried out Kubernetes on Raspberry Pi computers. This makes for a fun summer project and is a great and cheap way to get started with Kubernetes. However, there are a few problems that may arise, so read on to learn how to solve them!
An important part of democratizing a technology is to make it available for everyone to use. Open sourcing software is a great way to do this, but it is not always enough. Some software requires specific hardware to run, or is so performance sensitive that nothing short of a supercomputer will do. Luckily, Kubernetes is doing great in this regard: not only is it open source, it is also possible to use with cheap hardware, for instance in the form of Raspberry Pi, to set up a complete cluster.
What is needed?
For someone with a hacking hobby, this list is probably already fulfilled.
- At least one Raspberry Pi 3 B or B+. Two or more is preferable since this allows one of them to be used exclusively for the control plane.
- Power supply and cables.
- SD cards for all Raspberry Pi’s.
- LAN cables and a router with available ports, or WiFi.
- (Optional) Cases for the Raspberry Pi’s, preferably stackable ones.
Setting up the Raspberry Pi Nodes
There are a few choices to be made here. Primarily, what Linux distribution to use and how to install Kubernetes. Some distribution alternatives include the officially supported Raspbian and Hypriot, while Kubernetes can be installed from distribution repositories or the official Kubernetes repositories. I picked my favorite Linux distribution, Fedora, which has great support for the arm architecture and Raspberry Pi 3. Additionally, Fedora has a nice arm installer which makes it easy to set up the SD cards correctly. Both the packages from the official Kubernetes repository and Fedora repositories work great.
When the SD cards are set up, you should boot the machines and go through the initial setup. Set a unique hostname for each machine (e.g. master, worker1 and worker2) and static IPs. Furthermore, add entries in
/etc/hosts so that they can resolve each other, e.g:
You are now ready to follow the kubeadm guide for how to set up a Kubernetes cluster. However, make sure to read about the problems encountered here below to avoid unnecessary troubles.
Problems Encountered and Their Solution
There is problem with newer versions of Kubernetes (actually etcd), as documented here. So it is probably a good idea to stick to an older 1.9.x version for now. Another issue that appears every now and then is this one regarding image pull back off. A workaround for this is to increase the pull progress deadline by setting the
--image-pull-progress-deadline flag for the kubelet. See this for more information on the available options. Also, check the kubelet service file to find out where to add the flag:
systemctl cat kubelet.
Kubernetes is a fantastic piece of technology. It enables orchestration of containers on everything from planet scale public clouds, to your local basement Raspberry Pi cluster. Additionally, Kubernetes is open source, free to use and relatively easy to set up. Let us know if you are running Kubernetes on Raspberry Pi’s or other cheap single board computers! What kind of applications do you run, or would you like to run on a Raspberry Pi cluster? Did you come across any additional problems? We are eager to hear from you if there is anything you would like us to try!