Setup minikube on VirtualBox
Recently I have started learning Kubernetes on the main job. I am a newcomer to this topic and I used to learn by practicing. So here I present the first part of my introductional practical guide for setting up and playing with Kubernetes on virtual machine (VM) in VirtualBox.
If you don’t know Kubernetes visit the official page.
My primary goal was to try Kubernetes on VMs the simplest way. I have chosen minimal version of k8s called minikube and used a Virtualbox VM with Ubuntu 16.04. minikube creates a single-node cluster.
There is a problem with minikube on VirtualBox VM: minikube uses VirtualBox hypervisor for virtualization and thus requires VT-X support on host. However VirtualBox doesn’t support VT-X/AMD-v. That could be solved by using vm-driver=none option and Docker on host.
Firstly we need to install Docker following this guide. Install kubectl:
Make kubectl executable and move it to system path:
sudo chmod +x ./kubectlsudo mv ./kubectl /usr/local/bin/kubectl
Now install minikube:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/minikube version
Start minikube with vm-driver=none:
sudo minikube start --vm-driver=none
Here is an issue: root privileges are required to use minikube and kubectl (‘minikube start’ command outputs “When using the none driver, the kubectl config and credentials generated will be root owned and will appear in the root home directory”). To fix it run:
sudo -E minikube start --vm-driver=none
Let’s make the fix persistent so it will apply on system bootload:
echo ‘export CHANGE_MINIKUBE_NONE_USER=true’ >> ~/.bashrc
Check that everything works properly:
That’s all for now.
Enjoy the playing with Kubernetes!