How to Install Minikube on Ubuntu 22.04 | 20.04

In this article, we will cover how to install of Minikube on Ubuntu 22.04 | 20.04 LTS.

Minikube is an open-source tool that allows you to run a single-node Kubernetes cluster locally on your machine.Minikube is designed to make it easy for developers to set up a Kubernetes environment for local development and testing purposes. It creates a lightweight, isolated Kubernetes cluster that runs inside a virtual machine (VM) on your local system.

Minikube System Requirements

  • 2 GB RAM or more
  • 2 CPU / vCPU or more
  • 20 GB free hard disk space or more
  • Docker / Virtual Machine Manager – KVM & VirtualBox

Note: In this article, we will be using Docker container as a base for minikube. In case, docker is not installed on your Ubuntu system then use following URL to install it.

Prerequisites for minikube

  • Pre-Installed Ubuntu 22.04 / 20.04
  • Sudo User with admin privileges
  • Stable Internet Connection

Without any further delay, let’s deep dive into the Minikube Installation steps on Ubuntu 22.04 and 20.04 LTS.

1) Apply updates

Apply all updates of existing packages of your system by executing the following apt commands,

$ sudo apt update -y
$ sudo apt upgrade -y

Once all the updates are installed then reboot your system once.

$ sudo reboot

2) Install Minikube dependencies

Install the following minikube dependencies by running beneath command,

$ sudo apt install -y curl wget apt-transport-https

3) Download Minikube Binary

Use the following curl command to download latest minikube binary,

$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

Once the binary is downloaded, copy it to the path /usr/local/bin and set the executable permissions on it

$ sudo install minikube-linux-amd64 /usr/local/bin/minikube

Verify the minikube version

$ minikube version
minikube version: v1.30.1
commit: 08896fd1dc362c097c925146c4a0d0dac715ace0
$

Note: At the time of writing this tutorial, latest version of minikube was v1.30.1.

4) Install Kubectl utility

Kubectl is a command line utility which is used to interact with Kubernetes cluster. It is used for managing deployments, service and pods etc. Use below curl command to download latest version of kubectl.

$ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

Once kubectl is downloaded then set the executable permissions on kubectl binary and move it to the path /usr/local/bin.

$ chmod +x kubectl
$ sudo mv kubectl /usr/local/bin/

Now verify the kubectl version

$ kubectl version -o yaml

kubectl-version-check-minikube-ubuntu

5) Start minikube

As we are already stated in the beginning that we would be using docker as base for minikue, so start the minikube with the docker driver, run

$ minikube start --driver=docker

In case you want to start minikube with customize resources and want installer to automatically select the driver then you can run following command,

$ minikube start --addons=ingress --cpus=2 --cni=flannel --install-addons=true --kubernetes-version=stable --memory=6g

Output would like below,

minikube-start-driver-docker-ubuntu

Perfect, above confirms that minikube cluster has been configured and started successfully.

Run below minikube command to check status,

pkumar@linuxtechi:~$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
pkumar@linuxtechi:~$

Run following kubectl command to verify the Kubernetes version, node status and cluster info.

$ kubectl cluster-info
$ kubectl get nodes

Output of above commands would like below:

Kubectl-cluster-info-minikube-Ubuntu

6) Managing Addons on minikube

By default, only couple of addons are enabled during minikube installation, to see the addons of minikube, run the below command.

$ minikube addons list

Minikube-addons-Ubuntu-22-04

If you wish to enable any addons run the below minikube command,

$ minikube addons enable <addon-name>

Let’s assume we want to enable and access kubernetes dashboard , run

$ minikube dashboard

It will open the Kubernetes dashboard in the web browser.

Minikube-Dashboard-Ubuntu-22-04

Kubernetes-Dashboard-Ubuntu

To enable Ingress controller addon, run

$ minikube addons enable ingress

Enable-Ingress-Addon-Minikube-Ubuntu

7) Verify Minikube Installation

To verify the minikube installation, let’s try to deploy nginx based deployment.

