Create your FREE Codefresh account and start making pipelines fast. Create Account

Local Kubernetes for Linux – MiniKube vs MicroK8s

5 min read

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

Update: the third part of the series for Mac is also available.

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 available for Snap supported Linux Distributions
  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.

14 responses to “Local Kubernetes for Linux – MiniKube vs MicroK8s

  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!

    1. It seems most of the other strong points of microk8s are also available for minibuke:

      – There is also “microk8s.enable gpu”:

      minikube has a set of built-in addons that can be enabled, including nvidia-driver-installer and nvidia-gpu-device-plugin.

      – Microk8s is going through the CNCF conformance certification:

      minikube is already Cloud Native Computing Foundation (CNCF) / Platform • Certified Kubernetes – Installer

      – We have microk8s deployments on distributions other than Ubuntu:

      I haven’t tried microk8s using snaps, but other snap apps are much slower in Arch using snaps than a native version or either flatpak that is a, IMO, a better snap alternative.

    1. Hello. Thank you for your feedback. We have updated the wording. I have checked that list and I see important omissions such as Gentoo, Slackware, NixOS etc. So “almost any linux version” doesn’t seem to be all linux versions (please correct me if I am wrong)

  2. Minikube can also run directly on Linux (vm=driver none), so MicroK8s value proposition is diminished

    I don’t think vm-driver=none for Minikube diminishes the value proposition of MicroK8s based upon reading the Minikube docs:
    https://github.com/kubernetes/minikube/blob/master/docs/vmdriver-none.md#should-vm-drivernone-be-used-on-a-personal-development-machine-no

    MicroK8s has other cons such as Kubernetes contexts not working & host SELinux being problematic, as mentioned here – https://github.com/kubernetes/minikube/issues/2575#issuecomment-441366279

  3. FYI, there is a tiny tiny typo on this page under the “Installation” Paragraph the code snippet reads
    “micro8ks.kubectl get services”, should be “microk8s.kubectl get services”

  4. For Windows and Mac users there is now multipass which gives you a fast clean Ubuntu VM on demand, and I found that let me play with microk8s on my Windows laptop. Very easy to install and get going with Kubernetes. Thanks for the helpful article!

  5. When trying to access the dashboard, a dialog appears in the browser asking for authentication using either a kubeconfig file or a bearer token so it appears that you have left this step out….

    1. Hello Paul,

      In order to get k8s-dashboard token follow next steps:

      1) kubectl -n kube-system get secret
      2) then find in result secret starts with “kubernetes-dashboard-token” and run following command – kubectl -n kube-system describe secrets kubernetes-dashboard-token-xxxx where xxxx stands for digits and letters from the results list.

      Best regards,
      Denis

  6. I’m a fan of microk8s as well, we have used it in conjunction with the Uber Mikasu project to act as an entrypoint to our CI pipeline, building images encapsulating git clones of new commits that then get pulled by keel.sh. We are an AI shop so GPU support is important for us as well, that and the bundled Istio comes in handy.

Leave a Reply to Harley Laue Cancel reply

* All fields are required. Your email address will not be published.