Want to set up a lightweight Kubernetes cluster — one so small it could run on your laptop or PC?
If so, the good news is that there are multiple tools available to help you do that. Minikube, K3s, and MicroK8s all provide an easy way of running lightweight Kubernetes.
The bad news is that understanding the differences between Minikube, K3s, and MicroK8s can be a bit challenging. Although all of these Kubernetes distributions do the same basic thing, they do it in different ways. You need to understand the nuances to select the best lightweight Kubernetes distro for your needs and preferences.
Lightweight Kubernetes Overview
Before explaining how Minikube, K3s, and MicroK8s are different, let's discuss what makes them similar: They are all lightweight Kubernetes distributions.
In other words, they are versions of Kubernetes that are designed to run with relatively low resources. And they all have an easy setup process.
Both of these factors — low resource requirements and ease of use — make lightweight Kubernetes distributions a great choice for people who are new to Kubernetes and want to set up an environment on their own computer where they can experiment with managing nodes, deploying pods, and so on.
That said, it's important to note that — as we'll discuss in detail below — testing and experimentation is not the only intended use case for lightweight Kubernetes distributions. Some of these distributions are also intended to be capable of hosting production-grade application deployments.
Minikube, K3s, and MicroK8s: The Main Differences
Now let's look at how Minikube, K3s, and MicroK8s differ from each other.
Minikube is a lightweight Kubernetes distribution developed by the main Kubernetes project. It's capable of running on Linux, Windows, and macOS (although if you run it outside of a Linux environment, it relies on virtualization to set up your clusters; on Linux, you can use virtualization or run clusters directly on bare metal).
Minikube is extremely easy to use. On Linux, you just have to download the Minikube binary with a command like:
And then run it with:
chmod +x minikube-linux-amd64
By default, Minikube creates a single-node cluster, but you can set up more nodes using the --nodes flag when you start Minikube.
Minikube's main advantages are that it's extremely lightweight and very easy to install and use.
The main downside of Minikube is that it's only designed for testing. It's not a practical solution for running production-grade clusters.
K3s is a lightweight Kubernetes distribution developed by Rancher. It can also run on any operating system (Linux, Windows, and macOS).
It's relatively easy to set up a single-node cluster. You just download the binary from GitHub and launch a single-node cluster with:
sudo k3s server &
If you want to add nodes to your cluster, however, you have to set K3s up on them separately and join them to your cluster. In this respect, K3s is a little more tedious to use than Minikube and MicroK8s, both of which provide a much simpler process for adding nodes.
On the other hand, K3s is designed to be a full-fledged, production-ready Kubernetes distribution that is also lightweight. Rancher developed it especially for use cases involving infrastructure like internet of things (IoT) and edge devices.
MicroK8s is Canonical's answer to K3s. It's also designed to be a production-ready lightweight Kubernetes distribution, and it can run on any operating system.
Installing MicroK8s is easy — if you have a Linux distribution (like Ubuntu) that supports snap packages. In that case, you can install it with a simple:
sudo snap install microk8s --classic
On Linux distributions without snap support, however, installation is trickier; you will need to install snapd on your system first, then use it to install snap. Installers are also available for Windows and (via Homebrew) macOS.
Adding nodes in MicroK8s is easy. Simply use the command:
One nice feature of MicroK8s is that it automatically configures your cluster to be highly available (meaning it has multiple master nodes) whenever the total cluster node count reaches or exceeds three.
Overall, MicroK8s is a little more complicated to use than K3s or Minikube, particularly because it has a modular architecture and only runs a minimal set of services by default. To turn on things like DNS support or a web-based dashboard, you have to launch them explicitly.
This minimalist design is great if you want to run very lightweight production environments — as you might, for instance, if you are running Kubernetes at the edge or on IoT devices. It's less convenient, however, for people who just want to test Kubernetes with as few variables as possible.
In short, the relative advantages and disadvantages of Minikube, K3s, and MicroK8s can be summed up as follows:
- Minikube is the easiest overall to use, but it's not a production-grade solution.
- K3s is the easier production-grade lightweight distribution.
- MicroK8s provides the greatest degree of control, but it's a bit harder to install and configure than the other distributions.