Containers Linux

How to Install and Use Minikube on a Linux System


In this guide, I will show you how to Install and Use Minikube on a Linux System. Minikube is an open-source program designed to help developers and system administrators run a single Kubernetes cluster on their own computers. With minimal resource usage, Minikube launches a local single-node Kubernetes cluster. For POC and development tests, this is perfect. Here are some related articles: How to Install Kubectl on Windows 11, how to install Redis on a Linux System, How to find Computer Model and Serial Number, and how to use container insights to get the full benefits of Azure Monitor for Azure Kubernetes workload.

This article will show us the driver options and the one that is easiest to use, how to install kubectl and everything we need in order to run a Kubernetes cluster for proof of concept and development test. Other useful articles can be found here: How to Install PlayonLinux on a Linux System and How to install Gradle on Ubuntu and How to Install Apache Subversion on a Linux System also How to install Unison on a Linux System and How to install Rust in a Linux System and How to Install MongoDB on a Linux System

Requirements for running Minikube

Below are the requirements needed to install Minikube

  • Ubuntu 18.04 or higher
  • A user account with sudo privileges, and
  • Command line

Minikube’s features that work with Kubernetes

Below are Mininikube’s features that work with Kubernetes. Here is an article that might interest you “How to Create and monitor Apps using the Azure Kubernetes Service manifest“.

  1. DNS
  2. NodePorts
  3. ConfigMaps and Secrets
  4. Dashboards
  5. Container Runtime: Docker, CRI-O, and containerd
  6. Enabling CNI (Container Network Interface)
  7. Ingress
  8. PersistentVolumes of type hostPath

Step1: Update the system the package index & system

The screenshot for each of the processes is shown below

apt update
package index

APT transport allows the use of repositories accessed via the HTTP Secure protocol (HTTPS), also referred to as HTTP over TLS. It is available by default since apt 1.5 and was available before that in the package apt-transport-HTTPS.

Kindly run the following command to install the APT transport.

sudo apt install apt-transport-https

Kindly run the following command below to upgrade

sudo apt upgrade

After the upgrade, if a reboot is necessary, carry out the procedure.

