Microk8s is a production-grade, easy-to-use Kubernetes distribution from the Ubuntu maker Canonical that provides quick time to value for development and production use cases. Microk8s aims to alleviate many of the challenges of working with Kubernetes clusters.

What is Microk8s?

According to Canonical, the major public cloud providers use Ubuntu as the foundation for all public cloud Kubernetes distributions, including GKE, EKS, and AKS.

Canonical has made Microk8s small, efficient, and lightweight as a production-grade Kubernetes distribution that can be used for development workstations, Edge, and IoT. It also supports different CPU architectures, including ARM and Intel.

Using Microk8s, building Kubernetes clusters is straightforward, as it automatically configures high availability when you join three or more nodes. However, it is also supported in a one-node configuration for simplicity and development.

Microk8s features and capabilities

The Microk8s Kubernetes distribution provides organizations many capabilities and features, including the following:

  • Zero-ops—Canonical has developed Microk8s to eliminate the complexity of running Kubernetes. You can build a Microk8s cluster in under a minute and enable popular applications, including Prometheus, Grafana, MetalLB, Traefik, and others, quickly.
  • Minimal footprint—Microk8s is extremely small and lightweight and can be installed in less than a minute.
  • Self-healing—It provides self-healing high availability, allowing the cluster to remain operational despite failures.
  • Automatic HA—Joining three or more Microk8s nodes automatically creates a highly available Kubernetes cluster. In Microk8s, every node is a worker node, and every node is an API service node running Dqlite as its datastore.
  • OTA updates—Your Microk8s cluster nodes receive over-the-air updates for a streamlined DevOps experience.
  • Security fixes—Canonical uses high-quality packages and distribution channels with no license fees and offers paid enterprise support.

Installing Microk8s

To set the stage for the installation environment, I configured three Ubuntu 22.04 LTS servers with the latest updates.

Checking the Ubuntu release version

Checking the Ubuntu release version

Installing Microk8s on Ubuntu Server is extremely easy using the snap installer. The command for installing Microk8s is as follows:

snap install microk8s --classic
Installing Microk8s using snap

Installing Microk8s using snap

Since we want to be able to run kubectl commands to interact with the Microk8s cluster quickly, we can create an alias for typing the longhand microk8s kubectl, making it much easier to issue the kubectl command. To create an alias, we can use the following command:

alias mkctl="microk8s kubectl"

If you want to add additional nodes to your single-node microk8s cluster, you can issue the following command:

microk8s add-node

It will print the command, which you can copy to one of your additional nodes to join it to the microk8s cluster. You will need to run the command for each new node you want to join, as the identifier in the join command will need to be unique for each new node.

Creating a kubectl alias and creating the join cluster command

Creating a kubectl alias and creating the join cluster command

From another microk8s host, you will paste the command generated from the first master node above.

Joining the microk8s cluster from another node using the join command

Joining the microk8s cluster from another node using the join command

After joining the remaining nodes in your microk8s cluster, you can issue the new alias command, mkctl, to list the nodes in the new microk8s cluster.

Viewing the nodes in your Microk8s cluster

Viewing the nodes in your Microk8s cluster

Microk8s has many commands that you can use to easily administer the cluster and get the status and health of the cluster in general. One of these is the following command:

microk8s status

The microk8s status command displays the status of the Microk8s cluster (if it is operating in high availability mode), the member nodes, and the addons enabled for the cluster.

Viewing the status of the microk8s cluster and addons

Viewing the status of the microk8s cluster and addons

With the simple microk8s enable command, you can easily enable any of the listed addons, including dashboard, ingress, metallb, Prometheus, and others. Compared to other Kubernetes distributions, where these must be manually installed, Microk8s makes it extremely easy to enable many different third-party solutions. In addition to the list below, there are community addons you can enable from the community repository.

To enable a specific addon, you can run the command:

Subscribe to 4sysops newsletter!

microk8s enable <addon name>

Wrapping up

If you are looking for a simple, easy-to-use, production-grade Kubernetes distribution, Microk8s is excellent for development and production use cases. In addition, Microk8s provides one of the easiest ways to enable a high-availability Kubernetes cluster in less than a minute. Enabling popular addons is also easy using the built-in microk8s enable command without the need to pull using helm or install using manifest files. Since the Microk8s distribution is backed by Canonical, it also has great support, community resources, and security updates to keep the distribution patched against the latest vulnerabilities.


Leave a reply

Your email address will not be published. Required fields are marked *


© 4sysops 2006 - 2023


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account