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.
No comments:
Post a Comment