Installing k3s on Raspberry Pi 4

I was looking to have a cluster for learning more Kubernetes but minikube was just not cutting it and full fledged k8s was too heavy for a Pi setup.
Enter k3s. Its a much lighter version of k8s without compromising on the API features. Its very ideal for bringing up a cluster quickly on devices starved of resources.
It comes as a single binary and uses SQLite as a database instead of etcd.
I was able to get the control plane up in less than a minute. Its using Docker for container runtime. I’ve disabled Traefik ingress controller as well.

root@pi-four1:~/k3s# curl -SsL https://get.k3s.io/ > install.sh
root@pi-four1:~/k3s# export INSTALL_K3S_EXEC=” — disable=traefik — docker”
root@pi-four1:~/k3s# bash install.sh
.
.
[INFO] systemd: Starting k3s

root@pi-four1:~/k3s# k get no
NAME STATUS ROLES AGE VERSION
pi-four1 Ready control-plane,master 107s v1.20.5+k3s1

K3s comes with local path provisioner storage class for persistent storage.

root@pi-four1:~/k3s# k get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 8m32s

By default, this was mapped to somewhere in /var/lib. I have a USB drive and this will be used for persistent storage. Modified the local path provisioner configmap with the correct mount path.

root@pi-four1:~/k3s# lsblk | grep usb
└─sda1 8:1 0 232.9G 0 part /mnt-usb

root@pi-four1:~/k3s# k edit cm local-path-config -nkube-system
configmap/local-path-config edited

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adithya

Adithya

I work with cloud, containers, linux