In this post, we will cover how to install minikube on RHEL 8, Rocky Linux 8 or AlmaLinux 8 step by step.

Minikube is a cross-platform and open-source tool that makes it possible for you to deploy a single-node Kubernetes cluster on your local machine.

Kubernetes, also known as k8s or simply as Kube, is an open-source container orchestration platform used for the automation scaling and deployment of containers.Minikube cluster helps developers and admins to build their test environment in minikube cluster.

Prerequisites of MiniKube

  • Minimal Installed RHEL 8 or Rocky Linux 8 or AlmaLinux 8
  • Locally Configured Repo or Subscription for RHEL 8.
  • Minimum of 2 GB RAM and 2 vCPUs
  • 20 GB hard disk space
  • Sudo User with admin
  • A stable internet connection
  • Docker or virtual machine manager like VirtualBox, KVM,and VMware etc.

In this post, we will be using docker as driver for minikube. With all the prerequisites met, it’s time now to roll up our sleeves and get our hands dirty.

Step 1) Enable Official Docker Repository

To enable docker official repository run,

$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
$ sudo dnf repolist

Enable-Docker-Repo-RHEL8-Rocky-Linux8

Step 2) Install Docker CE (Community Edition)

Run the following dnf command to install docker and its dependencies,

$ sudo dnf install docker-ce docker-ce-cli containerd.io -y

output,

Install-Docker-DNF-Command-RHEL8-RockyLinux8

Once docker is installed the start and enable it’s service, run following systemctl commands,

$ sudo systemctl start docker
$ sudo systemctl start docker

Allow your local user to run docker commands without sudo, run

$ sudo usermod -aG docker $USER
$ newgrp docker

Step 3) Install Kubectl Binary

Kubectl is a command-line tool which interacts with Kubernetes cluster via APIs. Using kubectl we deploy our applications as deployment. By default, kubectl is not included in RHEL 8 , Rocky Linux 8 or AlmaLinux 8 package repositories. Therefore, we are going to manually install it using beneath commands,

$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ sudo cp kubectl /usr/local/bin/ && sudo chmod +x /usr/local/bin/kubectl
$ kubectl version --client

Output of above commands would be something like below,

Download-Kubectl-Binary-RHEL8-RockyLinux8

Step 4) Download MiniKube Binary and Start Cluster

After installing the kubectl, let’s download and install minikube binary using the following commands,

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

Now start minikube cluster using the beneath command,

$ minikube start --driver docker

Start-Minikube-Cluster-RHEL8-Rocky-Linux8

Output above confirms that minikube command has started the single node Kubernetes cluster using docker as driver.

Run below minikube command to verify the status of your local Kubernetes cluster,

[sysops@localhost ~]$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[sysops@localhost ~]$
[sysops@localhost ~]$ minikube ip
192.168.49.2
[sysops@localhost ~]$

To stop stop the minikube cluster, execute,

$ minikube stop

Execute the “kubectl” commands to view cluster and node information

$ kubectl cluster-info
$ kubectl get nodes

K8s-cluster-info-RHEL8-RockyLinux9

Step 5) Test and Verify Kubernetes Cluster

To test Kubernetes cluster, let try to create k8s deployment using echo server image, it is equivalent to http web server and expose it as a service on port 8080,

[sysops@localhost ~]$ kubectl create deployment test-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/test-minikube created
[sysops@localhost ~]$

To access test-minikube deployment, expose it as service, run the following command,

[sysops@localhost ~]$ kubectl expose deployment test-minikube --type=NodePort --port=8080
service/test-minikube exposed
[sysops@localhost ~]$

Run below kubectl command to get deployment,pods and service  information for above created deployment,

$ kubectl get deployment,pods,svc

Kubectl-get-pods-deplyments-service-rhel8-rocky-linux8

To access service, get its url by running the beneath command.

[sysops@localhost ~]$ minikube service test-minikube --url
http://192.168.49.2:32291
[sysops@localhost ~]$
[sysops@localhost ~]$ curl http://192.168.49.2:32291/

Access-Application-minikube-rhel8-rockylinux8

Great, it means our Kubernetes cluster is working fine as we are able to access our sample application.

Step 6) Enable MiniKube Addons

Minikube offers addons which can add additional functionality to our clusters. To list all available addons run,

$ minikube addons list

minikube-addons-list-rhel8-rockylinux8

Kubernetes ships with a dashboard that allows you to manage your cluster. In Minikube, dashboard has been added as an addons. So to enable it, run

$ minikube addons enable dashboard

Also to enable nginx ingress controller, run

$ minikube addons enable ingress

Enable-Minikube-addons-RHEL8-RockyLinux9

To access the dashboard, run

$ minikube dashbaord --url

This will start the dashboard in your systems’s web vrowser.

Kubernetes-Dashboard-MiniKube-Dashboard

And that’s just about it. We have managed to successfully install Kubernetes with Minikube on RHEL 8, Rocky Linux 8 or AlmaLinux 8. You are welcome to share your feedback and comments in below comments section.

Also Read : How to Configure NFS based Persistent Volume in Kubernetes

The post How to Install MiniKube on RHEL 8/Rocky Linux 8/AlmaLinux 8 first appeared on .

Leave a Comment