cloud · docker · kubernetes · linux · x86_64

x86_64: Installing Minikube

Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day [1].

This is a step-by-step installation guide that puts togheter in a single page all required steps to install Minikube on Ubuntu 18.04 with the KVM2 driver. More information on how install Minikube using a different approach can be found in [2].

1 – Check Virtualization

VT-x or AMD-v virtualization must be enabled in your computer’s BIOS, use the following command to verify this feature:

egrep --color 'vmx|svm' /proc/cpuinfo


2 – Install QEMU-KVM

sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo usermod -a -G libvirt $(whoami)
newgrp libvirt

<strong>NOTE:</strong> you need to reboot you computer to user your user is added to the libvirt group.


3 – Install kubectl

sudo apt-get update && sudo apt-get install -y apt-transport-https; curl -s | sudo apt-key add -; echo "deb kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list; sudo apt-get update; sudo apt-get install -y kubectl
echo "source > ~/.bashrc


4 – Install Minikube

curl -Lo minikube && chmod +x minikube
sudo cp minikube /usr/local/bin && rm minikube


5 – Install KVM2 Driver

curl -LO && sudo install docker-machine-driver-kvm2 /usr/local/bin/


6 – Starting Minikube

minikube start --vm-driver kvm2

rpsene@rpsene:~$ minikube start --vm-driver kvm2
Starting local Kubernetes v1.13.2 cluster...
Starting VM...
Downloading Minikube ISO
181.48 MB / 181.48 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubelet v1.13.2
Downloading kubeadm v1.13.2
Finished Downloading kubeadm v1.13.2
Finished Downloading kubelet v1.13.2
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Stopping extra container runtimes...
Starting cluster components...
Verifying kubelet health ...
Verifying apiserver health ...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

Everything looks great. Please enjoy minikube!

rpsene@rpsene:~$ virsh list --all
Id Name State
1 minikube running


7 – Access Minikube

rpsene@rpsene:~$ minikube ip

rpsene@rpsene:~$ minikube dashboard
Enabling dashboard ...
Verifying dashboard health ...
Launching proxy ...
Verifying proxy health ...
Opening in your default browser..


8 – Running an application

rpsene@rpsene:~$ kubectl run hello-minikube --port=8080
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or kubectl create instead.
deployment.apps/hello-minikube created
rpsene@rpsene:~$ kubectl expose deployment hello-minikube --type=NodePort
service/hello-minikube exposed
rpsene@rpsene:~$ kubectl get pod
hello-minikube-6fd785d459-jwhjw 1/1 Running 0 57s
rpsene@rpsene:~$ curl $(minikube service hello-minikube --url)
Hostname: hello-minikube-6fd785d459-jwhjw

Pod Information:
-no pod information available-

Server values:
server_version=nginx: 1.13.3 - lua: 10008

Request Information:
real path=/

Request Headers:

Request Body:
-no body in request-


9 – Deleting an application

rpsene@rpsene:~$ kubectl delete services hello-minikube
service "hello-minikube" deleted

rpsene@rpsene:~$ kubectl delete deployment hello-minikube
deployment.extensions "hello-minikube" deleted


10 – Stopping Minikube

rpsene@rpsene:~$ minikube stop
Stopping local Kubernetes cluster...
Machine stopped.

rpsene@rpsene:~$ virsh list --all
Id Name State
- minikube shut off


11 – References

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s