Running a single Docker host is fine for experiments, but production workloads need scheduling, self-healing, and scaling across several machines. The standard way to get all of that is to install a Kubernetes cluster with kubeadm on Ubuntu. kubeadm is the official bootstrapping tool maintained by the Kubernetes project: it initializes a control plane, generates the certificates and join tokens, and lets you add worker nodes with a single command. In this guide you will build a three-node cluster (one control plane, two workers) on Ubuntu 24.04, install the Calico network plugin, and deploy a test application to prove everything works.
If you only need a throwaway cluster on your laptop, a tool such as Minikube or kind is quicker — see our guide on how to install Minikube on Ubuntu. But when you want to learn how real clusters are assembled, learning to install a Kubernetes cluster with kubeadm on Ubuntu is the right investment.
Prerequisites for Installing Kubernetes Cluster with kubeadm on Ubuntu – How to Install a Kubernetes Cluster
- Three servers or virtual machines running Ubuntu 24.04 LTS (the steps also work on 22.04).
- Minimum 2 vCPU and 2 GB RAM per node; 4 GB RAM is recommended for the control plane.
- A container runtime. We will install containerd from the Ubuntu repositories.
- Root or sudo access on every node, plus a static IP or resolvable hostname for each machine.
- Swap disabled — the kubelet refuses to run correctly with swap on.
Step 1: Prepare Every Node – How to Install a Kubernetes Cluster
Run the following commands on all three nodes. First disable swap and make sure the required kernel modules and sysctl values are loaded:
sudo swapoff -a
sudo sed -i '/ swap / s/^/#/' /etc/fstab
cat <
Install containerd
Kubernetes no longer talks to Docker directly; it uses any CRI-compatible runtime. containerd is the most common choice:
sudo apt update
sudo apt install -y containerd
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null
sudo sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
sudo systemctl restart containerd
sudo systemctl enable containerd
Setting SystemdCgroup = true is important: it aligns containerd with the systemd cgroup driver that the kubelet uses, and avoids a common source of instability.
Step 2: Install kubeadm, kubelet, and kubectl
Still on every node, add the official Kubernetes apt repository and install the three tools:
sudo apt install -y apt-transport-https ca-certificates curl gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.31/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.31/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
The apt-mark hold prevents an unattended upgrade from bumping the cluster components to a mismatched version.

Step 3: Initialize the Control Plane with kubeadm
On the control plane node only, initialize the cluster. We reserve the 192.168.0.0/16 range for pod networking, which is Calico's default:
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
When it finishes, kubeadm prints a kubeadm join command with a token and a certificate hash. Save it — you will use it in step 5. Then configure kubectl for your regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get nodes
The control plane will show as NotReady for now, because no CNI (network) plugin is installed yet.
Step 4: Install the Calico Network Plugin
Pods cannot communicate until a Container Network Interface plugin is present. Apply Calico:
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.2/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.2/manifests/custom-resources.yaml
Wait a couple of minutes and check that the control plane becomes Ready with kubectl get nodes.
Step 5: Join the Worker Nodes
On each worker, run the join command from step 3 (as root). It looks like this:
sudo kubeadm join 192.168.1.10:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Back on the control plane, verify the cluster:
kubectl get nodes
NAME STATUS ROLES AGE VERSION
control-1 Ready control-plane 12m v1.31.x
worker-1 Ready <none> 3m v1.31.x
worker-2 Ready <none> 2m v1.31.x
Step 6: Deploy a Test Application
Prove the cluster works by deploying NGINX and exposing it:
kubectl create deployment nginx --image=nginx --replicas=3
kubectl expose deployment nginx --port=80 --type=NodePort
kubectl get pods -o wide
kubectl get svc nginx
Note the NodePort (a port in the 30000-32767 range) and open http://<any-node-ip>:<nodeport> in a browser. You should see the NGINX welcome page.
Troubleshooting a kubeadm Installation
- kubeadm init fails with swap errors: you forgot
swapoff -aor the fstab entry on that node. - Nodes stay NotReady: the CNI plugin is missing or its pods are crashing. Check
kubectl get pods -n calico-system. - Join token expired: tokens last 24 hours. Create a new one with
kubeadm token create --print-join-command. - Pods stuck in Pending: often the pod CIDR overlaps your LAN. If your LAN uses 192.168.0.0/16, pick a different pod CIDR at init time and adjust Calico to match.
- kubectl connection refused: the kubeconfig was copied for root only, or the API server is down — inspect it with
sudo crictl psandjournalctl -u kubelet.
Conclusion
You now know how to install a Kubernetes cluster with kubeadm on Ubuntu: prepare the nodes, install containerd, add the Kubernetes packages, initialize the control plane, install Calico, and join workers. From here you can explore workloads with our kubectl commands cheat sheet, and read the official kubeadm documentation for advanced options such as high-availability control planes and certificate management. A kubeadm cluster gives you the same API and behavior as managed services like EKS or GKE, which makes it an excellent foundation for serious Kubernetes learning and self-hosted production work.