Why choose MicroK8s over traditional K8s or Minikube?
If you’ve ever struggled with kubeadm to install Kubernetes, you know the pain of managing dozens of TLS certificates and complex network configurations. For Lab or Dev needs on Ubuntu, we need a tool that is fast, lightweight, and doesn’t clutter the system. MicroK8s is the answer.
Many often choose Minikube out of habit. However, Canonical’s MicroK8s offers excellent integration with Ubuntu. Instead of running through a heavy Virtual Machine (VM) layer, MicroK8s runs directly on the host, saving about 1-2GB of RAM right at startup. I’ve tested this cluster on a cheap VPS with only 2 vCPUs and 4GB of RAM; the system remained incredibly responsive.
The power of MicroK8s lies in its “Zero-ops” philosophy. Every component from the Dashboard to Ingress comes pre-packaged. You can enable them with a single command instead of hunting for YAML files on GitHub.
Environment Preparation
You need an Ubuntu machine (best supported on versions 20.04 to 24.04). Regarding hardware, ensure the machine has at least 4GB of RAM. If you run below this, system Pods are likely to hit OOM (Out of Memory) states when you deploy additional applications.
Step 1: Install via Snap
MicroK8s is officially distributed via Snap, making updates and version management extremely simple:
sudo snap install microk8s --classic --channel=1.28/stable
This process usually takes less than 2 minutes depending on your internet speed.
Step 2: Configure Access Permissions
To avoid typing sudo for every command, add your user to the MicroK8s administrator group:
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
newgrp microk8s
The newgrp command applies the new permissions immediately without needing a system reboot.
Step 3: Verify Status
Check if the core services are ready to serve:
microk8s status --wait-ready
When the screen displays “microk8s is running”, your single-node K8s cluster is officially operational.
Enabling Add-ons: Turning MicroK8s into a Full-fledged K8s Cluster
By default, MicroK8s only installs the bare minimum to keep the system lightweight. For real-world work, you need to enable additional features.
Essential Add-ons
I always prioritize these 4 components for any Lab project:
- DNS: Allows internal services to communicate with each other via names instead of IPs.
- Storage: Provides persistent data storage capabilities (Persistent Volume).
- Ingress: A gateway to route external traffic to internal services.
- Dashboard: A visual web interface to monitor resources.
microk8s enable dns storage ingress dashboard
Pro Tip: Create an Alias for kubectl
Typing microk8s kubectl is time-consuming. Create an alias for a more professional workflow:
echo "alias kubectl='microk8s kubectl'" >> ~/.bashrc
source ~/.bashrc
Testing Nginx Deployment
To verify the system, we will run an Nginx web server and expose it externally via NodePort.
# Create deployment with 2 replicas
kubectl create deployment web-demo --image=nginx --replicas=2
# Expose container port 80 to a random port on the host machine
kubectl expose deployment web-demo --type=NodePort --port=80
Use the kubectl get services command to find the newly created port (usually in the 3xxxx range). Open your browser and go to localhost:3xxxx, and you will see the Nginx welcome page.
Hard-earned Lessons from Operation
After using MicroK8s on Ubuntu for a long time, I’ve gathered some important tips:
- Firewall Conflicts: This is the most common error. If Pods cannot connect to the Internet, check UFW. You need to allow traffic on the
cni0interface using the command:sudo ufw allow in on cni0 && sudo ufw allow out on cni0. - Storage Cleanup: Snap often keeps old versions, which consumes disk space. Run
snap set system refresh.retain=2to limit the number of stored versions and avoid disk-full issues after a few months. - Handling Freezes: If you use a laptop and frequently close the lid (Sleep), MicroK8s might lose internal network connectivity. The fastest fix is to restart the service:
microk8s stop && microk8s start.
Deploying Kubernetes doesn’t have to be a complicated process. With MicroK8s, you can focus entirely on containerizing your applications instead of wrestling with infrastructure. Good luck with your Lab setup!

