Build a 2-Node Kubernetes Cluster on Laptop | kubeadm + VirtualBox Step-by-Step

Опубликовано: 15 Май 2026
на канале: TechOps Tutorials
659
21

Learn how to build a 2-node Kubernetes cluster on your laptop using kubeadm and VirtualBox! This step-by-step tutorial is perfect for System Administrators, DevOps engineers, and Kubernetes beginners.

In this video, we’ll cover:

✅ Setting up master and worker nodes on Rocky Linux VMs
✅ Installing containerd and Kubernetes tools (kubeadm, kubelet, kubectl)
✅ Configuring networking, disabling swap & firewall for lab setup
✅ Initializing the control plane and joining the worker node
✅ Installing a pod network (Flannel)
✅ Verifying your cluster with kubectl get nodes

Even if you’re not using Rocky Linux, these steps apply to most Linux distributions with minor adjustments.

💡 Why this tutorial is useful:
Learn real-world cluster setup, not just Minikube
Practice hands-on Kubernetes administration
Prepare for DevOps interviews and Kubernetes certification

📌 Resources & Links:
Rocky Linux VM installation guide: [   • Which Rocky Linux ISO Should You Download?...  ]
Kubernetes official docs: https://kubernetes.io/docs/home/

📚 Chapters
0:00 - 🚀 Intro: Kubernetes Cluster Setup
1:00 - ⚖️ kubeadm vs Minikube
2:26 - 📋 Hardware and Prerequisites
3:47 - 🏗️ Kubernetes Components Explained
5:06 - 🗺️ Cluster Installation Roadmap
6:47 - 💻 Virtual Machine Preparation
9:45 - 🏷️ Configure Hostnames and IPs
14:21 - 📡 Verify Network Connectivity
16:21 - 🛠️ OS Updates and Swap
20:55 - 🧩 Kernel Modules and Sysctl
25:22 - 🕒 Sync System Time
26:16 - 📦 Install Containerd Runtime
31:38 - ⚙️ Install Kubernetes Binaries
32:43 - 🏗️ Initialize Control Plane
34:05 - 🌐 Deploy Pod Networking
34:40 - 🤝 Join the Worker Node
35:25 - ✅ Verify Cluster Status

📌 Watch the Full Kubeadm Labs Playlist:
If you want to continue learning and building real multi-node Kubernetes clusters, check out our full playlist: [   • Kubernetes Real-World Labs (kubeadm)  ]

📌 Key Commands Used :
🔹 Disable Swap (Required for Kubernetes)
sudo swapoff -a
sudo vim /etc/fstab # comment the swap entry

🔹 Load Required Kernel Modules
sudo modprobe overlay
sudo modprobe br_netfilter

echo overlay | sudo tee /etc/modules-load.d/overlay.conf
echo br_netfilter | sudo tee /etc/modules-load.d/br_netfilter.conf

🔹 Kubernetes Networking sysctl Settings (Angle-Bracket Free)

Create config file:
sudo vim /etc/sysctl.d/k8s.conf

Add the following lines:

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1


Apply settings:
sudo sysctl --system

🔹 Install & Configure containerd (Critical)
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/cen...
sudo dnf install -y containerd.io

sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml

⚠️ Important change in config.toml

SystemdCgroup = true
sudo systemctl enable --now containerd

🔹 Install Kubernetes Tools
sudo tee /etc/yum.repos.d/kubernetes.repo

Paste:
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1....
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1....

Then install:

sudo dnf install -y kubelet kubeadm kubectl
sudo systemctl enable kubelet

🔹 Initialize Cluster (MASTER NODE)
sudo kubeadm init \
--apiserver-advertise-address=MASTER_IP \
--pod-network-cidr=10.244.0.0/16

🔹 Configure kubectl (MASTER)
mkdir -p $HOME/.kube
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

🔹 Install Pod Network (Flannel Example)
kubectl apply -f https://raw.githubusercontent.com/fla...

🔹 Join Worker Node to Cluster
sudo kubeadm join MASTER_IP:6443 \
--token TOKEN_VALUE \
--discovery-token-ca-cert-hash sha256:HASH_VALUE

🔹 Verify Cluster
kubectl get nodes

👍 If this video helped you, Like, Subscribe, and hit the bell icon for more hands-on Kubernetes & DevOps tutorials!

#kubernetes #kubeadm #VirtualBox #DevOps #SysAdmin #TechOpsTutorials #KubernetesCluster #Containerd #LinuxTutorial #HandsOnKubernetes