Quick setup of #microk8s on #raspberrypi4.

Lets setup one node cluster for development or playing around with Kubernetes on Raspberry Pi 4.

I have used Ubuntu 19.10 images for Raspberry Pi 4, which are available for download at: https://ubuntu.com/download/raspberry-pi. Assuming you have your rpi up and running, lets switch to installing Microk8s.

Step 1: Enable memory cgroup

# emacs /boot/firmware/nobtcmd.txt

And add:

cgroup_enable=memory cgroup_memory=1

After rebooting should see ‘1’ (enabled):

# grep mem /proc/cgroups | awk '{ print $4 }'

1

Step 2: Install microk8s

# snap install microk8s --classic --channel=1.17/edge

# usermod -aG microk8s ubuntu

# microk8s.enable dns dashboard storage

logout/login

Start microk8s and check status:

$ microk8s.start

$ microk8s.status

microk8s is running

addons:

cilium: disabled

dashboard: enabled

dns: enabled

fluentd: disabled

gpu: disabled

helm: disabled

ingress: disabled

istio: disabled

jaeger: disabled

juju: disabled

knative: disabled

kubeflow: disabled

linkerd: disabled

metallb: disabled

metrics-server: disabled

prometheus: disabled

rbac: disabled

registry: disabled

storage: enabled

Step 3: Login to dashboard (if you’re ssh’ed to rpi from your machine)

This is not recommended setup for dashboard, but for local test should be fine.

On your machine perform local port forwarding

$ ssh -L 8001:localhost:8001 ubuntu@rpi

On rpi setup proxy

$ microk8s.kubectl proxy --accept-hosts=.\* --address=0.0.0.0

From your machine open dashboard url: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#/login

Get login token from rpi

$ token=$(microk8s.kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)

$ microk8s.kubectl -n kube-system describe secret $token

That’s it, you could start developing your apps on Kubernetes, or just play around with Kubernetes itself. If you have more rpi’s — setup a cluster!

Microk8s docs available at: https://microk8s.io/docs/