What Is Minikube?

SHARE:

Facebook logo LinkedIn logo X (formerly Twitter) logo

Want to test Kubernetes without the effort of setting up a complex, production-grade cluster? If so, Minikube is a great solution. This tool  provides an easy means of creating a local Kubernetes environment on any Linux, Mac, or Windows system, where you can experiment with and test Kubernetes deployments.

Keep reading for an overview of how Minikube works, how to install it, and tips on when you should and shouldn’t use it.

What Is Minikube?

Minikube is a tool that sets up a Kubernetes environment on a local PC or laptop. It’s technically a Kubernetes distribution, but because it addresses a different type of use case than most other distributions (like Rancher, OpenShift, and EKS), it’s more common to hear folks refer to it as a tool rather than a distribution.

Minikube supports all of the major operating systems – Windows, Linux, and macOS. (It doesn’t run on mobile devices, alas.)

Minikube vs. Kubernetes

Minikube is a version of Kubernetes, so it doesn’t really make sense to think of them as being binary opposites. However, there are important differences between Minikube and most other versions of Kubernetes, as summarized in this chart:

MinikubeMost other Kubernetes distros
Supported operating systemsLinux, Windows, macOSLinux (Windows can host worker nodes)
Cluster size by defaultSingle-nodeMulti-node
Can it be deployed in the cloud?Not really (theoretically possible, but this is not a supported use case)Yes
Available as a managed service?NoYes (for many distributions)
Storage handlingOn local directories inside the Minikube machine (by default)Using the Container Storage Interface, or CSI (in most cases)

How Does Minikube Work?

Minikube works by setting up a Kubernetes cluster on a local machine. By default, it creates a one-node cluster, but as we explain below, you can create a multi-node cluster with a Minikube environment if desired.

Minikube supports a flexible deployment mode based on the concept of “drivers.” Depending on the driver you choose for deployment, your Kubernetes node, or nodes, can run in one of several ways:

  • Inside a Docker container.
  • Inside a virtual machine. Several VM platforms are supported, such as VirtualBox, KVM, Hyper-V, and Parallels, depending on which host operating system you use.
  • Directly on bare metal, if your host OS supports it.

The drivers available for your installation depend on which system you are using to run Minikube. You can only use Hyper-V VMs on Windows, for example, because Hyper-V only supports Windows. Likewise, the bare-metal driver option is only supported on Linux, since Kubernetes master nodes can run natively only on a Linux system.

Which driver to choose depends on what level of performance and isolation you want from Minikube. You’ll get the best performance if you deploy Minikube on bare metal. You’ll get the next-best level of performance if you deploy it inside a container. Deploying in a VM gives you the lowest level of performance, with the upside being that your Minikube environment will be rigidly isolated from the host system.

How To Install Minikube

The way you install Minikube depends on which operating system you are using to host it and which driver option you select. In most cases, however, installing and starting Minikube is as simple as using an installer or downloading an installer script and running it on your system.

Installing on Linux

On most Linux systems, you can install Minikube with:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikubeCode language: JavaScript (javascript)

Most major Linux distributions also offer RPM or Debian packages for installing Minikube.

Installing on Windows

The easiest way to install Minikube on Windows is to download and run the installer. You can also use PowerShell to set it up, if desired, by downloading a binary:

New - Item - Path 'c:\' -Name '
minikube ' -ItemType Directory -Force
Invoke - WebRequest - OutFile 'c:\minikube\minikube.exe' - Uri 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' - UseBasicParsingCode language: PHP (php)

Installing on macOS

On a Mac, install Minikube with:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
sudo install minikube-darwin-amd64 /usr/local/bin/minikubeCode language: JavaScript (javascript)

You can also install Minikube via Homebrew.

How Do You Use Minikube?

Once Minikube is installed, start it with the following simple command:

minikube start

You can then interact with your cluster using standard kubectl commands prefixed with the minikube command. For example:

minikube kubectl cluster-info

