sábado, 20 de enero de 2024

Installing Kubernetes on RHEL 9

 

Hello Guys,

In this post I will show you how to install a Kubernetes cluster on RHEL8.


Let's Start:

Disablle Swapp:

sudo swapoff -a

Configure SELINUX:

sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config


Now we require to load the modules for Kubernetes:


sudo vi /etc/modules-load.d/k8s.conf

overlay

br_netfilter


Enable the modules with the next commands:

sudo modprobe overlay

sudo modprobe br_netfilter


Now the systcl for the Kubernetes services how I show below:


sudo vi /etc/sysctl.d/k8s.conf

net.bridge.bridge-nf-call-iptables  = 1

net.ipv4.ip_forward                 = 1

net.bridge.bridge-nf-call-ip6tables = 1


Load the sysctl into the system:

sudo sysctl --system



export VERSION=1.27


Enable de Repositories to download the Kubernetes software and updates.

sudo curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8/devel:kubic:libcontainers:stable.repo


sudo curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/CentOS_8/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo


Install CRI-O with the next commands.


sudo dnf install cri-o

sudo systemctl enable crio

sudo systemctl start crio

sudo vi /etc/yum.repos.d/kubernetes.repo


[kubernetes] 

name=Kubernetes

baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64

enabled=1

gpgcheck=1

repo_gpgcheck=1

gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

exclude=kubelet kubeadm kubectl


Install Kubernetes this include kubelet, kubeadm and kubectl.


sudo dnf install -y kubelet-1.27.0 kubeadm-1.27.0 kubectl-1.27.0 --disableexcludes=kubernetes

sudo systemctl enable kubelet

sudo systemctl start kubelet


Init the Pod Network


sudo kubeadm init --pod-network-cidr=172.31.17.0/24


Your Kubernetes control-plane has initialized successfully!

Follow the next instructions to finish the configuration:


To start using your cluster, you need to run the following as a regular user:




  mkdir -p $HOME/.kube

  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

  sudo chown $(id -u):$(id -g) $HOME/.kube/config


 


Alternatively, if you are the root user, you can run:


 


  export KUBECONFIG=/etc/kubernetes/admin.conf


 


You should now deploy a pod network to the cluster.

Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:

https://kubernetes.io/docs/concepts/cluster-administration/addons/


 


Then you can join any number of worker nodes by running the following on each as root:


 Use the next command to join workers nodes into the controlplane node.


kubeadm join 172.31.14.12:6443 --token qfpwvd.czh92zzofcfsf69a \

        --discovery-token-ca-cert-hash sha256:21555cb1c89a7bc60c30bc76218167608df64b196a7fee5d87de31e9c5728053






Installing Kubernetes on RHEL 9

  Hello Guys, In this post I will show you how to install a Kubernetes cluster on RHEL8. Let's Start: Disablle Swapp: sudo swapoff -a Co...