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
Now that we have installed Docker on our system, let's proceed ahead.
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
This command installs Homebrew in your system and its more or less smooth sailing for those who are on MacOS.
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
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.
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.2 - This 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=8192 - This 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 🙂