K3S Base Installation

Within in the last years buzzwords like container platforms and cloud computing with Amazon AWS got more and more hyped. Docker might propably the first framework which comes in mind when you are thinking about containers. And then there is Kubernetes (k8s) which might your first answer when you think about a platform which is able to run your containerized applications on a lot of servers. This Raspberry BOINC cluster project should be more than just a bunch of computers running the same application.

When looking around what others have done with Containers on Raspberry Pi computers you find a lot of running LAMP examples, where Linux, Apache, MySQL and PHP have been launched in an container environment and serving WordPress or Drupal applications. You will also find a lot of BOINC implementations on the Dockerhub.

If you google for Raspberry Pi and Kubernetes you will find K3S from Rancher Labs, which is a simplified and lightweight fully compliant Kubernetes distrubution. Exactly that what we need for a Raspberry Pi4 hardware plattform since they have ported or optimzed their code especially for ARM64 and ARMv7 CPUs.

I will give you just an overview of the needed installation steps here. For more details and a deeper understanding I suggest you to read the installation steps on rancher.com and / or the quick start guide.

There are just a couple of prerequisites before you can install K3S. For Raspberry Pi Computers you just have to switch the Raspian Buster OS from nftables to iptables.

sudo iptables -F
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
sudo reboot

You also need to update /boot/cmdline.txt in order to enable cgroups memory management on the kernel. Just append cgroup_memory=1 cgroup_enable=memory in that file.

console=serial0,115200 console=tty1 root=PARTUUID=a0d2829e-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

After that is done, reboot your Raspberry Pi servers and you can start the Installation of K3S on your master node with

curl -sfL https://get.k3s.io | sh -

The script will download the latest versions from rancher and install it on your Raspi master node.

When the installation run successful, you will find the node token of your K3S cluster in

sudo cat /var/lib/rancher/k3s/server/node-token

You need this node-token to install K3S on your Raspberry node servers with

url -sfL https://get.k3s.io | K3S_URL=https://<your_master_node>:6443 K3S_TOKEN=<your_node_token> sh -

That’s it basically. You now have installed K3S on all of your Raspberry PI Computers where the first one will act as a Master and orchestrating your containers on the kubernetes nodes:

pi@pik3s-m01:~ $ sudo kubectl get nodes --all-namespaces
NAME        STATUS   ROLES    AGE   VERSION
pik3s-n01   Ready    <none>   35m   v1.19.5+k3s2
pik3s-n02   Ready    <none>   35m   v1.19.5+k3s2
pik3s-n03   Ready    <none>   35m   v1.19.5+k3s2
pik3s-m01   Ready    master   55m   v1.19.5+k3s2

Thats it , you are done 😉

jan
jan

Hey, I am Jan. I am an IT Project and Technical Application Manager specialized on Output Management und CCM Solutions.

I have always been that hands on guy. Since it has not been possible in my business to get in touch with kubernetes I decided to do something on my own. Crunching with BOINC looks reasonable for me here.

I first registred for SETI@Home on 07. July in 1999. Happy crunching!

Artikel: 25

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre, wie deine Kommentardaten verarbeitet werden.