k8s Installation Steps
- RNREDDY

- Sep 1
- 2 min read

create best script without failure nmcli connection modify ens160 ipv4.addresses 192.168.1.15/24
nmcli connection modify ens160 ipv4.gateway 192.168.1.1
nmcli connection modify ens160 ipv4.dns "192.168.1.1"
nmcli connection modify ens160 ipv4.method manual
nmcli connection down ens160
nmcli connection up ens160
nmcli device show ens160
grep -q "192.168.1.18" /etc/hosts || echo "192.168.1.18 k8s-master" | sudo tee -a /etc/hosts
grep -q "192.168.1.15" /etc/hosts || echo "192.168.1.15 k8s-node1" | sudo tee -a /etc/hosts
grep -q "192.168.1.19" /etc/hosts || echo "192.168.1.19 k8s-node2" | sudo tee -a /etc/hosts
Each line checks if the entry exists, and only adds it if not found.
Uses sudo tee -a /etc/hosts to append with root permissions.
update the system
df -y update
systemctl stop firewalld
systemctl disable firewalld
swapoff -a
sed -i '/swap/d' /etc/fstab
setenforce 0
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
Enable Kernel Modules
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
Set Required sysctl Parameters
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sudo sysctl --system
Verify
lsmod | grep overlay
lsmod | grep br_netfilter
Step-by-Step: Install containerd on RHEL 9
sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
Add Docker's official repository (provides containerd)
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install containerd.io
dnf install -y containerd.io
Generate the default config and modify it (optional but recommended)
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml > /dev/null
Set containerd to use systemd cgroup driver (required for Kubernetes)
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
Enable and start containerd
sudo systemctl daemon-reexec
sudo systemctl enable --now containerd
Verify
containerd --version
sudo systemctl status containerd
Create a kubernetes repo
#vi /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
enabled=1
gpgcheck=1
exclude=kubelet kubeadm kubectl
#dnf update -y
Now installa kubernetes packages
dnf install -y kubelet kubeadm kubectl --disableexcludes=Kubernetes
Now start the service
sudo systemctl enable --now kubelet



Comments