How to Install Kubernetes Locally using Vagrant/Minikube

Kubernetes is an extensive platform for managing container clusters, coming from Google. Like most server software from Google, Kubernetes excels in scalability but it might be challenging to use it for local deployment on a say laptop.

So for this example, I will use my laptop which is running Fedora, but you can use any Linux distro as the actual containers are run in VirtualBox.

We are going to use two methods to install Kubernetes, the deprecated vagrant method and the recommended Minikube method. For both methods, we will use VirtualBox but for Vagrant it is also possible to deploy on bare metal by simply switching provider from "virtualbox" to say "ubuntu" or "centos".

Vagrant Method


  1. You need a Linux distro with Virtual box installed. (5.1 is not supported yet, I had to downgrade to 5.0)
  2. You also need Vagrant installed, sudo dnf install vagrant will do it on fedora.

After setting up prerequisites, we run the script to install Kubernetes inside VirtualBox

export KUBERNETES_PROVIDER=vagrant; wget -q -O - | bash

This script will download all needed stuff and create a default cluster for you.


It might run little longer so be patient. After it is done it will display long message with the ip addresses of the containers it created. You log into master by following command

ssh vagrant@ -p 2222

password is "vagrant", off course without quotes. The root password is also vagrant. So now you have fully functional Kubernetes cluster on your local machine. When you shutdown the cluster and want it back up, you first cd into ~/kubernetes directory in your /home, and then while inside you execute following commands:

export VAGRANT_DEFAULT_PROVIDER=providername

And your cluster will be up again.

This method is easy enough but trouble is that it is deprecated. Support for Virtual Box 5.1 might never come, so we will also do another method with minikube

Minikube method


  1. You need virtual box
  2. You need to install kubectl to your host machine

We assume that you already know how to install virtual box, so here is how to install kubectl

curl -Lo kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

Then install minikube:

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

Then we start the cluster:

minikube start

After that, you have a minikube master start, and you can use kubectl and minikube commands to administer your minikube cluster.

[miki@x550jk ~]$ kubectl get nodes
minikubevm Ready 12m

If you want to access kubernetes dashboard, just type

minikube dashboard

It will open the dashboard in a browser tab.

Screenshot from 2016-08-30 15-14-06

The best things about minikube is that you don't need to ssh into your master VM, you just issue kubectl commands from your host. The kubectl can be used to administer both your minikube local install as well as remote cluster that you might want to build after you get familiar with Kubernetes on your machine. So to switch between clusters managed, there is the concept of contexts. For now, context is set automatically on local minikube, but if need to switch it back to minikube after using with some other install (vagrant, your remote server, etc) use this command:

kubectl config use-context minikube

If you need to ssh into vm for some reason, you can do it with

minikube ssh


Here we have two methods to get Kubernetes running locally, for purposes of learning, development and testing.  After you get familiar with Kubernetes, you will want to run it on remote servers, so we will talk about that in some of the future articles. Thank you for reading, that is all for this article.

Leave a Comment