Alternatively, you can SSH into the Minikube node and run kubectl directly from there.

The Minikube Dashboard

Like most distributions, Minikube supports the native Web-based Kubernetes dashboard, but it’s not enabled by default. To enable the dashboard, run:

minikube dashboard

This command will also open a page in your default Web browser showing the Kubernetes dashboard.

Managing Ingress for Minikube

By default, Minikube doesn’t provide an ingress controller. For basic experimentation with Kubernetes features, ingress isn’t really necessary; you can use Minikube to practice things like creating pods without having ingress set up.

However, ingress becomes necessary in most cases if you want to test how real-world applications might behave, because ingress helps you simulate the networking conditions that those applications would experience when running in a production cluster.

Fortunately, Minikube provides addons that make it easy to install an ingress controller. You can do this with a simple command:

minikube addons enable ingress

This creates an NGINX-based ingress controller for your Minikube environment.

Minikube doesn’t support complex ingress configurations. You’ll need a full-fledged complex Kubernetes distribution for testing advanced networking setups. But for basic application testing, Minikube and its NGINX ingress addon should suffice.

Multi-Node Minikube

As noted above, Minikube runs a single-node Kubernetes cluster by default. If you want to experiment with managing multiple nodes inside Kubernetes, you may wish to set up a multi-node cluster instead.

You can do this easily enough by using the –nodes flag when you start Minikube. For example, to create a cluster with two nodes, run:

minikube start --nodes 2 -p multinode-demo 

Minikube Alternatives

Minikube isn’t the only way to set up a lightweight container environment on a local system. MicroK8s, K3s, and Docker Desktop offer similar functionality to Minikube, but with some important differences.

MinikubeMicroK8sK3sDocker Desktop
Supports Kubernetes?YesYesYesYes (but not by default)
Multi-node cluster supportAvailable, but not a major focusFully supportedFully supportedPossible, but requires extensions beyond core product
Main development supporterKubernetes projectCanonicalRancherDocker

Of all these options, Minikube is arguably one of the simplest tools to set up and deploy. Minikube’s driver-style deployment mode also provides a great deal of flexibility with regard to how you actually run your cluster. On the other hand, Minikube doesn’t support as many advanced configuration options as alternatives like K3s.

When – And When Not – To Use Minikube

Whether Minikube is the right option for you depends on several factors.

The first and most important factor is whether you need to run a production Kubernetes cluster, or you just want to experiment with this technology. In the former case, Minikube is not a good choice. Although in theory there is nothing stopping you from setting up on a server and hosting real-world applications with it, Minikube is not intended for hosting production-grade workloads. It’s for testing and experimentation.

This is true, by the way, even if you aren’t ready to set up a production cluster yet, but doing so is your ultimate goal. If you want to learn to manage production-grade clusters, a simpler way to get on the right path may be to use a hosted sandbox environment of a full-fledged Kubernetes distribution, like OpenShift or Rancher. Because these environments are hosted in the cloud, they are about as easy (or perhaps even easier) to set up as Minikube, but they provide access to a complete set of production features, making it easy to migrate from a testing environment to a production environment.

In contrast, with Minikube, it’s never going to be practical to take the experimental cluster that you set up on your local machine and turn it into a production-grade environment. You’d have to start from scratch with a different Kubernetes distribution to get into production.

A second question to consider is whether you want a multi-node cluster. While it’s possible to set up multiple nodes with Minikube, Minikube’s focus is more on getting a single-node cluster set up easily and quickly than it is on helping you experiment with complex, multi-node clusters.

Likewise, while Minikube supports basic ingress configurations, its options are limited. If you need complex ingress – or complex networking in general – Minikube is not the best choice.

Conclusion

With a very easy setup process, flexible deployment options, and support for all the major operating systems, Minikube provides a convenient and user-friendly tool to help you experiment with Kubernetes. It’s not anything approaching a production-grade Kubernetes distribution, but it’s great for folks just getting started with containers and Kubernetes.