Skip to Content
Technical Articles

Installing Minikube

As agreed in my previous blog (https://blogs.sap.com/2019/03/10/my-kubernetes-journey/), I will use this page to talk about the installation and setup of Minikube single node local cluster.

The basic resource is available in https://kubernetes.io/docs/tasks/tools/install-minikube/, but contains many subpages. I would like to collate all the info in one page for easy reference.

Pre-requisites

Before we start with our Minikube installation, we need to install Docker on our system. This is a pretty straight forward process and the official documentation is self explanatory. I have linked the guide for Windows, Linux and MacOS below

Windows : https://docs.docker.com/v17.09/docker-for-windows/install/

Mac : https://docs.docker.com/v17.09/docker-for-mac/install/

Ubuntu : https://docs.docker.com/v17.09/engine/installation/linux/docker-ce/ubuntu/

Now that we have installed Docker on our system, let’s proceed ahead.

MAC OS

It is very easy to install Minikube on MacOS (Even though I am running my setup on a MacOS, I will also provide the guide to install and setup Minikube on Linux and Windows as well).

Coming to MacOS, the first thing you need to install is Homebrew. This is similar to your “apt-get” (for those you are from the Linux world). Do note that Homebrew is not just for Minikube, but most of the applications (like Java, VirtualBox, and many more…) on my Mac can/has been installed via Homebrew.

 

To install Homebrew, you can run the command found on the official Homebrew page (https://brew.sh/) as mentioned below

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

This command installs Homebrew in your system and its more or less smooth sailing for those who are on MacOS.

 

Installing Minikube

To install minikube, just run the below command

brew cask install minikube

Ta-da….and that it. Once the installation is successful, the latest version of Minikube is installed. One of the advantages of using Homebrew is that it picks up the latest version automatically and installs it. In case there is a newer version available in the future and you want to move to the latest version of Minikube, you can just run the command

brew cask reinstall minikube

Even though we have successfully installed Minikube, there is one more step that need to be performed before we can start using Minikube. The final step is to install “VirtualBox” VM.

With the help of our trusty side-kick Homebrew, this is a piece of cake. Just run the following command to install VirtualBox on your MacOS.

brew cask install virtualbox

 

WINDOWS & LINUX

To install Virtual Box on Windows or Linux, you can follow the link below

https://www.virtualbox.org/wiki/Downloads

For Windows, you get to download a .exe file and for Linux, depending on the flavour, you can use the appropriate commands like yum or apt-get as documented in the link above.

To install Minikube on Linux, you can run the following command

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
  && chmod +x minikube

For Windows installation, you can download the minikube.exe file from the link below

https://github.com/kubernetes/minikube/releases/latest

Generally, the minikube installation path gets added to the Path variable of the OS. If not, you can set the environment variable to point to Minikube installation so that “minikube” can be accessed/invoked from any directory/location on your system.

 

And that is it… We are all set to start our Minikube local cluster.

To start the Minikube local cluster, just run the following command from terminal.

minikube –vm-driver=virtualbox –kubernetes-version=v1.13.2 –memory=8192 start

You might be wondering why there are so many parameters passed in the above command because some online resources just say that we can start Minikube with just “minikube start”.

Well this is where I want to help out people with my experience. I had researched a lot to get this list of parameters which is guaranteed to work. I will provide a brief explanation as to why each of these parameters are necessary.

–vm-driver=virtualbox – This parameter tells Minikube which VM driver to use. In some instances, hyper-kit is considered as the default VM, which caused certain issues for me. To overcome these issues, you can use the “virtualbox” driver which we had installed in the previous section.

–kubernetes-version=v1.13.2This parameter tells Minikube which version of Kubernetes to be used. This parameter ensures that only the specific version which we explicitly mention is installed. I had encountered some errors when this parameter was not set. I noticed an error message in between the installation (I don’t recollect the exact error message, but it was something related to EOF reached when parsing some file). At the time of writing this blog, I am using v1.13.2 as the k8s version. You can always use any version which suits your requirement.

–memory=8192This parameter tells Minikube how much memory is to be allocated to the Minikube cluster. I am assigning 8GB of ram to the cluster. This may seem trivial, but this is one of the most critical configuration. By default Minikube allocates around 2GB of ram. This was a huge issue for me as one of my deployments (computationally intensive) was always crashing and restarting. From the k8s logs you can see that the restart-count is increasing as time goes by, but you are not able to find the root cause. After a while I found that the root cause was insufficient ram as I was running a number of deployments and services, and when the required memory was not available, the system tries to shut down the instance to recover/recollect memory and then try to restart it again, and this was a cyclic process.

 

And this is pretty much what I wanted to cover in this blog on the installation and setup of Minikube. Do let me know if you found this blog-post useful.

Stay tuned for more blogs on k8s 🙂

And always feel free to provide your feedbacks/suggestions 🙂

1 Comment
You must be Logged on to comment or reply to a post.
  • Great initiative Ashwin. This is one the burning topic where we need to excel and be on top of it. Looking forward for more blogs!!!

    Good Luck!!!