Are you coming from a non-linux background and now in the process of learning Kubernetes? and you are new to Linux (like me!!) and would like to try installing Kubectl and Minikube in a Linux VM? This post aims to help you with step-by-step instructions to get Minikube installed in a Ubuntu VM
What is Minikube?
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single node Kubernetes cluster inside a VM. It is one of the best way to try out Kubernetes locally
As minikube runs a single node Kubernetes cluster inside a VM, you need to have a Linux machine which is having virtualization capabilities enabled, only them we can run another virtual machine inside your host linux machine.
If you would like to create the Linux VM in Azure, make sure you pick “D V3” or “E V3” instance, these VM instances enabled for nested virtualization. Visit this link for more details. For the purpose of this post, I used Standard E4s v3 instance with Ubuntu Server operating system.
run command the following command to ensure virtualization is enabled in the machine, It should produce an output similar to the image show below, ‘vmx’ should be highlighted in red
cat /proc/cpuinfo | grep ‘vmx\|svm’
Follow the general instructions given in VirtualBox site for installing VirtualBox in your machine. We will be following instructions for “Debian-based Linux distributions”
- Go to /etc/apt directory and make a back-up copy of sources.list file (just in case!)
2. Use your preferred editor to open and edit sources.list file, I used nano editor that comes along with Ubuntu by default. Add the following line to sources.list and save. ‘Xenial’ in this line indicates the distro
deb https://download.virtualbox.org/virtualbox/debian xenial contrib
3. Run command sudo apt-get update and it should produce an output as shown below, Note that in the output it should say something like “The following signature couldn’t be verified because the public key is not available”
3. Run command wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
4. Run command wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
5. Now run command sudo apt-get update and it should now be able to get the updates without any error
6. Ubuntu/Debian users might want to install the dkms package to ensure that the VirtualBox host kernel modules are properly updated if the linux kernel version changes during the next apt-get upgrade. So run the following command
sudo apt-get install dkms
7. Run command sudo apt-get install virtualbox-5.2 to install VirtualBox, It should take between 2 to 5 minutes to complete the installation
- Go to directory /usr/local/bin and run the following command, it will download the Kubectl from Googleapis.com
2. Once downloaded, make Kubectl binary executable. Run command
sudo chmod +x ./kubectl
- Run the following command to download minikube debian package.
2. Install package using command Sudo dpkg -I minikube_.deb
3. Start the minikube using command minikube start
4. Once minkube started running, you can get the status of minikube using command minikube status if everything went correctly so far, you should see a output something similar to the one shown below
You are now all set to explore Kubernetes in your local/cloud Linux VM.