How to Install kubeadm and Set Up a Multi-Node Kubernetes Cluster

kubeadm is the official tool for bootstrapping a standard, full-featured Kubernetes cluster. This guide covers setting up a cluster with one control-plane node and one or more worker nodes across separate VPS instances.

Architecture Overview

Control Plane Node (runs the API server, scheduler, etc.)
Worker Node 1 (runs your actual application Pods)
Worker Node 2 (runs your actual application Pods)

Prerequisites (All Nodes)

  • Ubuntu 22.04/24.04 VPS, 2 vCPU / 2 GB RAM minimum per node
  • Unique hostname per node
  • Private networking between nodes, ideally (see How to Set Up a Site-to-Site VPN Between Two VPS Servers if nodes are on different providers)

Step 1 — Disable Swap (Required on All Nodes)

sudo swapoff -a
sudo sed -i '/swap/d' /etc/fstab

Kubernetes requires swap disabled for predictable resource management.

Step 2 — Install a Container Runtime (All Nodes)

See How to Install Docker Engine on Ubuntu & Debian, then install containerd (Kubernetes' preferred runtime interface):

sudo apt install containerd -y
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
sudo systemctl restart containerd

Step 3 — Install kubeadm, kubelet, and kubectl (All Nodes)

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

Check the current stable Kubernetes minor version and adjust the URL accordingly.

Step 4 — Initialize the Control Plane (Control Plane Node Only)

sudo kubeadm init --pod-network-cidr=10.244.0.0/16

Save the kubeadm join command printed at the end — you'll need it for worker nodes.

Step 5 — Configure kubectl Access (Control Plane Node)

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

Step 6 — Install a Pod Network Add-on (Control Plane Node)

kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml

Flannel is a simple, widely-used network overlay; other options (Calico, Cilium) offer more advanced features if needed later.

Step 7 — Join Worker Nodes to the Cluster

On each worker node, run the exact kubeadm join command saved from Step 4:

sudo kubeadm join CONTROL_PLANE_IP:6443 --token TOKEN --discovery-token-ca-cert-hash sha256:HASH

Step 8 — Verify All Nodes Joined

kubectl get nodes

All nodes should eventually show Ready once the network add-on finishes initializing.

Regenerating the Join Token (If Lost or Expired)

kubeadm token create --print-join-command

Common Errors

"connection refused" during kubeadm init — verify containerd is running (sudo systemctl status containerd) before initializing.

Nodes stuck in "NotReady" — almost always means the pod network add-on hasn't been applied or hasn't finished initializing; verify Step 6 completed successfully.

Worker join fails with a certificate error — the join token likely expired (tokens are valid for 24 hours by default); generate a new one per the command above.

Best Practices

  • Use k3s instead if you don't specifically need the full upstream distribution — it's considerably simpler to operate
  • Keep the control plane node's resources dedicated to cluster management, not application workloads, in production setups
  • Secure the API server port (6443) and restrict access appropriately

Continue Reading

Browse more articles in Kubernetes & Container Orchestration.

  • kubeadm, multi node kubernetes, kubernetes cluster setup, kubernetes control plane
  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

What Is Kubernetes and When Do You Need It on a VPS?

Kubernetes is a container orchestration platform — it automates deploying, scaling, and...

How to Install a Single-Node Kubernetes Cluster with k3s

k3s is a lightweight, certified Kubernetes distribution designed to run efficiently on modest...

Kubernetes Pods, Deployments & Services Explained

Understanding these three core Kubernetes objects — Pods, Deployments, and Services —...

How to Expose Applications with a Kubernetes Ingress Controller (Nginx Ingress)

An Ingress lets you route external HTTP/HTTPS traffic to multiple services within your cluster...

How to Manage Persistent Storage in Kubernetes (PersistentVolumes & PVCs)

Containers are ephemeral by design — data written inside them disappears when the Pod is...