First of all, I’m going to use k3s which is the lightweight version k8s.

Prerequisite

To run k3s, memory and CPUset cgroup need to be enabled. In my case, because I’m using Ubuntu, I have to add following to /boot/firmware/nobtcmd.txt, for Raspbian, use /boot/cmdline.txt.

1
cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

Note:

  • Append to the same line instead of adding a new line
  • Do this to every Pi

Then, reboot.

Install k3s using k3sup

On your laptop, install k3sup and then use it to install k3s.

1
k3sup install --ip <RPi-Server-IP> --user <RPi-user>

Note:

  • the <RPi-user> needs to be able to sudo without having to type password. Follow this guide to config.
  • k3sup uses ssh-key to remote login, if you don’t have key generated yet, follow this guide.

Join other Pi (nodes) to the cluster

This can be easily done with k3sup

1
k3sup join --ip <RPi-IP> --server-ip <RPi-Server-IP> --user <RPi-user>

Do this to every Pi you’d like to add to the cluster.

That’s it.

Upgrade Kubernetes master and nodes

Very simple, just rerun the install and join command with the same arguments/flags.