Setup Kubernetes with Minikube on a Bare Metal Server

Kubernetes Overview

Kubernetes is an open-source platform for managing containerized workloads and services with a rapidly growing ecosystem. Kubernetes orchestrates computing, networking, and storage infrastructure on behalf of user workloads. The tool facilitates both: declarative configuration and automation and was released to the public by Google in 2014.

Kubernetes has a number of features. It can be thought of as:

  • a container platform
  • a microservices platform
  • a portable cloud platform and a lot more.

Minikube runs a single-node Kubernetes cluster inside a VM on your computer or cloud server for developing and testing applications.

Minikube supports Kubernetes features such as:

  • DNS
  • NodePorts
  • ConfigMaps and Secrets
  • Dashboards
  • Container Runtime: Docker, rkt, CRI-O and containerd
  • Enabling CNI (Container Network Interface)
  • Ingress


Downloading and Installing Minikube

1 . Check if the CPU of your server supports hardware virtualization. The output of the following command shall not be empty:

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

2 . Minikube relies on a Hypervisor to run the Kubernetes VM. This tutorial uses KVM (Kernel Virtual Machine), but it is also possible to run Minikube on VirtualBox.

apt-get install qemu qemu-kvm libvirt-bin virtinst curl

3 . Download the Minikube binary and make it executable:

curl -Lo minikube && chmod +x minikube

4 . Copy the binary file to /usrlocal/bin/ to make it available system-wide, then remove the downloaded binary:

cp minikube /usr/local/bin && rm minikube

5 . Download and install the KVM driver for Minikube:

curl -LO && chmod +x docker-machine-driver-kvm2

6 . Copy the binary file to /usrlocal/bin/ to make it available system-wide, then remove the downloaded binary:

cp docker-machine-driver-kvm2 /usr/local/bin/ && rm docker-machine-driver-kvm2

7 . Download and install kubectl, a CLI tool to mange Kubernetes:

curl -LO$(curl -s && chmod +x kubectl

8 . Copy the binary file to /usrlocal/bin/ to make it available system-wide, then remove the downloaded binary:

cp kubectl /usr/local/bin && rm kubectl

Using Minikube

1 . Start Minikube:

minikube start --vm-driver=kvm2

An output informs about the status of Minikube:

πŸ˜„  minikube v1.1.0 on linux (amd64)
2019/05/27 15:11:47 No matching credentials were found, falling back on anonymous
πŸ”₯  Creating kvm2 VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
🐳  Configuring environment for Kubernetes v1.14.2 on Docker 18.09.6
πŸ’Ύ  Downloading kubeadm v1.14.2
πŸ’Ύ  Downloading kubelet v1.14.2
🚜  Pulling images ...
πŸš€  Launching Kubernetes ...
βŒ›  Verifying: apiserver proxy etcd scheduler controller dns
πŸ„  Done! kubectl is now configured to use "minikube"

2 . Check the health status of minikube:

minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at

3 . Start an Echoserver deployment:

kubectl run hello-minikube --port=8080

Once the deployment is created, a message confirms the step:

deployment.apps/hello-minikube created

4 . Check the running pods and configured deployments:

kubectl get pods

NAME                              READY   STATUS    RESTARTS   AGE
hello-minikube-56cdb79778-qj7sd   1/1     Running   0          3m47s
kubectl get deployments
hello-minikube   1/1     1            1           5m59s

Expose an echoserver deployment with NodePort

kubectl expose deployment hello-minikube --type=NodePort

7 . curl the service created by running the following command:

curl $(minikube service hello-minikube --url)

A response similar to this example is shown:

Hostname: hello-minikube-56cdb79778-qj7sd

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-

8 . Delete the hello-minikube service:

kubectl delete services hello-minikube

9 . Delete the deployment:

kubectl delete deployment hello-minikube

A confirmation displays:

deployment.extensions "hello-minikube" deleted

10 . Stop Minikube:

minikube stop

A confirmation displays:

βœ‹  Stopping "minikube" in kvm2 ...
πŸ›‘  "minikube" stopped.

For more information regarding Minikube and Kubernetes, check out the official documentation and the Minikube GitHub repository.

Discover the Cloud That Makes Sense