In this blog, we’re going to explore Kubernetes. However, there is a VERY FIRST question to be answered: what is the relationship between Kubernetes and Docker? Let’s start our journey of today:

# 1 Kubernetes

Kubernetes (commonly stylized as k8s) is an open-source container-orchestration system for automating application deployment, scaling, and management. (cited from Wikipedia)

On Raspberry Pi, a lightweight variant of Kubernetes is normally preferred. A variety of choices are available:

Minikube vs. kind vs. k3s - What should I use? elaborates the differences among Minikube, kind and k3s. Its final table is cited as follows:

minikube kind k3s
runtime VM container native
supported architectures AMD64 AMD64 AMD64, ARMv7, ARM64
supported container runtimes Docker, CRI-O, containerd, gVisor Docker Docker, containerd
startup time: initial/following 5:19 / 3:15 2:48 / 1:06 0:15 / 0:15
memory requirements 2GB 8GB (Windows, MacOS) 512 MB
requires root? no no yes (rootless is experimental)
multi-cluster support yes yes no (can be achieved using containers)
multi-node support no yes yes
project page minikube kind k3s

Here in my case, I’m going to use k3s to manage and monitor the cluster. The following 2 blogs are strongly recommended from me.

# 2. Preparation

Let’s take a look at the IP info of ALL 4 Raspberry Pis. Let’s take pi04 as the example this time. pi01, pi02, pi03 are having very similar IP info as pi04.

As mentioned in A Cluster of Raspberry Pis (1) - Configuration, pi04 is an old Raspberry Pi 3 Model B Rev 1.2 1GB, which is unfortunately with a broken Wifi interface wlan0. Therefore, I’ve got to insert a Wifi dongle in order to have Wifi wlan1 enabled.

# 3. k3s Installation and Configuration

## 3.1 k3s Installation on Master Node pi01

If we take a look at IP info, one additional flannel.1 interface is added as follows:

## 3.2 k3s Installation on Work Node pi01, pi02, pi03

Before moving forward, we need to write down node token on the master node, which will be used while the other work nodes join in the cluster.

, where X=2, or 3, or 4.

## 3.4 Access Raspberry Pi Cluster from PC

We can further configure our PC to be able to access the Raspberry Pi Cluster. For details, please refer to Run Kubernetes on a Raspberry Pi with k3s. On my laptop, I can do:

We can even specify the role name by the following command:

, where X=2, or 3, or 4.

Let’s take a look at all nodes again:

# 4. Create Deployment

After a while, nginx-sample will be successfully deployed.

Now, let’s expose this service and take a look from the browser: