Install a cluster with kubeadm
Bootstrap a control plane, join workers and install a CNI plugin from memory.
By Invicly Tech, , in Kubernetes Administrator (CKA). About 8 minutes to read.
In short
kubeadm bootstraps a cluster: init sets up the control plane and join adds nodes. Before that, every node needs a container runtime, kernel networking settings, and matching kubeadm, kubelet and kubectl packages. Pods stay Pending and nodes NotReady until you install a CNI plugin.
Explained simply
kubeadm is the official tool that turns a few prepared Linux machines into a Kubernetes cluster. It does not install packages or the container runtime for you. It creates certificates, writes the control plane manifests, and gives you a command for other nodes to join.
Building a cluster is like opening a new branch office. First you prepare each building: power, plumbing and locks (runtime, kernel settings, packages). Then you set up headquarters (kubeadm init). Then each branch signs in with a one-day pass (kubeadm join). Finally you connect the phone lines between them (the CNI plugin).
On the exam you may need to install or join a node with the docs open. Knowing the order of steps by heart, and why each step exists, means you only look up exact commands, never the plan.
Press Play on a diagram to walk through it one step at a time.
- 1Prepare nodes
Disable swap, load br_netfilter, enable IP forwarding.
- 2Install runtime
containerd with SystemdCgroup = true.
- 3Install packages
kubeadm, kubelet, kubectl from pkgs.k8s.io; hold versions.
- 4kubeadm init
Creates certs, static Pods and admin kubeconfig.
- 5Install CNI
Apply Calico, Cilium or Flannel manifests.
- 6kubeadm join
Run the join command on each worker.
- kubeadm join to API server: Fetch cluster info with bootstrap token1Fetch cluster info with bootstrap token
- kubeadm join to kubelet: Write bootstrap kubeconfig, start kubelet2Write bootstrap kubeconfig, start kubelet
- kubelet to API server: Submit certificate signing request3Submit certificate signing request
- Controller manager to API server: Auto-approve and sign the CSR4Auto-approve and sign the CSR
- kubelet to API server: Register Node object5Register Node object
- kubelet to API server: Report Ready once CNI is present6Report Ready once CNI is present
In depth
Preparing every node
Kubernetes needs a few kernel settings. Load the overlay and br_netfilter modules, and set net.ipv4.ip_forward = 1 so the node can route Pod traffic. Turn swap off, or the kubelet will refuse to start with its default settings.
Install containerd and set SystemdCgroup = true in /etc/containerd/config.toml, so it uses the same cgroup driver as the kubelet. Then add the pkgs.k8s.io package repository for your exact minor version, install kubeadm, kubelet and kubectl, and hold them with apt-mark hold so a routine system update cannot upgrade them by accident.
- modprobe overlay and br_netfilter
- sysctl net.ipv4.ip_forward=1
- swapoff -a and remove swap from /etc/fstab
- apt-mark hold kubelet kubeadm kubectl
What kubeadm init actually does
kubeadm init runs a series of phases. Preflight checks catch problems like swap or a busy port 6443. Then it creates a certificate authority and all certificates in /etc/kubernetes/pki, writes kubeconfig files (admin.conf, kubelet.conf and others), and writes static Pod manifests for etcd and the control plane to /etc/kubernetes/manifests.
The kubelet sees those manifests and starts the components. kubeadm then waits for the API server, taints the node so normal Pods avoid it, creates a bootstrap token and installs the CoreDNS and kube-proxy add-ons. At the end it prints the join command.
- 1Preflight
Swap, ports like 6443, runtime
- 2Certificates
CA and certs in /etc/kubernetes/pki
- 3kubeconfig files
admin.conf, kubelet.conf and others
- 4Static Pod manifests
etcd and control plane; kubelet starts them
- 5Taint control plane
Normal Pods stay off
- 6Bootstrap token
For kubeadm join
- 7Add-ons
CoreDNS and kube-proxy
How joining works
kubeadm join needs three things: the API server address, a bootstrap token, and a hash of the cluster CA certificate. The token proves the node is allowed to join. The CA hash lets the node verify it is talking to the real cluster and not an impostor.
The new kubelet then sends a certificate signing request, which is approved automatically, and gets its own client certificate. Tokens expire after 24 hours by default, so print a fresh command with kubeadm token create --print-join-command when you need one.
The CNI step and the Pod CIDR
After init, the node is NotReady and CoreDNS is Pending. That is normal: there is no Pod network yet. Install a CNI plugin such as Calico, Cilium or Flannel by applying its manifest or Helm chart.
The --pod-network-cidr you gave kubeadm must match what the plugin expects, or must be configured in the plugin. Flannel defaults to 10.244.0.0/16, and Calico's sample manifests commonly use 192.168.0.0/16. A mismatch shows up as Pods that cannot reach each other across nodes.
Learn it in 5 short steps
About 1h each. Track them with a timer in your plan.
- 1Prepare nodes and install kubeadm, kubelet, kubectl~1h
- 2Run kubeadm init on the control plane~1h
- 3Install a CNI plugin~1h
- 4Join worker nodes~1h
- 5Repeat the install from memory~1h
Key points
- Set --pod-network-cidr to match what your CNI plugin expects.
- Copy /etc/kubernetes/admin.conf to ~/.kube/config to use kubectl.
- kubeadm token create --print-join-command regenerates an expired join command.
- The kubelet and runtime must use the same cgroup driver, normally systemd.
Key terms
Tap a card to flip it. 0/5 known
Examples
# Control plane
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
mkdir -p ~/.kube
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
sudo chown $(id -u):$(id -g) ~/.kube/config
kubectl apply -f calico.yaml
kubeadm token create --print-join-command
# Each worker
sudo kubeadm join 10.0.0.10:6443 --token abc.123 \
--discovery-token-ca-cert-hash sha256:<hash>Bootstrapping the control plane
Step 1: on the prepared control plane node, run kubeadm init with the Pod CIDR your CNI wants. Step 2: copy admin.conf so kubectl works for your user. Step 3: install the CNI. Step 4: wait until the node is Ready and CoreDNS is Running.
sudo kubeadm init --pod-network-cidr=192.168.0.0/16 \
--apiserver-advertise-address=10.0.0.10
mkdir -p $HOME/.kube
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f calico.yaml # manifest from the Calico docs
kubectl get nodes -wJoining a worker the next day
The original token has expired. Step 1: on the control plane, print a fresh join command. Step 2: run it with sudo on the worker. Step 3: back on the control plane, watch the node appear and turn Ready once the CNI Pods start on it.
kubeadm token create --print-join-command
# kubeadm join 10.0.0.10:6443 --token abcdef.0123456789abcdef \
# --discovery-token-ca-cert-hash sha256:5c1f...
ssh worker1 'sudo kubeadm join 10.0.0.10:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:5c1f...'
kubectl get nodes -wQuick reference
- Before init: modules overlay and br_netfilter, ip_forward=1, swap off, containerd with SystemdCgroup
- Repo per minor version: pkgs.k8s.io/core:/stable:/v1.34/deb/
- sudo apt-mark hold kubelet kubeadm kubectl
- kubeadm init --pod-network-cidr=CIDR --apiserver-advertise-address=IP
- kubeadm token create --print-join-command
- Certificates live in /etc/kubernetes/pki; manifests in /etc/kubernetes/manifests
- kubeadm config print init-defaults shows every init option
Common mistakes
- Forgetting the CNI, leaving nodes NotReady and CoreDNS Pending.
- Mismatched cgroup drivers, making the kubelet crash loop.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
On a node, check the three most common kubeadm preflight problems: swap, IP forwarding and the containerd service.
- Exercise 2medium
Write the sysctl and module config files that make the networking settings survive a reboot.
- Exercise 3hard
Install a full cluster (one control plane, one worker) from memory, using the docs only for the package repository and CNI URLs. Time yourself.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Can I run Pods on the control plane node?
- Yes, by removing the node-role.kubernetes.io/control-plane:NoSchedule taint. That is fine for a one-node lab but not for production.
- What if I lose the join command?
- Run kubeadm token create --print-join-command on the control plane. It creates a new token and prints the full command with the CA hash.
- Which CNI plugin should I learn for the exam?
- Any common one works. Calico is a good choice because it is widely documented and enforces NetworkPolicies.