Installing MicroK8s on a Raspberry Pi

Note: Running Kubernetes can cause a lot of I/O requests and pressure on storage. It is not recommended to use a USB stick as primary storage when running MicroK8s.

Running MicroK8s on some ARM hardware may run into difficulties because cgroups
(required!) are not enabled by default. This can be remedied on the Rasberry Pi
by editing the boot parameters:

sudo vi /boot/firmware/cmdline.txt

Note: In some Raspberry Pi Linux distributions the boot parameters are in `/boot/firmware/nobtcmd.txt`.

And adding the following:

cgroup_enable=memory cgroup_memory=1

To address disk performance issues often present on Raspberry Pi see the troubleshooting section.

Kernel modules

For Ubuntu 21.10+ it is necessary to install extra kernel modules:

sudo apt install linux-modules-extra-raspi

Then restart MicroK8s:

sudo microk8s stop; sudo microk8s start


Installation is then via the snap as usual:

sudo snap install microk8s --classic --channel=1.25
1 Like

I followed the Raspi installation instructions and first problem is that in latest Rasbian 64 Lite
There is no /boot/firmware/cmdline.txt file, nor is there firmware folder.
there is /boot/cmdline.txt file which look about right.

Added the above instruction says does not help not does what was instructed on some article :
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1

microk8s version : MicroK8s v1.25.4 revision 4200
uname -a : Linux pi3-1 5.15.61-v8+ #1579 SMP PREEMPT Fri Aug 26 11:16:44 BST 2022 aarch64 GNU/Linux

root@pi3-1:~# microk8s inspect
Inspecting system
Inspecting Certificates
Inspecting services
Service snap.microk8s.daemon-cluster-agent is running
FAIL: Service snap.microk8s.daemon-containerd is not running
For more details look at: sudo journalctl -u snap.microk8s.daemon-containerd
Service snap.microk8s.daemon-kubelite is running
Service snap.microk8s.daemon-k8s-dqlite is running
Service snap.microk8s.daemon-apiserver-kicker is running
Copy service arguments to the final report tarball
Inspecting AppArmor configuration
Gathering system information
Copy processes list to the final report tarball
Copy disk usage information to the final report tarball
Copy memory usage information to the final report tarball
Copy server uptime to the final report tarball
Copy openSSL information to the final report tarball
Copy snap list to the final report tarball
Copy VM name (or none) to the final report tarball
Copy current linux distribution to the final report tarball
Copy network configuration to the final report tarball
Inspecting kubernetes cluster
Inspect kubernetes cluster
Inspecting dqlite
Inspect dqlite

WARNING: The memory cgroup is not enabled.


I am not familiar with cgroup but it seems it works… but microk8s does not work whit it

root@pi3-1:~# mount -t cgroup2 none /mnt/foo
root@pi3-1:~# ls /mnt/foo
cgroup.controllers cgroup.subtree_control dev-mqueue.mount proc-sys-fs-binfmt_misc.mount system.slice
cgroup.max.depth cgroup.threads init.scope sys-fs-fuse-connections.mount user.slice
cgroup.max.descendants cpuset.cpus.effective io.stat sys-kernel-config.mount
cgroup.procs cpuset.mems.effective kubepods sys-kernel-debug.mount
cgroup.stat cpu.stat memory.stat sys-kernel-tracing.mount

I am running Ubuntu Server 22.04 and I confirm that

sudo apt install linux-modules-extra-raspi

is still needed both for microk8s and even docker swarm.
I propose this instruction be expanded to 22.04 in the installation guide.

thanks for the report, I will make that more prominent in the docs

I have tried many time to install microk8s on rasp without success.
Then I decided to first install the extra-rasp modules and then to install microk8s and it worked!
So please, put that step before the installation of microk8s
Tested on rasp4 with Ubuntu 22.04

okay, i have re-worked this page now

1 Like