1. How to install MicroK8s on Ubuntu 24.04

Adarsh BhaskarAdarsh Bhaskar
2 min read

Kubernetes is the go-to solution for container orchestration, but setting up a full-fledged cluster can be complex. MicroK8s simplifies this by providing a lightweight, production-grade Kubernetes distribution. This guide walks you through installing MicroK8s on Ubuntu 24.04, focusing on practical implementation and the reasoning behind each step.

Why MicroK8s?

MicroK8s is ideal for development and testing because it:

  • Requires minimal setup and resources.

  • Runs as a single-node Kubernetes cluster.

  • Provides built-in add-ons for networking, storage, and more.

Installing MicroK8s on Ubuntu 24.04

You can also follow along this official documentation:

https://microk8s.io/docs/getting-started

Follow these steps to set up MicroK8s efficiently:

Step 1: Install MicroK8s

MicroK8s is available via Snap, making installation straightforward:

sudo snap install microk8s --classic

The --classic flag is necessary because MicroK8s needs system-wide access.

Step 2: Set Up kubectl Alias

By default, MicroK8s requires using microk8s.kubectl. To simplify, create an alias:

sudo snap alias microk8s.kubectl kubectl

This allows you to use kubectl directly instead of typing microk8s.kubectl each time.

Step 3: Verify Node Status

Check if MicroK8s is running and has successfully initialized:

kubectl get nodes

A Ready status indicates that your node is operational.

Step 4: Configure User Permissions

By default, MicroK8s runs under strict security constraints. Grant your user access with:

sudo usermod -a -G microk8s $USER

Additionally, configure the Kubernetes client for easier access:

mkdir -p ~/.kube
newgrp microk8s

Logging out and back in ensures the permission changes take effect.

Step 5: Enable Essential Add-ons

MicroK8s comes with add-ons that provide key Kubernetes features. Enable DNS and storage:

microk8s enable dns storage
  • dns: Required for internal service discovery.

  • storage: Provides a default storage class for persistent volumes.

Conclusion

With MicroK8s installed, you now have a lightweight Kubernetes cluster ready for development and testing. You can further explore add-ons like ingress for routing and metrics-server for monitoring. This setup allows you to deploy and manage containerized applications efficiently with minimal overhead.

0
Subscribe to my newsletter

Read articles from Adarsh Bhaskar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Adarsh Bhaskar
Adarsh Bhaskar

Hi there! I’m Adarsh, a passionate information science student with hands-on experience in machine learning, software development, and data analysis. I thrive on solving complex problems and enjoy collaborating with teams to bring innovative solutions to life. Whether it’s developing a recommendation engine or streamlining workflows with automation, I love diving into new technologies. I’m always eager to learn and explore fresh ideas, especially in the world of Flutter app development!