Schedule a FREE onboarding and start making pipelines fast.

Local Kubernetes for Linux – MiniKube vs MicroK8s

Kubernetes Tutorial | November 1, 2018

In the previous article of this series, we described two solutions for local Kubernetes development on Windows

In this article, we will focus on Linux. Minikube is still a contender here. Unfortunately, Docker desktop is not available for Linux. Instead we are going to look at MicroK8s, a Linux only solution for a lightweight local Kubernetes cluster.

We are evaluating these solutions and providing a short comparison based on ease of installation, deployment, and management.

Minikube

Minikube runs a single-node Kubernetes cluster inside a VM (e.g. Virtualbox ) in your local development environment. The result is a local Kubernetes endpoint that you can use with the kubectl client. Minikube supports most typical Kubernetes features such as DNS, Dashboards, CNI, NodePorts, Config Maps, etc. . It also supports multiple hypervisors, such as Virtualbox, kvm, etc.

Installation

In order to install Minikube to Linux, you can follow the steps described in the official documentation. In our evaluation we used Ubuntu 18.04 LTS with VirtualBox support using the following commands:

After installation of Minikube, the kubectl tool needs to be installed in order to deploy and manage applications on Kubernetes. You can install kubectl by adding a new APT repository using the following command:

Finally, after successful installation, you can start your minikube by issuing the command:

Management and Deployment

Managing a Minukube cluster on Linux is exactly the same as managing it on Windows. (See the previous article on Windows for an Nginx deployment example).

Microk8s

Microk8s is a new solution for running a lightweight Kubernetes local cluster. It was developed by the Kubernetes team at Canonical. It is designed to be a fast and lightweight upstream Kubernetes installation isolated from your local environment. This isolation is achieved by packaging all the binaries for Kubernetes, Docker.io, iptables, and CNI in a single snap package (available only in Ubuntu and compatible distributions).

By installing Microk8s using snap, you are able to create a “clean” deploy of the latest upstream Kubernetes on your local machine without any other overhead. The Snap tool is taking care of all needed operations and can upgrade all associated binaries to their latest versions. By default, Microk8s installs and runs the following services:

  • Api-server
  • Controller-manager
  • scheduler
  • kubelet
  • cni

Additional services such as the Kubernetes dashboard can be easily enabled/disabled using the microk8s.enable and microk8s.disable command. The list of available services are:

  1. Dns
  2. Dashboard, including grafana and influxdb
  3. Storage
  4. Ingress, Istio
  5. Registry
  6. Metrics Server

Installation

Microk8s can be installed as a single snap command, directly from the Snap store.

This will install the microk8s command and an api-server, controller-manager, scheduler, etcd, kubelet, cni, kube-proxy, and Docker. To avoid any conflicts with existing installation of Kubernetes, Microk8s adds a microk8s.kubectl command, configured to exclusively access the new Microk8s install. When following any generic Kubernetes instructions online, make sure to prefix kubectl with Microk8s. To verify that installation was successful, you can use the following commands to retrieve available nodes and available services respectively:

Management

As mentioned above, Microk8s installs a barebones upstream Kubernetes. This means just the api-server, controller-manager, scheduler, kubelet, cni, and kube-proxy are installed and run. Additional services such as kube-dns and the dashboard can be run using the microk8s.enable command.

You can verify that all services are up and running with the following command:

You can access any service by pointing the correct CLUSTER_IP to your browser. For example, you can access the dashboard by using the following web address, https://10.152.183.77. See image below for the dashboard:

Kubernetes dashboard

At any time, you can pause and restart all Kubernetes services and installed containers without losing any of your configurations by issuing the following command. (Note that this will also disable all commands prefixed with Microk8s.)

Removing Microk8s is very easy. You can do so by first disabling all Kubernetes services and then using the snap command to remove the complete installation and configuration files.

Deployment

Deploying a nginx service is what you would expect, with the addition of the Microk8s prefix:

You can monitor your deployed services using the command:

Now you are ready to access your deployed web service by pointing the following web url to your preferred web browser: http://10.152.183.125

Conclusions

After looking at all solutions, here are our results…

Minikube is a mature solution available for all major operating systems. Its main advantage is that it provides a unified way of working with a local Kubernetes cluster regardless of operating system. It is perfect for people that are using multiple OS machines and have some basic familiarity with Kubernetes and Docker.

Pros:

  1. Mature solution
  2. Works on Windows (any version and edition), Mac and Linux
  3. Multiple drivers that can match any environment
  4. Can work with or without an intermediate VM on Linux (vmdriver=none)
  5. Installs several plugins (such as dashboard) by default
  6. Very flexible on installation requirements and upgrades

Cons:

  1. Installation and removal not as streamlined as other solutions
  2. Can conflict with local installation of other tools (such as Virtualbox)

MicroK8s is a very interesting solution as it runs directly on your machine with no other VM in between.

Pros:

  1. Very easy to install, upgrade, remove
  2. Completely isolated from other tools in your machine
  3. Does not need a VM, all services run locally

Cons:

  1. Only for Ubuntu/Snap
  2. Relatively new, possible unstable
  3. Minikube can also run directly on Linux (vm=driver none), so MicroK8s value proposition is diminished

Let us know in the comments which local Kubernetes solution you are using and why.

Thomas Pliakas

About Thomas Pliakas

Thomas Pliakas is a passionate Java software engineer, where he likes to work in performance improvements in each phase of the project life cycle. He has primarily been working on architecting, developing, and tuning low latency and high throughput telco products. He is also a co-organizer of Java Hellenic User Groups (jhug) meetups.

Reader Interactions

Enjoy this article? Don't forget to share.

Comments

  1. Thank you for the comparison and let me say upfront that I am biased in favor of microk8s.

    I’d like to mention some microk8s strong point that might have been overlooked.
    – There is also “microk8s.enable gpu” that enables you to run GPGPU workloads. We make sure that (given NVidia hardware and drivers on the host) the right nvidia docker runtime and the corresponding daemonset is loaded correctly.
    – Microk8s is going through the CNCF conformance certification. That might be of interest to the end user.
    – We have microk8s deployments on distributions other than Ubuntu for example OpenSuse, Fedora, CentOS, Arch, and of course Debian. Granted the majority of users are on Ubuntu but microk8s should run on any linux distro snaps do (https://docs.snapcraft.io/installing-snapd/6735).

    Minor issue: “You can access any service by pointing the correct to your browser.” does not read right.

    Thank you for considering using microk8s. Cheers!

    • Thank you for your feedback. We have also fixed the grammar issue.

Comments

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

Follow me on Twitter