Friday, June 14, 2024

Introduction to Kubernetes and Installation on Red Hat Linux



Introduction to Kubernetes






Kubernetes, often abbreviated as K8s, is a powerful open-source platform designed to automate deploying, scaling, and operating application containers. Here's a quick overview of its key concepts:

  • Nodes: Individual servers in the Kubernetes architecture.
  • Cluster: A group of nodes working together.
  • Pods: The smallest deployable units in Kubernetes, which run containers on nodes.

Master Components of Kubernetes

The Kubernetes master components manage the cluster and its workload:

  • API Server: Provides the CLI and RESTful API interface for interaction.
  • Scheduler: Assigns nodes to newly created pods.
  • ETCD: A key-value store that holds the entire cluster's state, including nodes and pods.
  • Control Manager: Ensures the desired state of the cluster is maintained.

Worker Node Components

Worker nodes run the applications and perform the following functions:

  • Kubelet: Ensures that containers are running in pods.
  • Kube Proxy: Manages network rules to enable communication with pods.
  • Container Runtime: Runs the containers.

Kubernetes Installation on Red Hat Linux

Step 1: Install Kubectl

 1. Update the Repository:

command: "cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.30/rpm/repodata/repomd.xml.key
EOF
"

2. Install Kubectl:

command: sudo yum install -y kubectl

3. Verify Installation:

command: kubectl version --client




Step 2: Install Minikube

Minikube is a tool that makes it easy to run Kubernetes locally, ideal for learning and development purposes.

1. Download Minikube:

command: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.aarch64.rpm

2. Install Minikube:

command: sudo rpm -Uvh minikube-latest.aarch64.rpm

3. Start Minikube:

command: minikube start




Handling Sudo User Permission Errors

If you encounter permission errors as a sudo user, follow these steps

 - Switch User:

if you are logged in as a sudo user switch to any other use or create a new user I have user Danish already

command: su - username

 - Add User to Docker Group:

command: sudo usermod -aG docker $USER && newgrp docker

after adding this user to the group now start the minikube again 


 - Edit the Sudoers File
(if still getting error):

  • Use visudo to add your user, ensuring proper permissions
  • After resolving permissions, run: minikube start




Check Minikube Status:

To check the status of the running status of the minikube run the following command
command: minikube status



By following these steps, you can effectively set up and manage a Kubernetes environment on Red Hat Linux. This guide should help you get started with Kubernetes, providing a strong foundation for further exploration and learning.

Previous Post
Next Post

post written by:

0 comments: