The following section describes the installation steps as depicted in the Canonical Documentation. [1]
If it wasnt installed during the Ubuntu installation steps, you can install microk8s now with:
sudo snap install microk8s --classic
Add your current user to the microk8s group, this will allow microk8s kubectl commands to be done without sudo:
sudo usermod -aG microk8s $USER
sudo chown -R $USER ~/.kube 2>/dev/null; true
newgrp microk8s
Check if microk8s is ready:
microk8s status --wait-ready
Enable the essential addons.
DNS for resolving names
Storage for dealing with storage on the host system
Ingress for routing traffic to the correct pod
Registry for allowing access to registries, we setup a local docker registry earlier.
host-access to allow access through the host of the vm.
microk8s enable dns storage ingress registry host-access
Setup microk8s to trust the insecure docker registry:
sudo mkdir -p /var/snap/microk8s/current/args/certs.d/<YOUR_VM_IP>:5000
sudo tee /var/snap/microk8s/current/args/certs.d/<YOUR_VM_IP>:5000/hosts.toml <<EOF
server = "http://<YOUR_VM_IP>:5000"
[host."http://<YOUR_VM_IP>:5000"]
capabilities = ["pull", "resolve"]
skip_verify = true
EOF
microk8s stop && microk8s start
Replace YOUR_VM_IP with the ip your virtual machine is running on. Mine was 192.168.234.128.
(Optional: setup kubectl alias to reduce typing and most online resource will reference kubectl instead of microk8s kubectl.
echo "alias kubectl='microk8s kubectl'" >> ~/.bashrc
source ~/.bashrc
References
[1] Canonical Ltd., "MicroK8s documentation - home," Canonical. https://canonical.com/microk8s/docs (accessed Mar. 24, 2026).