How to Install Kubernetes Locally using Vagrant / Minikube

September 8, 2016 | By in LINUX HOWTO
| Reply More

Kubernetes is 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 production laptop which is running Fedora 24, 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 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 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

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. Minikube is preferred and recommended method so we will in next article use minikube to set up applications. After you get familiar with Kubernetes, you will want to run it on remote servers, so we will talk about that in some of future articles. If you are to can't wait for next articles and want to delve into Kubernetes right now, official site has pretty good docs for you. Thank you for reading, that is all for this article.



Share This :

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.