kubernetes is one of the technologies that have immensely been adopted by organizations in the past years. This is due to the fact that it allows organizations to build and modernize their applications for the cloud.

Kubernetes is an open-source orchestration tool that plays a big role in running containerized workloads across a cluster of hosts. This is achieved by distributing the workloads across the cluster and automating the container networking needs.

There are several tools that can be used to create a Kubernetes cluster on Linux. Among the most preferred tools is Minikube. This is an open-source virtual machine-based tool that provides the easiest and most effective way to get started with Kubernetes. It helps one to quickly set up a single-node Kubernetes cluster on their home workstation. Minikube can help one get familiar with and practice Kubernetes concepts without struggling. It provides a command-line-based as well as a web UI where you can run cluster operations such as starting, stopping, and deleting nodes from the Cluster e.t.c.

The features of Minikube include:

  • It runs on Windows, Linux, and macOS.
  • It supports the latest Kubernetes release
  • It supports multiple container runtimes i.e Containerd, KVM, Docker, Podman e.t.c
  • It has supports for advanced features such as Load balancing, Featuregates, and filesystems mounts.
  • Ingress- API with rules that dictates access to services in a cluster.
  • NodePorts and DNS
  • ConfigMaps and Secrets

This guide aims to help you install Minikube Rocky Linux 9 and create a Kubernetes cluster.

Setup Pre-requisites

To be able to run Kubernetes using Minikube, you need a system that meets the below specifications:

  • 2 CPUs or more
  • Minimum 2GB of Physical Memory (RAM).
  • 20GB of Disk Space.
  • Container or virtual machine manager such as Docker, KVM, Podman, Virtual Box e.t.c.
  • Internet connection.

#1. Install KVM / VirtualBox Hypervisor on Rocky Linux 9

As stated earlier, Minikube supports a number of Container or virtual machine managers. In this guide, we will be using KVM / VirtualBox.

Using Minikube with KVM Hypervisor

Install KVM on Rocky Linux using the aid of the guide below:

Validate the installation:

$ lsmod | grep kvm
kvm_intel             364544  0
kvm                  1056768  1 kvm_intel
irqbypass              16384  1 kvm

Also, validate that libvirt reports no errors:

$ virt-host-validate
  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : PASS
  QEMU: Checking for cgroup 'blkio' controller support                       : PASS

Add the system user to the KVM group in order to execute commands without sudo

sudo usermod -aG libvirt $USER
newgrp libvirt

Using Minikube with VirtualBox Hypervisor

Install VirtualBox on Rocky Linux 9 using the aid of the guide below:

Ensure Nested virtualization is enabled on your system.

#2. Install kubectl on Rocky Linux 9

kubectl provides an easy way you manage the Kubernetes cluster. It can be installed on Rocky Linux 9 using the command:

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

Make the file executable:

chmod +x kubectl

More the file to your $PATH:

sudo mv kubectl /usr/local/bin/

Validate the installation.

$ kubectl version --client -o json
{
  "clientVersion": {
    "major": "1",
    "minor": "25",
    "gitVersion": "v1.25.0",
    "gitCommit": "a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2",
    "gitTreeState": "clean",
    "buildDate": "2022-08-23T17:44:59Z",
    "goVersion": "go1.19",
    "compiler": "gc",
    "platform": "linux/amd64"
  },
  "kustomizeVersion": "v4.5.7"
}

#3. Install Minikube on Rocky Linux 9

Once the container or virtual machine manager has been installed, Minikube can be installed on Rocky Linux 9. First, download the Minikube package:

wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube

Also, download the required Docker drivers for KVM

wget https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2

Make the files executable:

chmod +x minikube docker-machine-driver-kvm2

Move the files to your $PATH:

sudo cp minikube docker-machine-driver-kvm2 /usr/local/bin/

Verify Minikube installation on Rocky Linux 9:

$ minikube version
minikube version: v1.26.1
commit: 62e108c3dfdec8029a890ad6d8ef96b6461426dc

#4. Run Kubernetes on Minikube

Now Minikube Kubernetes can be started by specifying the driver to be used:

# With VirtualBox Driver
minikube start --driver=virtualbox

# With KVM2 Driver
minikube start --driver=kvm2

Alternatively, you can set the default driver and then start Minikube as shown: