Kubernetes / Contributed

Get the Smallest, Fastest, Fully-Conformant Kubernetes in Just 3 Steps

19 Dec 2019 11:12am, by

Karthikeyan Shanmugam
Karthikeyan Shanmugam (Karthik) is an experienced Solutions Architect professional with about 17+ years of experience in design & development of applications across Banking, Financial Services and Aviation domains. Currently involved in Technical consulting & providing solutions in the Application Transformation space which includes modernization of legacy applications, managing transformation exercises and providing solution architecture for transformation.

Kubernetes, as we know, coordinates a highly available cluster of computers that are connected to work as a single unit. Kubernetes contains a number of abstractions that allow the deployment of containerized applications to the cluster without attaching them to individual machines.

In short, Kubernetes is:

  • Portable: public, private, hybrid, multicloud
  • Extensible: modular, pluggable, hook able, composable
  • Self-healing: auto-placement, auto-restart, auto-replication, auto-scaling

In this article, we are going to take look at Lightweight Kubernetes engine MicroK8s that can run on edge, IoT and appliances.MicroK8s is great for offline development, prototyping, and testing purpose. You can also use it on a VM as a small, cheap, reliable k8s for CI/CD.

In the next section, we will look at how to install and deploy sample application on to MicroK8s cluster.

Step 1. Install MicroK8s

In the below steps, we would be installing MicroK8s cluster, it would install a limited set of components like api-server, controller-manager, scheduler, kubelet, cni, kube-proxy. Additional services like kube-dns and dashboard can also be run using the microk8s.enable command.


  • You should have either Ubuntu 18.04 LTS or 16.04 LTS environment
  • 20G of disk space and 4G of memory are recommended

MicroK8s is deployed via Snaps. Snaps are containerized (like docker) software packages that are easy to create and install, they bundle their dependencies, they work on all major Linux systems without modification. Snaps auto-update and are safe to run. Also, note MicroK8s snap would be frequently updated to match each release of Kubernetes.

MicroK8s snap can be installed using the command below:

Figure 1: Install Microk8s

To avoid colliding with a kubectl already installed and to avoid overwriting any existing Kubernetes configuration file, MicroK8s adds a microk8s.kubectl command. If you are only using MicroK8s, consider adding an alias using the following command:

Figure 2: Adding an alias to Microk8s.kubectl

Step 2. Verify Installation

At this point you have installed MicroK8s, check whether the newly deployed node is in Ready state using the following command

Figure 3: Verify Microk8s Installation

If you receive an error, it means that microk8s is still starting the nodes in the background. Wait for few minutes and try again.

You can also use kubectl describe command to get the details of the node.

Figure 4: Use Kubectl to describe node

Step 3. Deploy Sample Application

At this point, you have a fully functional Kubernetes cluster. Following command will deploy nginx web application.

Figure 5: Deploy nginx application

Once nginx has been deployed, the application can be exposed with the following command.

Figure 6: Expose nginx application

You should see a new Service and ClusterIP address assigned.

Figure 7: New Service and ClusterIP address are assigned.

Now that services are exposed outside, we can launch lynx, a terminal-based web browser, to access the Nginx application using the following command.

Figure 8: Nginx app deployed on Microk8s cluster

Congrats! now you have a deployed Nginx application to a fully functional Kubernetes cluster using Microk8s.

Step 4. Deploy Add-ons (Optional)

Additional services like kube-dns and dashboard can be enabled using the microk8s.enable command.

Figure 9: Install Add-ons

Check to see if all the components for the additional services being started using the following command:

Figure 10: Check the status of additional services

MicroK8s gives you troubleshooting tools to check out what has gone wrong. Be sure to check out the common issues section for help in resolving the frequently encountered problems.

Useful Resources:

Featured image via Pixabay.

The New Stack is a wholly owned subsidiary of Insight Partners. TNS owner Insight Partners is an investor in the following companies: Docker.

A newsletter digest of the week’s most important stories & analyses.