Installing MicroK8s on a Raspberry Pi
Note: Running Kubernetes generates significant I/O pressure on storage. Using a USB stick or low-end SD card as primary storage is not recommended when running MicroK8s. To diagnose slow disk performance on Raspberry Pi, see the troubleshooting section.
Verify and enable memory cgroups
MicroK8s requires memory cgroups. On recent Ubuntu releases for Raspberry Pi (Ubuntu 24.04 LTS and newer), memory cgroups are usually enabled by default, whereas on Raspberry Pi OS and older Ubuntu releases they are disabled by default.
You can check if memory cgroups are already active by running:
grep memory /sys/fs/cgroup/cgroup.controllers
Note: The command above applies to systems using cgroup v2. On distributions that use cgroup v1 or a hybrid hierarchy, check for the `/sys/fs/cgroup/memory` directory instead.
If memory is not listed in the output, enable it by editing your kernel command line file:
- Raspberry Pi OS (Bookworm and later) / Ubuntu 24.04 LTS and earlier:
sudo vi /boot/firmware/cmdline.txt - Raspberry Pi OS (Bullseye and earlier):
sudo vi /boot/cmdline.txt - Ubuntu 25.10 and 26.04 LTS+ (A/B boot layout):
sudo vi /boot/firmware/current/cmdline.txt
Note: In some older Raspberry Pi and Ubuntu distributions, the boot parameters are in `/boot/firmware/nobtcmd.txt`.
Append the following parameter to the end of the existing line:
cgroup_enable=memory
Kernel modules (Ubuntu 22.04 LTS and earlier only)
On Ubuntu 24.04 LTS and newer, the required kernel modules are included by default in linux-raspi. For Ubuntu versions before 24.04, install the extra kernel modules package:
sudo apt install linux-modules-extra-raspi
Modifying the cmdline.txt or updating kernel modules requires a reboot to take effect. Reboot the Raspberry Pi to apply the changes:
sudo reboot
Install MicroK8s
Install the MicroK8s snap:
sudo snap install microk8s --classic --channel=1.36/stable