TranslateProject/sources/tech/20230308.2 ⭐️⭐️ How to Install MiniKube on RHEL 8Rocky Linux 8AlmaLinux 8.md
2023-03-13 08:52:34 +08:00

6.2 KiB
Raw Blame History

How to Install MiniKube on RHEL 8/Rocky Linux 8/AlmaLinux 8

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

Minikubeis 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 k8sor 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, its 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

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,

Once docker is installed the start and enable its 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,

Step 4) Download MiniKube Binary and Start Cluster

After installing the kubectl, lets 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

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,

[[email protected] ~]$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
[[email protected] ~]$
[[email protected] ~]$ minikube ip
192.168.49.2
[[email protected] ~]$

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

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,

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

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

[[email protected] ~]$ kubectl expose deployment test-minikube --type=NodePort --port=8080
service/test-minikube exposed
[[email protected] ~]$

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

$ kubectl get deployment,pods,svc

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

[[email protected] ~]$ minikube service test-minikube --url
http://192.168.49.2:32291
[[email protected] ~]$
[[email protected] ~]$ curl http://192.168.49.2:32291/

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

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

To access the dashboard, run

$ minikube dashbaord --url

This will start the dashboard in your systemss web vrowser.

And thats 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


via: https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/

作者:Pradeep Kumar 选题:lkxed 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出