Install Minikube on Ubuntu (VirtualBox)

Minikube is a single-node Kubernetes cluster that can be installed on macOS, Linux and Windows.

It lets you to try out Kubernetes locally on your personal computer or use it for daily development work.

In this note i will show how to install Minikube & Kubectl on Ubuntu (with VirtualBox) and deploy a first “Hello Minikube” application on a local Kubernetes cluster.

Install Minikube on Ubuntu

Requirements: Minikube requires at least 2 CPUs, 2GB of free memory, 20GB of free disk space, internet connection and container or virtual machine manager (driver), such as: Docker, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMWare.

Install Minikube

To install Minikube on Unubtu you just need to download and copy the binary to /usr/local/bin/ with the appropriate permissions:

$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube
$ minikube version

Install VirtualBox

If you haven’t yet installed any of supported drivers, i suggest to install VirtualBox (5.2 or higher) to deploy Minikube on Ubuntu as a VM:

$ sudo apt install virtualbox virtualbox-ext-pack

Install Kubectl

To deploy and manage a local Minikube cluster it is also required to install kubectl – the official command-line tool for Kubernetes:

$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ sudo install kubectl /usr/local/bin/kubectl
$ kubectl version --client -o json

Start Minikube

Cool Tip: Start a Minikube with more memory and CPUs! Read more →

Start a Minikube cluster:

$ minikube start

Get the cluster status:

$ minikube status

Display settings:

$ kubectl config view

List Kubernetes Nodes:

$ kubectl get nodes

Minikube comes with a dashboard add-on that provides a way to manage a Kubernetes cluster through the user interface.

To enable and access the Kubernetes dashboard, run:

$ minikube dashboard

Hello Minikube – First App Deployment

Once you have a running local Kubernetes cluster, you can deploy a containerized applications on top of it, i.e. create a Deployment:

$ kubectl create deployment hello-minikube --image=gcr.io/google_containers/echoserver:1.4

The command above creates a Pod named hello-minikube and starts in it a container from the image gcr.io/google_containers/echoserver:1.4.

To make the hello-minikube container accessible from outside the Kubernetes virtual network, you have to expose the Pod, i.e. create a Service:

$ kubectl expose deployment hello-minikube --type=LoadBalancer --port=8080

Deployment vs Service: A Deployment in Kubernetes is responsible for keeping Pods running. A Service in Kubernetes is responsible for enabling network access to Pods.

To access the hello-minikube application, run:

$ minikube service hello-minikube

List Kubernetes Pods:

$ kubectl get pods

List Kubernetes Deployments and Services:

$ kubectl get deployments
$ kubectl get services

Show events:

$ kubectl get events

Clean up

Cool Tip: Login to a Pod using kubectl command! Read more →

To clean up the resources created in the cluster, run:

$ kubectl delete service hello-minikube
$ kubectl delete deployment hello-minikube

Stop the Minikube’s VM:

$ minikube stop

Delete the Minikube’s VM:

$ minikube delete