Install Minikube on Ubuntu 22.04

M Ferreira
M Ferreira

In a previous post we installed kubectl now we will install minikube.

Minikube creates a VM that will run the Docker containers inside of. Use kubectl to manage the lifespan of these containers apps.

Minikube Diagram

You will need Docker in order to use, or any other flavour of container/virtual manachine manager (Hyperkit, Podman, Virtualbox, VMware Fusion/Workstation, KVM, Hyper-v).

1. Download the minikube binary

In your terminal, make sure you at your home directory. Type $HOME hit enter:

$HOME

Install latest, stable minkikube release on x86-64 Linux

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube

2. Start minikube

minikube start

3. Permission errors

šŸ˜„ minikube v1.28.0 on Ubuntu 22.04 šŸ‘Ž Unable to pick a default driver. Here is what was considered, in preference order: ā–Ŗ docker: Not healthy: "docker version --format {{.Server.Os}}-{{.Server.Version}}" exit status 1: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version": dial unix /var/run/docker.sock: connect: permission denied ā–Ŗ docker: Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker' <https://docs.docker.com/engine/install/linux-postinstall/> šŸ’” Alternatively you could install one of these drivers: ā–Ŗ kvm2: Not installed: exec: "virsh": executable file not found in $PATH ā–Ŗ podman: Not installed: exec: "podman": executable file not found in $PATH ā–Ŗ vmware: Not installed: exec: "docker-machine-driver-vmware": executable file not found in $PATH ā–Ŗ virtualbox: Not installed: unable to find VBoxManage in $PATH ā–Ŗ qemu2: Not installed: exec: "qemu-system-x86_64": executable file not found in $PATH āŒ Exiting due to DRV_NOT_HEALTHY: Found driver(s) but none were healthy. See above for suggestions how to fix installed drivers.

This is permission error while minikube attempts to connect to Docker daemon, to fix run the following commands:

DO NOT RUN DOCKER WITH sudo COMMAND ever.

Docker daemon attack surface

Create a docker group and add your user:

sudo groupadd docker

Add user to the the group

sudo usermod -aG docker $USER

You can also run the following command to activate the changes to groups:

newgrp docker

Then run minikube start again:

minikube start šŸ˜„ minikube v1.28.0 on Ubuntu 22.04 āœØ Automatically selected the docker driver. Other choices: ssh, none šŸ“Œ Using Docker driver with root privileges šŸ‘ Starting control plane node minikube in cluster minikube šŸšœ Pulling base image ... šŸ’¾ Downloading Kubernetes v1.25.3 preload ... > preloaded-images-k8s-v18-v1...: 385.44 MiB / 385.44 MiB 100.00% 11.16 M > gcr.io/k8s-minikube/kicbase: 386.27 MiB / 386.27 MiB 100.00% 8.53 MiB p > gcr.io/k8s-minikube/kicbase: 0 B [________________________] ?% ? p/s 31s šŸ”„ Creating docker container (CPUs=2, Memory=3900MB) ... šŸ³ Preparing Kubernetes v1.25.3 on Docker 20.10.20 ... ā–Ŗ 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 šŸ„ Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

4. Test it out

Run minkube to see the help docs

minikube minikube provisions and manages local Kubernetes clusters optimized for development workflows. Basic Commands: start Starts a local Kubernetes cluster status Gets the status of a local Kubernetes cluster stop Stops a running local Kubernetes cluster delete Deletes a local Kubernetes cluster dashboard Access the Kubernetes dashboard running within the minikube cluster pause pause Kubernetes unpause unpause Kubernetes

Now we can use kubectl cli tools run kubectl get po -A to see the current of kubernetes cluster required to run/operate it.

kubectl get po -A NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-565d847f94-vj8kq 1/1 Running 0 63s kube-system etcd-minikube 1/1 Running 0 76s kube-system kube-apiserver-minikube 1/1 Running 0 76s kube-system kube-controller-manager-minikube 1/1 Running 0 76s kube-system kube-proxy-mw44h 1/1 Running 0 63s kube-system kube-scheduler-minikube 1/1 Running 0 76s kube-system storage-provisioner 1/1 Running 0 75s

5. Interacting with minikube & other helpfull commands

Minikube Dashboard

minikube dashboard

Dashboard

minkube pause
minikube unpause
minikube stop
minikube start
minikube addons list |-----------------------------|----------|--------------|--------------------------------| | ADDON NAME | PROFILE | STATUS | MAINTAINER | |-----------------------------|----------|--------------|--------------------------------| | ambassador | minikube | disabled | 3rd party (Ambassador) | | auto-pause | minikube | disabled | Google | | cloud-spanner | minikube | disabled | Google | | csi-hostpath-driver | minikube | disabled | Kubernetes | | dashboard | minikube | enabled āœ… | Kubernetes | | default-storageclass | minikube | enabled āœ… | Kubernetes | | efk | minikube | disabled | 3rd party (Elastic) | ...

Okay we have established all is working, that's all for now. We will create and deploy an application in the next step.

Stay up to date

Consider keeping up to date with software development and design by signing up to my newsletter.

I will only email you when I make a new post.