How to run Minikube on KVM

(: September 8, 2019) Minikube is a tool developed to help you run a single cluster of Kubernetes on your local machine. Minikube...

Written by SXI ADMIN · 4 min read >

(: September 8, 2019)

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.


Deploy Production Kubernetes Cluster with Ansible & Kubespray

.td_uid_2_5d905f0124da4_rand.td-a-rec-img{text-align:left}.td_uid_2_5d905f0124da4_rand.td-a-rec-img img{margin:0 auto 0 0}

How To run Local Kubernetes clusters in Docker

Deploy Lightweight Kubernetes with MicroK8s and Snap

Minikube supports Kubernetes features such as:

  • DNS
  • NodePorts
  • ConfigMaps and Secrets
  • Dashboards

As of this writing, Minikube does not yet support Cloud Provider-specific features such as:

  • LoadBalancers
  • PersistentVolumes
  • Ingress

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.

For VirtualBox users, follow the guide How to Install Minikube on Ubuntu 18.04

Setup Requirements

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:

Install KVM on CentOS 7 / Ubuntu 16.04 / Debian 9 / SLES 12 / Arch Linux

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:

How to install Docker CE on Ubuntu / Debian / Fedora / Arch / CentOS

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.

wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube

Check version installed.

$ minikube version
minikube version: v1.2.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.

curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

Give the file executable bit and move to a location in your PATH.

chmod +x kubectl
sudo mv kubectl  /usr/local/bin/
kubectl version -o json 

Confirm the version of kubectl installed.

$ kubectl version -o json 
  "clientVersion": {
    "major": "1",
    "minor": "15",
    "gitVersion": "v1.15.1",
    "gitCommit": "4485c6f18cee9a5d3c3b4e523bd27972b1b53892",
    "gitTreeState": "clean",
    "buildDate": "2019-07-18T09:18:22Z",
    "goVersion": "go1.12.5",
    "compiler": "gc",
    "platform": "linux/amd64"

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.

curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
chmod +x docker-machine-driver-kvm2
sudo mv docker-machine-driver-kvm2 /usr/local/bin/

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 the Kubernetes single node cluster for you. Easy work!!..

$ minikube start --vm-driver kvm2
?  minikube v1.2.0 on linux (amd64)
?  Downloading Minikube ISO ...
129.33 MB / 129.33 MB [============================================] 100.00% 0s
?  Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
?  minikube v1.2.0 on linux (amd64)
?  Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6
?  Downloading kubeadm v1.15.0
?  Downloading kubelet v1.15.0
?  Pulling images ...
?  Launching Kubernetes ... 
⌛  Verifying: apiserver proxy etcd scheduler controller dns
?  Done! kubectl is now configured to use "minikube"

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.

$ sudo virsh list
 Id   Name       State
 1    minikube   running

Minikube Basic operations

Check cluster status:

$ kubectl cluster-info
Kubernetes master is running at
KubeDNS is running at

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Minikube configuration file is located on:


To View Config, use:

$ kubectl config view
apiVersion: v1
- cluster:
    certificate-authority-data: DATA+OMITTED
  name: 192-168-42-106:8443
- cluster:
    certificate-authority: /home/jmutai/.minikube/ca.crt
  name: minikube
- context:
    cluster: minikube
    user: minikube
  name: minikube
- context:
    cluster: 192-168-42-106:8443
    namespace: myproject
    user: developer/192-168-42-106:8443
  name: minishift
- context:
    cluster: 192-168-42-106:8443
    namespace: myproject
    user: developer/192-168-42-106:8443
  name: myproject/192-168-42-106:8443/developer
- context:
    cluster: 192-168-42-106:8443
    namespace: myproject
    user: system:admin/192-168-42-106:8443
  name: myproject/192-168-42-106:8443/system:admin
current-context: minikube
kind: Config
preferences: {}
- name: developer/192-168-42-106:8443
    token: QdSKNK5DbaLA2AOFM__8-_fJ-Pt7BikZP1uFwsqyNx0
- name: minikube
    client-certificate: /home/jmutai/.minikube/client.crt
    client-key: /home/jmutai/.minikube/client.key
- name: system:admin/192-168-42-106:8443
    client-certificate-data: REDACTED
    client-key-data: REDACTED

Check nodes:

$ kubectl get nodes
minikube   Ready    master   35m   v1.15.0

Access minikube VM using ssh:

$ minikube ssh
                         _             _            
            _         _ ( )           ( )           
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __  
/' _ ` _ `| |/' _ `| || , <  ( ) ( )| '_`  /'__`
| ( ) ( ) || || ( ) || || |` | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`___/'(_,__/'`____)

$ cat /etc/os-release 
PRETTY_NAME="Buildroot 2018.05.3"

$ docker ps

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.

$ minikube addons list
- addon-manager: enabled
- dashboard: disabled
- default-storageclass: enabled
- efk: disabled
- freshpod: disabled
- gvisor: disabled
- heapster: disabled
- ingress: disabled
- logviewer: disabled
- metrics-server: disabled
- nvidia-driver-installer: disabled
- nvidia-gpu-device-plugin: disabled
- registry: disabled
- registry-creds: disabled
- storage-provisioner: enabled
- storage-provisioner-gluster: disabled

To open directly on your default browser, use:

$ minikube dashboard

To get the URL of the dashboard

$ minikube dashboard --url

Open the link on the browser to access the Dashboard.

The next thing to do is check getting started with Minikube guides like:

.td_uid_4_5d905f0124fc2_rand.td-a-rec-img{text-align:left}.td_uid_4_5d905f0124fc2_rand.td-a-rec-img img{margin:0 auto 0 0}