Minikube is a tool to run Kubernetes locally as a single-node cluster, which is very useful for learning and developing. A regular Kubernetes installation needs at least three hosts. The first one will be the Kubernetes Master
, the cluster manager. The rest will be Kubernetes Nodes
, which are responsible for running the workloads.
Installing kubectl
There is a tool called kubectl
for managing Kubernetes clusters. We will install it before, and Minikube installation process will configure it correctly.
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo install kubectl /usr/local/bin/
Check the kubectl status:
$ kubectl version --client
Installing Minikube
Minikube can be installed in a virtual machine or on your host. To keep my host clean, I prefer to use a virtual machine, so I will use Virtualbox because it has a broader user base than KVM. Let’s install it.
$ sudo apt install -y virtualbox
Once having Kubernetes installed, download Minikube and install it.
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ chmod +x minikube
$ sudo install minikube /usr/local/bin/
If not installed yet, an installation process will happen. The --driver
parameter specifies where Minikube will run. You have to change it if you’re going to use a different approach like KVM or Docker. There is a list with all the available drivers.
$ minikube start --driver=virtualbox
Use the argument status
to check Minikube.
$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
You can now start working with Minikube. When you finish your work, you can stop Minikube using stop
argument.
$ minikube stop
From now, you can start Minikube at any time without specifying the driver.
$ minikube start
If you had installed Minikube before, you could get machine does not exist
error when you try to run it. It happens because the local state of Minikube is dirty, so you must clean it.
$ sudo minikube delete
Cheking overall installation
Let’s check now the configuration of kubectl to ensure it’s working with the Minikube environment we installed.
$ kubectl cluster-info
Kubernetes master is running at https://192.168.99.100:8443
KubeDNS is running at https://192.168.99.100:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Ok, it’s working with the server in 192.168.99.100 IP address. Let’s check now if our Minikube server is working with that IP address:
$ minikube ip
192.168.99.100
As a final check, get all the resources of the Minikube master using kubectl:
$ kubectl get all
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 118m
That’s correct. Both Minikube and kubectl are working correctly.
Full sail!
You already have everything you need to navigate the magnificent ocean of Kubernetes. Prepare your course, hold the rudder tight, and don’t go off, buccaneer. See you at the next port. Good winds!