Minikube is a free and open-source tool that allow us to setup a single node Kubernetes cluster locally on our system. Minikube is only used for learning Kubernetes and allow developers to build their test environment locally on their system.
In this post, we will show you how to install Minikube on Rocky Linux 9 step by step. To begin its installation, make sure following system requirements are met.
- Minimal Install Rocky Linux 9
- 2 GB free RAM or more
- 2 CPUs or more
- 25 GB free disk space
- Local user with sudo admin rights
- Internet connectivity
- Docker or virtual machine manager like VirtualBox, KVM,and VMware etc.
Without any further delay, let’s jump into the actual steps,
1) Enable Docker Repository
Open the terminal and run following dnf command,
$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Run following dnf command to verify whether docker registry is enabled or not.
$ sudo dnf repolist
2) Install Docker CE (Community Edition)
Install docker ce along with all dependencies using beneath command,
$ sudo dnf install docker-ce docker-ce-cli containerd.io -y
Add your local user to docker group so that it can run docker commands without sudo,
$ sudo usermod -aG docker $USER $ newgrp docker
Start the docker service, run
$ sudo systemctl start docker $ sudo systemctl enable docker
To verify the docker installation, run following docker container,
$ docker run hello-world
Output,
Output above confirms that docker has been installed successfully.
3) Download and Install Minikube and kubectl binary
To download and install minikube binary, run following commands,
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 $ sudo install minikube-linux-amd64 /usr/local/bin/minikube
Install kubectl binary, run 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
4) Start the minikube cluster
To start the minikube cluster with docker as driver, run
$ minikube start --driver docker
Output
Perfect, above output confirms that minikube cluster has been started successfully. Let’s try to interact with cluster and deploy sample application,
Execute the following set of commands to view minikube status, Kubernetes cluster and node info,
$ minikube status $ kubectl cluster-info $ kubectl get nodes
5) Test Kubernetes by Deploying Sample Nginx Application
To deploy sample nginx based application, run following kubectl commands,
$ kubectl create deployment nginx-demo --image=nginx $ kubectl expose deployment nginx-demo --type NodePort --port=80
Verify pods and service status, run
$ kubectl get pods,svc
Try accessing the application using following command,
$ minikube service nginx-demo --url http://192.168.49.2:31707 $ curl http://192.168.49.2:31707
Great, output above confirms that we are able to access nginx based sample application.
6) Managing Minikube Addons
Using minikube addons, we can enable additional functionality to our cluster like Kubernetes dashboard and nginx ingress controller. To view all available addons, run
$ minikube addons list
To enable addons like dashboard and ingress controller, run following minikube commands,
$ minikube addons enable dashboard $ minikube addons enable ingress
Output,
7) Managing Minikube Cluster
Stop and start minikube cluster, run
$ minikube stop $ minikube start
Run following command to delete minikube cluster,
$ minikube delete
Set the custom resources to minikube
$ minikube config set memory 4096 $ minikube stop && minikube start
That’s all from this post, I hope you have found it informative. Please do post your queries and feedback in below comments section.
Also Read: How to Install Minikube on Ubuntu 22.04 / 20.04 LTS