In this article we are going to cover How to Install Minikube on CentOS 8 and deploy an app on Kubernetes cluster using Minikube.
Table of Contents
Prerequisites
- A copy of freshly installed CentOS 8 VM
- Minimum of 2 GB RAM and 2 vCPUs
- 20 GB hard disk space
- Root privileges
- A stable internet connection
What is Minikube in Kubernetes ?
Minikube creates a single node cluster inside a VM or Cloud Instance. It is good for beginners to learn Kubernetes since you don’t have to create a master and worker node to create a cluster and we can practice basic Kubernetes functions and can also install the Kubernetes dashboard on it.
Update the system packages on Centos 8
sudo dnf update -y
Execute the commands below to disable SELinux
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
#1.Install docker on Centos 8:
Add docker official Repository in CentOS 8
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Install docker on Centos 8:
dnf install docker-ce --nobest -y
Run following commands to start and enable docker service:
systemctl start docker
systemctl enable docker
Install firewallid on CentOS 8 if you don’t have:
sudo yum install firewalld
start firewalld and enable it to auto-start at system boot, then check its status:
sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo systemctl status firewalld
Set the following firewall rules using firewall-cmd command
firewall-cmd --zone=public --add-masquerade --permanent
firewall-cmd --reload
Install “conntrack” package using following command, conntrack is the dependency for minikube setup:
dnf install conntrack -y
#2.Install kubectl on Centos 8:
Download kubectl binary with curl on Centos using below 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 kubectl binary executable
chmod +x ./kubectl
Move kubectl to /usr/local/bin/kubectl directory
sudo mv ./kubectl /usr/local/bin/kubectl
To check kubectl version on Centos
kubectl version
#3.Download and Install minikube on CentOS 8
Download and Install Minikube on Centos 8 using below commands, To download latest minikube setup refer minikube official download page
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
Make the minikube binary executable:
chmod +x minikube
Move minikube to /usr/local/bin/kubectl directory:
mkdir -p /usr/local/bin/
Install minikube on CentOS 8
install minikube /usr/local/bin/
To check minikube version on CentOS
minikube version
Output:
minikube version: v1.25.1 commit: 3e64b11ed75e56e4898ea85f96b2e4af0301f43d
To start Minikube run the command:
minikube start --driver=none
To Check the status of Minikube
minikube status
Output:
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
To stop a Kubernetes cluster, execute:
minikube stop
To check Minikube cluster information
kubectl cluster-info
Run below command to view cluster nodes:
kubectl get nodes
Output:
NAME STATUS ROLES AGE VERSION centos-s Ready control-plane,master 54s v1.23.1
#4:Deploy an app on Minikube Cluster
Lets create deployment on Minikube cluster:
kubectl create deployment test-minikube --image=k8s.gcr.io/echoserver:1.10
Output:
deployment.apps/test-minikube created
To access test-minikube deployment run the below command:
kubectl expose deployment test-minikube --type=NodePort --port=8080
Output:
service/test-minikube exposed
To check deployment on minikube cluster
kubectl get pod
Output:
NAME READY STATUS RESTARTS AGE test-minikube-6bf648865d-gbxwg 1/1 Running 0 79s
To access service, run the below command:
minikube service test-minikube --url
Output:
http://165.227.192.46:30804
To delete service on minikube cluster using kubectl
kubectl delete service test-minikube
Output:
service "test-minikube" deleted
To delete deployment on minikube cluster using kubectl
kubectl delete deployment test-minikube
Output:
deployment.apps "test-minikube" deleted
To stop minikube cluster
minikube stop
Output:
* Stopping node "minikube" ... * 1 node stopped.
To delete minikube cluster
minikube delete
Conclusion:
In this article we have covered How to Install Minikube on Centos 8 and deploy an app on Kubernetes cluster using Minikube.
Related Articles:
2 thoughts on “How to Install Minikube on CentOS 8”