To install Kubernetes on Ubuntu 26.04 or 24.04, use MicroK8s to create a single-node cluster. Kubernetes runs and manages applications packaged in containers.
This guide installs the cluster, checks a test workload and explains networking and removal. If you need help, leave a comment or contact us.
Canonical maintains MicroK8s as a simpler way to run Kubernetes on Ubuntu. This guide creates a single-node environment for learning and development. The kubeadm tool takes a more hands-on approach to assembling a cluster; use a dedicated kubeadm guide if that is what you need.
Install MicroK8s on Ubuntu
Networking, Swap and Security
MicroK8s supplies its own Pod networking. Pods communicate through this network; it is separate from the host network and must not overlap networks you need to reach. Check your VPN and local network before using an existing machine. This example does not expose a service to the internet.
Check swap with swapon --show. Canonical’s MicroK8s quick start does not instruct users to disable swap. Do not copy kubeadm swap or runtime configuration into this installation without checking the requirements for your chosen Kubernetes setup.
Treat the Kubernetes API and cluster credentials as administrative access. Restrict access to trusted users and networks; do not expose cluster ports publicly. The microk8s group grants powerful cluster access, so this guide uses sudo instead of adding users to that group.
If UFW or a cloud firewall is active, Pod traffic may need carefully scoped forwarding and interface rules. Do not disable the firewall or accept all forwarded traffic blindly on a shared host. Review Canonical troubleshooting and the ports reference for your network. Before changing remote firewall rules, confirm the actual SSH port is allowed, keep your session open and have a recovery console available.
Run and Remove a Test Workload
Enable Cluster DNS
DNS lets Pods find Kubernetes services by name. Enable it if your workloads need service discovery:
Wait for the CoreDNS Pod to become Running and Ready. Then run a lookup from a temporary Pod. Keep the same terminal open for all three commands; it stores the generated Pod name for cleanup. The image comes from the Kubernetes project registry.
A successful create prints a generated name such as pod/uf-dns-test-abcde. If no name appears or creation fails, stop; do not run the following commands until creation succeeds.
A successful lookup returns an address for the Kubernetes service. A failed lookup can indicate a CoreDNS, service or Pod networking problem. A timeout before the lookup can also mean the image could not be pulled. Check the Pod events and the troubleshooting section before changing firewall settings.
Remove only the generated Pod recorded in this terminal:
Troubleshoot MicroK8s
Cluster not ready: Check free space, memory, network access and the diagnostic report. The archive can contain sensitive configuration and logs; inspect it before sharing.
Pod stuck pending or pulling an image: Read the events for the named Pod, check capacity and verify access to the image registry. Replace the placeholder with the actual Pod name.
Pods cannot communicate: Check network overlap, forwarding and firewall rules. Use the Canonical troubleshooting and ports pages above before making changes. Changing a firewall over SSH can disconnect you.
Remove MicroK8s
Removing the snap stops the cluster and can remove workloads and cluster data. Back up anything you need first. Inspect persistent storage and any snap snapshots separately; this command does not promise to erase every host file or backup.
If you enabled firewall rules or created external resources separately, review them individually. Do not remove shared firewall rules or directories without checking what uses them.
Helpful Resources
Read the Canonical MicroK8s guide and the Kubernetes concepts documentation.
Frequently Asked Questions
Is MicroK8s Kubernetes?
Yes. MicroK8s is a Kubernetes distribution packaged by Canonical.
Do I need Docker for this guide?
No. MicroK8s includes its own containerd runtime.
Is this cluster highly available?
No. A single node is a useful lab but cannot keep running if that node fails.
Will the test application be public?
No public Service is created in the example. Other network and host configurations still need review.
Can I add more nodes later?
MicroK8s supports clustering, but node networking, firewall rules, storage and availability require additional planning.
Related guides: Install Docker on Ubuntu | Install Ubuntu Server.
