This document describes the installation of Kubernetes version 1.31.4 on a server with RHEL (Red Hat Enterprise Linux) 9.x operating system.


File to Download

Apinizer version 2025.01.1:
http://fss.apinizer.com/index.php/s/kqiTtY8UB3xZaHx/download

Kubernetes installation files:
http://fss.apinizer.com/index.php/s/1lFs6R41YB80Vom/download
POWERSHELL


sudo tar xvf K8S-1.31-Rhel9.x-Offline.tar
POWERSHELL

ls
#Command to verify that the following files exist.
#required_rpms, kube_rpms, kube-flannel.yml ,mongo_rpms, elasticsearch

# Firewall is turned off
sudo systemctl stop firewalld
sudo systemctl disable firewalld

# Disable SELinux to prevent communication problems on servers.
sudo setenforce 0
sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

# Close swap and delete the swap line in /etc/fstab to prevent it from restarting.
sudo swapoff -a
sudo vi /etc/fstab
POWERSHELL

Installing Containerd PackagesLink to Installing Containerd Packages

yum install -y --cacheonly --disablerepo=* required_rpms/*.rpm --skip-broken
POWERSHELL
#containerd module settings
sudo mkdir -p /etc/containerd   
 
sudo containerd config default | sudo tee /etc/containerd/config.toml
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml
 
 
#initializing and starting the containerd module 
sudo systemctl restart containerd
sudo systemctl enable containerd
systemctl status containerd
POWERSHELL

Installing Kubernetes PackagesLink to Installing Kubernetes Packages

sudo modprobe overlay
sudo modprobe br_netfilter
 
sudo tee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF

sudo vi /etc/sysctl.d/k8s.conf
POWERSHELL
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward=1
net.ipv4.tcp_max_syn_backlog=40000
net.core.somaxconn=40000
net.core.wmem_default=8388608
net.core.rmem_default=8388608
net.ipv4.tcp_sack=1
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_fin_timeout=15
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_moderate_rcvbuf=1
net.core.rmem_max=134217728
net.core.wmem_max=134217728
net.ipv4.tcp_mem=134217728 134217728 134217728
net.ipv4.tcp_rmem=4096 277750 134217728
net.ipv4.tcp_wmem=4096 277750 134217728
net.core.netdev_max_backlog=300000
POWERSHELL
sudo sysctl --system
POWERSHELL
sudo yum install -y --cacheonly --disablerepo=* kube_rpms/*.rpm --skip-broken
POWERSHELL


systemctl enable --now kubelet.service
 
#Kubernetes installation control
kubectl version --client && kubeadm version 
POWERSHELL

Installing Kubernetes ImagesLink to Installing Kubernetes Images

sudo ctr --namespace k8s.io images import kube_images/kube-apiserver-v1.31.4.tar           
sudo ctr --namespace k8s.io images import kube_images/kube-controller-manager-v1.31.4.tar  
sudo ctr --namespace k8s.io images import kube_images/kube-scheduler-v1.31.4.tar           
sudo ctr --namespace k8s.io images import kube_images/kube-proxy-v1.31.4.tar               
sudo ctr --namespace k8s.io images import kube_images/pause-3.10.tar                       
sudo ctr --namespace k8s.io images import kube_images/etcd-3.5.15-0.tar                    
sudo ctr --namespace k8s.io images import kube_images/coredns-v1.11.3.tar                  
sudo ctr --namespace k8s.io images import kube_images/flannel-cni-plugin-v1.6.2.tar        
sudo ctr --namespace k8s.io images import kube_images/flannel-v0.26.4.tar  
POWERSHELL


Although Kubernetes uses pause 3.10, containerd stays at 3.8 and this can cause the cluster not to start during kubeadm init. To fix this, you can change the pause version to 3.10 in the configuration file in /etc/containerd.


Important: Make sure to perform DNS resolution with "nslookup" before initiating with kubeadm.



This node will be chosen as the Kubernetes Control Plane since it is the first node in the cluster.

sudo kubeadm init --pod-network-cidr="10.244.0.0/16" --control-plane-endpoint="<MASTER_SERVER_IP_ADDRESS>" --upload-certs --kubernetes-version=v1.31.4
POWERSHELL
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
POWERSHELL

Creating FlannelLink to Creating Flannel

kubectl apply -f flannel_yaml/kube-flannel.yml
POWERSHELL

Installing Apinizer ImagesLink to Installing Apinizer Images

sudo tar xvf 2025.01.1.tar 
POWERSHELL
sudo ctr --namespace k8s.io images import manager-2025.01.1.tar apinizercloud/manager:2025.01.1
sudo ctr --namespace k8s.io images import worker-2025.01.1.tar apinizercloud/worker:2025.01.1
sudo ctr --namespace k8s.io images import cache-2025.01.1.tar apinizercloud/cache:2025.01.1
sudo ctr --namespace k8s.io images import integration-2025.01.1.tar apinizercloud/integration:2025.01.1
sudo ctr --namespace k8s.io images import portal-2025.01.1.tar apinizercloud/portal:2025.01.1 
POWERSHELL

Installing MongoDBLink to Installing MongoDB

sudo yum install -y --cacheonly --disablerepo=* mongo_rpms/*.rpm --skip-broken
POWERSHELL

Note:  After the installation, the MongoDB configurations are the same as those in the document Installation of MongoDB on Red Hat OS.


Important: Perform the Apinizer installation through the Apinizer Installation and Configuration page.

Elasticsearch InstallationLink to Elasticsearch Installation

sudo mkdir /opt/elasticsearch
 
cd elasticsearch
 
# Move the file inside the offline installation folders.sudo mv elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz /opt/elasticsearch/ 
 
 
cd /opt/elasticsearch
sudo tar -xzf elasticsearch-7.9.2-linux-x86_64.tar.gz
 
#Skip to the Elasticsearch setup document. However, do not proceed with the first four steps in section 2.2.
POWERSHELL

Important: After moving the installation file from its directory to the /opt/elasticsearch/ folder, you can perform the configurations on the Elasticsearch Installation on Red Hat Operating System page.