Minikube is a tool developed to help you run a single cluster of Kubernetes on your local machine. Minikube works by starting a single node kubernetes cluster locally for purposes of development and testing. It packages and configures a Linux VM, Docker and all Kubernetes components, optimized for local development.
Minikube supports Kubernetes features such as:
- ConfigMaps and Secrets
As of this writing, Minikube does not yet support Cloud Provider specific features such as:
Most Minikube setups available online are for VirtualBox as a hypervisor for the VM. If you’re a frequent visitor of my blog, you must have noticed I’m a big fan of KVM. So this guide is for those who want to run Minikube but on KVM.
To run Minikube on KVM, you need to install some libraries and drivers required for communication with the Virtualization layer. These are:
- Docker machine – This is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands
- Docker Machine KVM2: This is a plugin driver for docker machine on KVM.
- Qemu and Libvirt – Hypervisor and Virtualization API Library
- Minikube and kubectl
Step 1: Installing KVM – Libvirt and Qemu
I already wrote an article on Installing and Configuring KVM on Various Linux distributions. Below is the link:
Step 2: Install Docker-machine
Installation of docker machine will vary from one distribution to another. But when you have docker community repository added to your System, you can install docker-machine from OS package manager. Our guide on installing Docker has a step of adding the repository:
You can also take a look at Official Docker machine page.
Step 3: Download minikube
You need to download the minikube binary. I will put the binary under /usr/local/bin directory since it is inside $PATH.
Make the file executable:
# chmod +x /usr/local/bin/minikube # minikube version minikube version: v0.27.0
For Arch Linux users, you can install minikube from AUR:
$ yaourt -Sy minikube-bin
Step 4: Install kubectl
We need kubectl which is a command line tool used to deploy and manage applications on Kubernetes.
For Arch Linux users, you can also install this from AUR:
$ yaourt -Sy kubectl-bin $ kubectl version
Step 5: Install Docker Machine KVM driver
The last item to install is the Docker machine driver for KVM. Download the binary and make it executable.
The package is available from AUR for Arch Linux users:
$ yaourt -Sy docker-machine-driver-kvm2
Step 6: Starting minikube
With all components installed, you should be ready to start minikube with KVM driver. It will download VM image and configure Kubernetes single node cluster for you. Easy work!!..
$ minikube start --vm-driver kvm2 Starting local Kubernetes v1.10.0 cluster... Starting VM... Downloading Minikube ISO 150.53 MB / 150.53 MB [============================================] 100.00% 0s Getting VM IP address... Moving files into cluster... Downloading kubeadm v1.10.0 Downloading kubelet v1.10.0 Finished Downloading kubeadm v1.10.0 Finished Downloading kubelet v1.10.0 Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. Loading cached images from config file.
Wait for the download and setup to finish then confirm that everything is working fine. You should see a running VM with a domain named minikube.
Minikube Basic operations
Check cluster status:
Minikube configuration file is located on:
To View Config, use:
Access minikube VM using ssh:
To stop a running local kubernetes cluster, run:
$ minikube stop
To delete a local kubernetes cluster, use:
$ minikube delete
Step 7: Enable Kubernetes Dashboard
Kubernete ships with a web dashboard which allows you to manage your cluster without interacting with a command line. The dashboard addon is installed and enabled by default on minikube.
To open directly on your default browser, use:
$ minikube dashboard
To get the URL of the dashboard
$ minikube dashboard --url http://192.168.39.117:30000
Open the link on the browser to access the Dashboard.
The next thing to do is check getting started with Minikube guides like:
- Hello Minikube Series: https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/
- Minikube guides for newbies: https://kubernetes.io/docs/getting-started-guides/minikube/