[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2: Install KVM or Virtualbox driver but preferably Docker

All of the items needed to run KVM on the Ubuntu operating system may be found in the upstream official repository. Use the following commands to install them:

For thevirtualbox driver, please run the command below

sudo apt install virtualbox virtualbox-ext-pack

To install the kvm driver, please run the command below.

sudo apt update
sudo apt -y install qemu-kvm libvirt-dev bridge-utils libvirt-daemon-system libvirt-daemon virtinst bridge-utils libosinfo-bin libguestfs-tools virt-top

Load and enable the modulevhost-net

sudo modprobe vhost_net
sudo lsmod | grep vhost
echo "vhost_net" | sudo tee -a /etc/modules

Enable libvert services

sudo systemctl start libvirtd
sudo systemctl enable libvirtd

Docker driver

Since we will be running Minikube within a VM it would make sense to have docker installed but if you have enabled virtualization in your bios you can choose not to install it because you can choose to use VirtualBox. Personally, I prefer the option of using docker as the preferred driver because, with docker as a driver, you would not need to modify anything in your bios. So, install docker and use the flag when running minikube — — driver=docker.

Here is an official link to the docker website as to how to properly install docker on your system how to install Docker or how to Install Docker Desktop and register GitLab-Runner with Docker-windows executor

After installing docker run the following commands:

systemctl enable docker
systemctl start docker
systemctl status docker

finally, for docker, add your login user to the docker group with the following command:

sudo usermod -aG docker $USER && newgrp docker

sudo usermod -aG docker $USER && newgrp docker

Step 3: Download minikube

Downloading the minikube binary is required. Since the binary is under $PATH, I will place it under the /usr/local/bin directory.

chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube
download minikube

you can check what version has been installed with the command

 minikube version
minikube version

Step 4: Install kubectl on Ubuntu

We require kubectl, a command-line tool for managing and deploying apps on Kubernetes:

curl -LO`curl -s`/bin/linux/amd64/kubectl

Set the binaries for kubectl executable.

chmod +x ./kubectl

The binary should now be in your PATH:

sudo mv ./kubectl /usr/local/bin/kubectl
sudo mv

confirm the version with the command:

kubectl version -o json  --client
kubectl version

Step 5: Starting minikube

Please note that minikube will not run in the root environment and as such you need to switch to your normal logged-in user session.

You can launch minikube now that the components have been installed. The Kubernetes single node cluster’s VM image will be downloaded and configured. You can do that with the command:

minikube start --driver=docker
minikube start

From the screenshot above, we can see that minikube created a Kubernetes cluster for us, we can inspect this by using the command:

kubectl get nodes
view nodes

Next, let’s create a deployment and call the name =techdirectarchive and imagenginx with a tag of latest

kubectl create deployment techdirectarchive --image=nginx:latest
deployment created

As you can see a new deployment called techdirectarchive was created. But we can officially verify this with the command:

kubectl get deployments

Next, let’s expose the service for our techdirectarchive deployment with the command:

kubectl expose deployment techdirectarchive --type=NodePort --port=8080

We can also get the service using the command below:

service types

Now let’s delete the deployment and also the service

kubectl delete deployment techdirectarchive
deployment deleted
kubectl delete service techdirectarchive
service deleted

We can stop minikube with the command:

minikube stop
minikube stop

How to expose a sample deployment

To expose an application deployed in a container, we will need to create a new deployment that is a Kubernetes object. The first thing to do would be to wake minikube up with the command

minikube start --driver=docker
minikube start on ubuntu 22.10

The name of the deployment will be Redis and the image we shall be using is Redis as well.


As we can see from the image above, deployment was successfully created, We can verify this deployment that we just made by running the command:

kubectl get deployments
get deployment

Let’s view the deployment’s details with this command:

kubectl describe deployment redis

After running the command below take a look at the essential actions the cluster made to pull and install the new application. Several lines of output should appear. Note that each message’s age is displayed in the first column; however, the LAST SEEN time does not print out chronologically due to JSON’s lack of order.

kubectl get events
events before eventual creation

Viewing existing items in a usable YAML output is possible. See how redis is currently deployed.

kubectl get deployments redis -o yaml
yaml format

How to Create a New Deployment

We can create a service if we want to view more about our newly created redis container but we will have to change the configuration and add a port. So let’s create a deployment file with the command:

vim deploymentfile.yml

Let’s populate the vim file with data by copying data from a similar file in Kubernetes documentation. Here is a link to it. Please note that we replaced wherever there was nginx with redis and added the section for port, and protocol. A sample is shown below:

apiVersion: apps/v1
kind: Deployment
  name: redis
    app: redis
  replicas: 3
      app: redis
        app: redis
      - name: redis
        image: redis
        - containerPort: 80
          protocol: TCP
yaml file with container port

Remember the reason why we did this was that we could not run the service successfully because the previous deployment had no port and protocol. So now that we have created a YAML file and indicated it, we will use replace to terminate and create a new deployment.

kubectl replace -f deploymentfile.yml

View the Pod and Deployment. Note the AGE shows the Pod was re-created.

kubectl get deploy,pod
kubect get deployments, pods

Now let’s try to expose the resource again. This time it should work.

kubectl expose deployment redis
kubectl expose deployment

Verify the service configuration

kubectl get svc redis
kubectl get service

The Endpoint is provided by kubelet and kube-proxy. Take note of the current endpoint IP

kubectl get ep redis 

Let’s get the IP addresses of all running pods another way by using -o wide

kubectl get pod -o wide
o wide

We can scale from the current number we have to 6 using the command:

kubectl scale deployment redis --replicas=6

Let’s see if the total number of pods have increased by running

Running pods increased to 6

Let’s clean up by deleting our deployment

kubectl delete deployment redis


This tutorial has demonstrated how to install Minikube and the Kubernetes command-line tool kubectl on Ubuntu Linux Machine, the commands should work for any version from 18 and above. In the article, we set up a local Kubernetes cluster with Minikube using the Docker driver on Ubuntu 22.04 LTS.

Additionally, we created a service and a deployment for you to use on your computer to demonstrate the fundamentals of utilizing Kubernetes. You should be able to use Kubernetes and Minikube now.

I hope you found this blog post helpful on how to Install and Use Minikube on a Linux System. Please let me know in the comment section if you have any questions.

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x