How to start a Kubernetes cluster using Minikube

One of the easiest ways to start your first container orchestration cluster with Kubernetes is to use Minikube.

minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes.

All you need is Docker (or similarly compatible) container or a Virtual Machine environment

I will start the tutorial on a fresh Ubuntu 20.04 server running in Proxmox VE. The VM is assigned 4 CPU cores and 8 GB of RAM to allow for future expansion.

I need to make sure Docker is running, as Docker will be used to host the Kubernetes cluster by default, other options include: vmware, kvm, podman and virtualbox.

docker ps

If Docker is not running you can easily install with one command thanks to the Snap store included in Ubuntu distros:

sudo snap install docker

If Docker is installed, but you get permission denied, or you are forced to use sudo to access docker commands, follow this article to fix this issue.

Now, lets download the Debian package for Minikube using the following set of commands:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb

Finally, to start the minikube cluster use the following command:

minikube start

Example Output from the minikube start command:

?  minikube v1.20.0 on Ubuntu 21.04 (kvm/amd64)
✨  Automatically selected the docker driver
?  Starting control plane node minikube in cluster minikube
?  Pulling base image ...
?  Downloading Kubernetes v1.20.2 preload ...
    > preloaded-images-k8s-v10-v1...: 491.71 MiB / 491.71 MiB  100.00% 42.76 Mi
    > gcr.io/k8s-minikube/kicbase...: 358.10 MiB / 358.10 MiB  100.00% 22.63 Mi
    > gcr.io/k8s-minikube/kicbase...: 358.10 MiB / 358.10 MiB  100.00% 16.11 Mi
?  Creating docker container (CPUs=2, Memory=2200MB) ...
?  Preparing Kubernetes v1.20.2 on Docker 20.10.6 ...
    ▪ Generating certificates and keys ...
    ▪ Booting up control plane ...
    ▪ Configuring RBAC rules ...
?  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
?  Enabled addons: storage-provisioner, default-storageclass
?  kubectl not found. If you need it, try: 'minikube kubectl -- get pods -A'
?  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

Great! Minikube started our first Kubernetes cluster on a single host, to verify try issuing any kubectl command, make sure to use minikube kubectl:

minikube kubectl get nodes

Example output of the nodes:

NAME       STATUS   ROLES                  AGE   VERSION
minikube   Ready    control-plane,master   18m   v1.20.2</code></pre>