Photo by CJ Dayrit on Unsplash

MicroK8s: Unleashing power of Kubernetes in a Snap

If you are a Kubernetes enthusiast but have not yet experimented with MicroK8s, then this post is for you.

MicroK8s is CNCF certified upstream Kubernetes deployment that can run on your laptop, workstation or on edge devices. It runs all the Kubernetes services natively and unlike Minikube, doesn’t require a separate virtual machine to run, thus making it a far more lighter alternative for offline development and/or prototyping.

Microk8s is available for Linux, Windows and MacOS. I will use Ubuntu 18.04 as reference in this post (well that, and the fact that Ubuntu is the only OS that I happen to carry in my laptop 😉 )

Install Microk8s in a jiffy

MicroK8s is a snap and can be installed using snapd. In fact snapd makes it very straightforward to install MicroK8s. Several Linux distros including Ubuntu, comes pre-installed with snapd and here’s how to install MicroK8s:

In case, you are interested in a specific upstream release, just select your preferred channel during installation

To learn about the available channels, use the following command:

During the snap installation process, a group named microk8s is created and users in that group get access to microk8s commands. Thus, a good way to get started would be to add your user to this group.

If you are not using Kubernetes all the time, do not forget to stick to a start/stop cycle

Unleash the power of Kubernetes

At this point, you should be able to use kubectl imperative and declarative commands that you have always known like the back of your hands.

Figure-1: Some sample imperative commands

A word for lazy typists

In case you are a lazy typist like myself, you can save a few key strokes by creating an alias for microk8s.kubectl (quite a mouthful, eh! 😄 )

You can easily place this command inside ~/.bashrc file in order to make the change permanent and then use it happily thereafter:

Conclusion

MicroK8s comes with a formidable arsenal of add-on services like dashboard, metrics-server, prometheus, fluentd, helm, istio, knative, kubeflow, etc. The list is quite long and deserves a lot of experiments on your part.

So what are you waiting for? Install MicroK8s and start working with your very own local Kubernetes.

Solutions architect by profession, programmer by passion and photographer by choice…