Installing K3S on Raspberry Pi 4

K3S Nov 06, 2019

Getting Started

K3S is a highly available, certified Kubernetes distribution designed for production workloads in unattended, resource-constrained, remote locations or inside IoT appliances.

Both ARM64 and ARMv7 are supported by K3S and the minimum system requirements are :

  • Linux 3.10+
  • 512 MB of ram per server
  • 75 MB of ram per node
  • 200 MB of disk space
  • x86_64, ARMv7, ARM64

Installing K3S

Enable container features

Edit /boot/cmdline.txt by running the following content

sudo nano /boot/cmdline.txt

And paste the following to the end of the line

 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory

Then reboot the device:

sudo reboot

Install K3S :

curl -sfL | sh -

Example output:

[INFO]  Finding latest release
[INFO]  Using v1.0.0 as release
[INFO]  Downloading hash
[INFO]  Downloading binary
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/
[INFO]  Creating uninstall script /usr/local/bin/
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/ → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s

Check that the systemd service started correctly:

sudo systemctl status k3s
● k3s.service - Lightweight Kubernetes
   Loaded: loaded (/etc/systemd/system/k3s.service; enabled; vendor preset: e
   Active: active (running) since Thu 2019-11-28 21:09:44 GMT; 1min 32s ago
  Process: 841 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=
  Process: 843 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUC
 Main PID: 845 (k3s-server)
    Tasks: 80
   Memory: 651.3M
   CGroup: /system.slice/k3s.service
           ├─ 845 /usr/local/bin/k3s server
           ├─ 887 containerd -c /var/lib/rancher/k3s/agent/etc/containerd/con
           ├─1270 /var/lib/rancher/k3s/data/93417efda3f1bfb0977d22d68559e0ccc
           ├─1296 /var/lib/rancher/k3s/data/93417efda3f1bfb0977d22d68559e0ccc
           ├─1313 /var/lib/rancher/k3s/data/93417efda3f1bfb0977d22d68559e0ccc
           ├─1349 /var/lib/rancher/k3s/data/93417efda3f1bfb0977d22d68559e0ccc
           ├─1357 /pause
           ├─1386 /pause
           ├─1394 /pause
           ├─1402 /pause
           ├─1626 /coredns -conf /etc/coredns/Corefile
           ├─1650 local-path-provisioner start --config /etc/config/config.js
           ├─1757 /metrics-server
           ├─1812 /bin/bash /usr/bin/entry install --name traefik https://%{K
           ├─1845 tiller --listen= --storage=secret
           └─1930 helm repo update

List nodes by running the following command:

sudo kubectl get nodes


raspberrypi   Ready    master   6m5s   v1.16.3-k3s.2

List deployments by running the following command:

kubectl get deployments --all-namespaces


kube-system   local-path-provisioner   1/1     1            1           8m20s
kube-system   metrics-server           1/1     1            1           8m19s
kube-system   coredns                  1/1     1            1           8m20s
kube-system   traefik                  1/1     1            1           6m37s

List pods from all namespaces:

NAMESPACE     NAME                                      READY   STATUS      RESTARTS   AGE
kube-system   local-path-provisioner-58fb86bdfd-b8rkr   1/1     Running     0          9m44s
kube-system   metrics-server-6d684c7b5-pq6bf            1/1     Running     0          9m44s
kube-system   coredns-d798c9dd-k7d54                    1/1     Running     0          9m43s
kube-system   helm-install-traefik-vbbb7                0/1     Completed   0          9m44s
kube-system   svclb-traefik-t7cfl                       3/3     Running     0          8m13s
kube-system   traefik-65bccdc4bd-htrjk                  1/1     Running     0          8m14s

List services from all namespaces:

sudo kubectl get service --all-namespaces


NAMESPACE     NAME             TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                                     AGE
default       kubernetes       ClusterIP      <none>         443/TCP                                     48m
kube-system   kube-dns         ClusterIP     <none>         53/UDP,53/TCP,9153/TCP                      47m
kube-system   metrics-server   ClusterIP   <none>         443/TCP                                     47m
kube-system   traefik          LoadBalancer   ip   80:30815/TCP,443:30839/TCP,8080:32211/TCP   46m

Get the join key:

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



Uninstall K3S

Run the following command to uninstall K3S:

sudo /usr/local/bin/