Kubernetes is great for large-scale applications, providing security, scalability, and portability, which most organizations recognize. For large-scale applications, Kubernetes is usually deployed through a cloud provider such as Azure, AWS, or GCP with the full breadth of infrastructure options. But what about smaller local applications?
Whether you would like to experiment with an idea, get up to speed on Kubernetes, want to apply large-scale applications in IoT or on the Edge, or would like local clusters for tasks that require multiple configurations during your CI/CD end-to-end testing process, there are options available.
The three main choices are:
They all solve the same problem: they allow you to deploy, monitor, and execute local Kubernetes clusters quickly. If you want to dive deeper into the difference between the three, here’s a great article that compares them. Included below is a summary table (with some corrections and updates) from the article.
Among the three, minikube is the most mature and widely adopted, according to our Kubernetes statistics, making it a safe bet for long-term support. Since minikube is supported by Kubernetes, you can directly engage the support network through the #minikube community in Slack.
An Introduction to minikube
minikube makes the core functions of Kubernetes such as networking, dashboards, and security policies easier to use while allowing you to move beyond its limits when required. You will explore this soon by setting up a sample application in less than a minute. There are a number of add-ons available, making it simple to add additional Kubernetes services to the core services.
For example, there are add-ons for Google Cloud Auth, gcp-auth, metrics through metrics-server, Helm Package Manager, Nvidia GPUs, and an image registry. You can see a full list of what’s easily supported by running <terminal inline>minikube addons list<terminal inline> after you install the service. You can also see the add-ons through the GitHub repo.
The platform is enabled on Linux, Windows, and OSX, making it easy to get started without worrying about compatibility. It also has high performance and has a large base of developers, with over 650 contributors on GitHub. These are not confined to the creators. Recently, the community reported that as of 2020, the number of non-Google related commits had grown by more than seventy percent.
As the platform has started to mature, it remains true to its core: it’s easy to set up and deploy locally. minikube is particularly useful in situations where you need multi-cluster support and have a constraint on memory. It’s not so useful when startup times aren’t critical, since K3s and kind both offer lower startup times at the cost of higher memory and loss of multi-cluster support.
Setting Up minikube
To set up minikube, you can use a default virtual machine such as VMware VirtualBox, or Parallels, or a containerization application such as Docker, Hyperkit, or Podman. You can also run minikube natively without a virtual machine or containerization application on a localhost shell by specifying <terminal inline>minikube start --driver=none<terminal inline>.
Beware, however, that this comes with possible security vulnerabilities, data loss on failure, and other issues which are documented in detail here.
Once your virtual machine or containerization application is installed, run the following snippet to install minikube (for Mac, see other instructions provided here), and start minikube.
Through <terminal inline>kubectl get po -A<terminal inline>, you should see minikube pods running.
If you don’t have kubectl, download it through <terminal inline>minikube kubectl -- get po -A<terminal inline>. Alternatively, minikube has kubectl contained within, which can be set up as a symlink. Following this, you can start your exploration through a dashboard by running <terminal inline>minikube dashboard<terminal inline>.
Once you have finished provisioning the Kubernetes cluster, deploy an application. Here, we deploy a simple nginx server.
In the command, you specify that you want to host the service called <terminal inline>hello-minikube<terminal inline>, with the specified image and then expose it on port 8080. You can now access this on your service online through <terminal inline>minikube service hello-minikube<terminal inline>. To manage the service, you can prompt minikube with commands like <terminal inline>minikube pause<terminal inline>, <terminal inline>minikube stop<terminal inline>, <terminal inline>minikube config set memory 16384<terminal inline>, <terminal inline>minikube delete --all<terminal inline>.
Similarities between Kubernetes and minikube
Now that you have an idea of how to deploy on minikube, we can dive deeper into the differences between Kubernetes and minikube.
minikube is Kubernetes through a local deployment. It creates a local endpoint that you can access through kubectl. You can choose the number of nodes in your cluster by specifying the <terminal inline>--nodes<terminal inline> flag with your driver.
<terminal inline>minikube start --nodes 4 -p hello-minikube<terminal inline>
You can get your running nodes through kubectl and check their status by specifying the program.
minikube logs can be accessed through <terminal inline>minikube logs<terminal inline> with the associated flags, such as <terminal inline>-f<terminal inline>, follow, or <terminal inline>-n<terminal inline>, length.
You can set up the logs to output during minikube’s interaction with a testing system. Telemetry is also supported through OpenTelemetry Tracing and Stackdriver.
Overall, the experience is very similar to Kubernetes, with a reduced overhead and local cluster option. In fact, you can even switch between Kubernetes and minikube fairly easily using <terminal inline>kubectl<terminal inline>.
minikube is a great alternative and/or complement to Kubernetes, enabling serverless development. In the light of these benefits, it’s best to use minikube when you’re looking to augment your current services with smaller-scale local deployment (such as rapid development environments), testing, or edge computing. It’s also a great tool for prototyping your ideas, running a CI/CD automated test pipeline, and working with IoT and edge applications where cluster startup and shutdown times are important. As the community continues to grow, so will the number of applications for minikube.