Here’s a step-by-step guide to install Kubernetes (K8s) on Red Hat Enterprise Linux (RHEL) 9.5, using kubeadm, the official Kubernetes tool.
✅ Prerequisites
-
Root / sudo access
-
Swap disabled
-
Docker or containerd installed
-
Firewall open for Kubernetes ports
-
Unique hostname, static IP, and DNS resolution for each node
๐ง Step 1: Disable Swap
๐ง Step 2: Set Hostname
Example:
๐ง Step 3: Add Kubernetes Repository
You can change
v1.30
to a specific version if required.
๐ง Step 4: Install kubeadm, kubelet, kubectl
Lock their version to avoid accidental upgrades:
๐ง Step 5: Enable and Start kubelet
๐ง Step 6: Install Container Runtime (Containerd)
Kubernetes no longer supports Docker directly; use containerd.
Generate default config:
Enable Systemd cgroup driver:
Edit /etc/containerd/config.toml
and set:
Then restart containerd:
๐ง Step 7: Enable Kernel Modules and Set Sysctl
๐ฉ Step 8: Initialize Kubernetes Cluster (on Master Node)
After success, copy the admin config:
๐ฉ Step 9: Install Pod Network Add-on (like Calico or Flannel)
Example with Calico:
๐จ Step 10: Join Worker Nodes (optional)
On master, you'll get a kubeadm join
command—copy that and run it on each worker node.
✅ Verify
You should see your master node in Ready
state.
⚠️ Notes
-
Make sure firewall ports (6443, 10250, etc.) are open.
-
If using RHEL with SELinux, ensure it's not interfering.
-
Run
kubeadm reset
if you need to clean and reinstall.