Run below kubectl command to install nginx based deployment.

$ kubectl create deployment my-nginx --image=nginx

Run following kubectl command to verify deployment status

$ kubectl get deployments.apps my-nginx
$ kubectl get pods

Output of above commands would look like below:

Nginx-based-deployment-k8s

Expose the deployment using following command,

$ kubectl expose deployment my-nginx --name=my-nginx-svc --type=NodePort --port=80
$ kubectl get svc my-nginx-svc

Use below command to get your service url,

$ minikube service my-nginx-svc --url
http://192.168.49.2:31895
$

Now try to access your nginx based deployment using above url,

$ curl http://192.168.49.2:31895

Output,

Curl-nginx-deployment-testing

Great, above confirms that NGINX application is accessible.

8) Managing Minikube Cluster

To stop the minikube, run

$ minikube stop

To delete the minikube, run

$ minikube delete

To Start the minikube, run

$ minikube start

In case you want to start the minikube with higher resource like 8 GB RM and 4 CPU then execute following commands one after the another.

$ minikube config set cpus 4
$ minikube config set memory 8192
$ minikube delete
$ minikube start

That’s all from this tutorial, I hope you have learned how to install Minikube on Ubuntu 22.04 & 22.04. Please don’t hesitate to share your feedback and comments.

Also Read: How to Configure Static IP Address on Ubuntu 22.04 LTS

15 thoughts on “How to Install Minikube on Ubuntu 22.04 | 20.04”

  1. Very detailed installation and setup about minikube. This helped me lot to run minikube on ubuntu Hypervision.
    Thanks a lot for stepwise detail explanation. please also add either do we also need to install docker and drivers,podman,vmware separately?

    I got these below errors before setup is completed.

    raj@raj1:~/Desktop$ minikube start –driver=docker
    minikube v1.27.1 on Ubuntu 20.04 (hyperv/amd64)
    ✨ Using the docker driver based on user configuration

    Exiting due to PROVIDER_DOCKER_NOT_FOUND: The ‘docker’ provider was not found: exec: “docker”: executable file not found in $PATH
    Suggestion: Install Docker
    Documentation: ‘https://minikube.sigs.k8s.io/docs/drivers/docker/’

    raj@raj1:~/Desktop$ minikube start –addons=ingress –cpus=2 –cni=flannel –install-addons=true –kubernetes-version=stable –memory=6g
    minikube v1.27.1 on Ubuntu 20.04 (hyperv/amd64)
    Unable to pick a default driver. Here is what was considered, in preference order:
    Alternatively you could install one of these drivers:
    ▪ docker: Not installed: exec: “docker”: executable file not found in $PATH
    ▪ kvm2: Not installed: exec: “virsh”: executable file not found in $PATH
    ▪ vmware: Not installed: exec: “docker-machine-driver-vmware”: executable file not found in $PATH
    ▪ podman: Not installed: exec: “podman”: 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_DETECTED: No possible driver was detected. Try specifying –driver, or see ‘https://minikube.sigs.k8s.io/docs/start/’

    Reply
  2. Installed on my Oracle VM ( ARM64) and worked perfectly. I have just to change the AMD64 commands to ARM64 and voila, it’s working. Good tutorial, thanks !

    Reply
      • Curl command will download minikube-linux-amd-64 file in your present working directory, you just move that file to /usr/local/minikube and it will work

        Reply
  3. One of the very simple and detailed tutorial. You are supposed to be Kubernetess guru !!!
    Thanks from my heart dear !!

    Reply
    • Hi Amy,
      To uninstall minikube,
      first stop the minikube using following command,
      $ minikube stop

      Now delete using,
      $ minikube delete

      I hope, it helps.

      Reply
  4. Thanks for a great doc. minikube is now installed successfully on Ubuntu host server. so may question is how do I reach Kubernetes dashboard from outside Ubuntu host server; ‘http://127.0.0.1:44543/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/’

    Reply

Leave a Comment