Kubernetes Cluster with Raspberry Pis Print

UPDATED as of May 22, 2019


This is the first post in our Pi-IoT post series.


Credit where Credit is Due

I owe a big thanks to the fine folks over at Hypriot for all their work in this area. Their initial post on this subject was a good starting point but has become stale and incorrect due to some critical updates with docker and kubernetes.

Flash HypriotOS on your SD cards

You can find the latest release at HypriotOS. They also provide a pretty handy flash tool which you can use like:

The --hostname enterprise is the name given to the Pi.

Using the Onboard WiFi

In order to use the onboard wifi, you will need to use the --userdata option and supply a user-data.yml file.  This will look something like:

Note that the --hostname option used earlier overrides the hostname set in the user-data.yml file above.  

After flashing the OS to the SD cards, install them in your Pi’s, boot them up and log in via SSH

with a default password of hypriot

Install Kubernetes

To install kubernetes, we will add the official APT kubernetes repository on each node. This will require root privileges. Using sudo you can set your user to root like


then just install kubeadm on every node

Initialize Kubernetes on the master node

  • --pod-network-cidr – This option is needed because we are using flannel to provide virtual subnets for kubernetes. We use the provided subnet because the flannel configuration file that we use predefines the equivalent subnet.
  • If you are using the WIFI network instead of ethernet, you need to add --apiserver-advertise-address where is changed to the actual IP address on your network of the master Pi. You can find this by running:

After Kubernetes has been initialized, the last lines of your terminal should look like this:


On the master node, exit su and by running the commands below you can now start using your cluster as a regular user:

On each other node, execute the kubeadm join command given in the output to join the cluster. (Note: master node’s hostname can be used instead of IP). It will look something like:

After some seconds, you should see all nodes in your cluster when executing the following on the master node:

Your terminal should look like this:


Setup flannel as the Pod network driver

Run this on the master node:

Wait until all flannel and all other cluster-internal Pods are Running before you continue.

Check the status by:


Now we have a working kubernetes cluster running on our raspberry pis.

Next post, let’s test our cluster with a simple deployment