Minikube: Kubernetes made simple
Why choose simple when you can choose something simpler? That could well be the motto of Minikube, the tool that lets you run Kubernetes on your local computer system.
Containers have shaken up and transformed vast sectors of the computing industry and software development in particular. They allow developers to run multiple applications independently inside special virtual environments. Tools like Kubernetes are used to orchestrate the containers and their processes.
Kubernetes is fast becoming the go-to solution for container management because in addition to managing applications, services and resources, and configuring and handling dependencies, it also organizes the cluster of virtual machines. Moreover, it includes “health checks” that monitor the nodes, pods, and containers in the cluster to make sure everything is running as it should.
Minikube is a pared-down version of Kubernetes that gives you all the benefits of Kubernetes with a lot less effort. This makes it an interesting option for users who are new to containers, and also for projects in the world of edge computing and the Internet of Things. Let’s take a closer look at the Kubernetes Minikube tool and see how it can be used, and how it manages to do without large infrastructures.
The ideal platform for demanding, highly scalable container applications. Managed Kubernetes works with many cloud-native solutions and includes 24/7 expert support.
Minikube – the minimalistic approach to container management
Minikube is ideal for small container-based projects. You can use it to set up a private Kubernetes cluster without having to work directly with an entire server or cloud platform for example. With the Minikube Kubernetes tool, there’s no need for large infrastructures – you just set up simple local clusters.
A computer and a single-node cluster – that’s all Minikube needs. This minimum setup is designed to appeal to software developers who want a straightforward way of deploying small private projects. No server or cloud provider is required. The Kubernetes cluster simply runs on the local host. The default VM (virtual machine) runtime for Minikube is VirtualBox, meaning the tool can be used on Windows and macOS as well as Linux. However, if you would prefer not to use VirtualBox, you can configure Minikube to run without a virtual machine.
What Kubernetes functions does Minikube provide?
The simplicity of Minikube is also evident in the number of Kubernetes functions that it supports:
- DNS
- NodePorts
- ConfigMaps and Secrets
- Dashboards
- Container runtime environments: Docker or Docker alternatives such as rkt, CRI-O and containerd
- Container Network Interface (CNI) support
- Ingress
If you’re already familiar with the features of Kubernetes, the Minikube setup no doubt sounds rather limited. However, everything can be expanded thanks to features. Examples include the Minikube tunnel command, which works like a load balancer, Role-Based Access Control (RBAC), dashboards, multi-clusters, and many other standard Kubernetes features. There is also a huge range of plugins available, such as GPU support for automated error analysis or building a machine learning model.
Just as with its big brother, Kubernetes, it’s thanks to the community that Minikube really shines. More and more contributors are getting involved all the time, pushing the tool further and further. As soon as a Kubernetes update becomes available, there’s a new version of Minikube too. And thanks to the community, there’s now a database of known issues that users can consult for help.
How does Minikube work?
It would be very hard to find a more fitting name for Minikube – the endless possibilities of Kubernetes have been stripped down to the bare minimum so that the tool can run on a laptop or PC. Yet you needn’t worry about functionality. All the key features are here, and with just a few installation commands, Minikube becomes a fully functional Kubernetes cluster that’s perfect for everyday development tasks or playing around.
Minikube can run the virtual machine via a number of different hypervisors, for example VirtualBox, which we mentioned above. If you already have a hypervisor installed on your system, Minikube will automatically set up the virtual machine. Last but not least, to send commands to your Kubernetes cluster, you’ll need the standard command line interface, kubectl.
Once these components are installed, Minikube is ready to go. By default, the virtual machine will be allocated 1 GB of RAM, and a Kubernetes cluster will be created, ready for you to configure using kubectl. One of the first things you might want to do is adjust the memory allocation to suit your requirements.
If you’ve worked with containers before, the next steps will be familiar. The physical cluster is divided into multiple areas using namespaces. Creating specific namespaces via kubectl can help you maintain a clear overview of your resources. As you can see, thanks to the various add-ons, Minikube offers just as many functions as any other container system.
What is Minikube used for?
The main reason people use Minikube is to gain hands-on experience of Kubernetes. Huge clusters are not always readily available, and Minikube offers a quick way of trying things out and testing applications. The Kubernetes website provides a comprehensive tutorial on using Minikube, so you don’t need any prior experience in order to get stuck in. And in fact, even those who are already familiar with Kubernetes will find Minikube to be a fantastic learning environment, because it offers so much scope for experimentation.
You can use it to test all of the Kubernetes functions. Both tools are open-source and are distributed under the Apache 2.0 license. They allow you to evaluate and enable/disable clusters and add-ons, and you can proceed by trial-and-error to further develop your environment to create a larger Kubernetes ecosystem.
Experimenting is all well and good. But does Minikube have other uses? The answer is yes! As well as being perfect for small private software projects, Minikube can also be used for external technologies – it includes experimental support for managing NVIDIA GPUs for instance. That’s why it’s a great tool for developers of machine learning algorithms to video games alike.
Minikube is also aimed at IT executives. Given how fast technologies change in the world of computing, CIOs should be developing, testing and learning new tools all the time – but they simply don’t have the time. Thankfully, when it comes to Kubernetes, there’s an easy way to get up to speed: Minikube. For instance, there’s a Minikube feature for the Kubernetes dashboard that displays detailed information and usage metrics so you can check how well your application is running on the cluster. Minikube is also perfect for giving practical demonstrations (on a local machine) of how Kubernetes works.
A small step into the big world of Minikube
Full instructions for installing Minikube can be found in the official Kubernetes documentation, but basically, to install Minikube, you need a container system such as Docker or an environment with a virtual machine, plus the native command line interface, kubectl. You can then run your first command:
minikube start
On your PC/laptop, you’ll need the following:
- 2 or more CPUs
- 2 GB of free memory
- 20 GB of free disk space
- An internet connection
- A container management system or a virtual machine
Once you’ve installed kubectl, you can access your new cluster as follows:
kubectl get po -A
Minikube comes with the Kubernetes Dashboard so you can quickly familiarize yourself with the new environment.
minikube dashboard
Now you can start creating deployments. To create a sample deployment and expose it on port 8080, enter:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8080
These commands make use of an existing image called echoserver, but you can change this and use your own image here if you prefer.
It may take a moment, but if you run the following command, you should see your deployment:
kubectl get services hello-minikube
The simplest way to access this service is to get Minikube to launch a web browser:
minikube service hello-minikube
Alternatively, you can use kubectl to forward the port:
kubectl port-forward service/hello-minikube 7080:8080
Finally, here are some general admin commands for the cluster:
Pause Kubernetes without impacting deployed applications:
minikube pause
Halt the cluster:
minikube stop
Increase the default memory limit (requires a restart):
minikube config set memory 16384
Browse the catalog of Kubernetes services:
minikube addons list
Create a second cluster running an older Kubernetes release:
minikube start -p aged --kubernetes-version=v1.16.1
Delete all of the Minikube clusters:
minikube delete --all
Want to know more about Minikube’s big brother, Kubernetes? Then check out our detailed Kubernetes tutorial for lots of practical tips.