Lesson 127 · Section 10: Cluster Installation & High Availability
Lesson 127: Design a Kubernetes cluster: the choices before the first command
What to decide before you install anything: what the cluster is for, how big it must be, which way to install it, how many control plane nodes, and which runtime, network and storage plugins (CRI, CNI, CSI) fill the slots Kubernetes leaves open. · 16 min read · 3 min video
Official competencies this lesson covers
Narrated by the local narrator voice. Keys: Space plays and pauses, J and L step, C captions, F full screen.
Why it exists
A cluster is cheap to start and expensive to change. You can add worker nodes on any afternoon, but turning a
single control plane into three, swapping the Pod network or moving to a different Pod address range usually means
building a new cluster and moving everything across. So before the first kubeadm init, you answer a handful of
questions on paper.
Parts:
- 1. Purpose (learn, dev, production)
- 2. Size (nodes, Pods, traffic)
- 3. How to install (managed or self-run)
- 4. Plugins (CRI, CNI, CSI)
- Your cluster (a design on paper)
Connections:
- 1. Purpose to 2. Size: decides
- 2. Size to 3. How to install: decides
- 3. How to install to 4. Plugins: leaves open
- 4. Plugins to Your cluster: completes
This section of the course builds a cluster with kubeadm, from bare machines to a highly available control plane. This first lesson is the map: the choices you make, and which of them the rest of the section turns into commands.
What it is: the decisions
1. Purpose
| Purpose | What matters | Typical answer |
|---|---|---|
| Learning, CKA practice | Cheap, fast to rebuild, close to the exam | kubeadm on 2 to 3 VMs, or a lab like this one |
| Development, CI | Starts in seconds, thrown away | kind, minikube, k3d on one machine |
| Production, cloud | Uptime, upgrades, little ops work | A managed service (EKS, AKS, GKE) |
| Production, on premises or edge | Full control, no cloud | kubeadm (or a distribution built on it) with 3 control plane nodes |
2. Size
Kubernetes is designed for clusters up to these limits. Real clusters stay far below them, and the per-node limit is the one you meet in practice:
| Limit | Value |
|---|---|
| Nodes per cluster | 5,000 |
| Pods per cluster | 150,000 |
| Containers per cluster | 300,000 |
Pods per node (kubelet default maxPods) | 110 |
Two rules of thumb do most of the work:
- Leave room for one node to be drained. If three workers run at 90% each, draining one for an upgrade has nowhere to put its Pods.
- Keep the control plane apart from workloads in production. kubeadm taints control plane nodes with
node-role.kubernetes.io/control-plane:NoSchedulefor exactly this reason.
kubeadm checks the machine before it starts: at least 2 CPUs and 2 GB of memory on a control plane node, or the preflight check stops it.
3. How to install
Parts:
- Local tools (kind, minikube, k3d)
- Managed service (EKS, AKS, GKE)
- kubeadm (you run the nodes)
- By hand (every binary, every cert)
- Laptop, CI (minutes, throwaway)
- Cloud runs the CP (you get the nodes)
- The CKA exam (and on-prem prod)
- Learning internals (rarely in prod)
Connections:
- Local tools to Laptop, CI: for
- Managed service to Cloud runs the CP: means
- kubeadm to The CKA exam: used in
- By hand to Learning internals: for
- Local tools (kind, minikube, k3d) run a whole cluster in containers or one VM. Perfect for development, not for production.
- A managed service runs the control plane for you. You never see etcd or the API server Pod, and upgrades are a button. The CKA tasks about static Pods, certificates and etcd backups do not apply there.
- kubeadm is the official tool that turns prepared Linux machines into a cluster. You run the machines; kubeadm creates the certificates, the static Pod manifests for the control plane and the join process. This is what the exam uses, and what the next lessons do.
- By hand ("Kubernetes the hard way") means generating every certificate and writing every systemd unit yourself. Great for learning the internals, rare in production.
4. Plugins: CRI, CNI and CSI
Parts:
- kubelet (on every node)
- CRI runtime (containerd, CRI-O)
- CNI plugin (Calico, Cilium, ...)
- CSI driver (disks, NFS, cloud)
- Containers (runc starts them)
- Pod network (an IP per Pod)
- Volumes (PVs on demand)
Connections:
- kubelet to CRI runtime: CRI (gRPC)
- kubelet to CNI plugin: via runtime
- kubelet to CSI driver: CSI (gRPC)
- CRI runtime to Containers: runs
- CNI plugin to Pod network: wires
- CSI driver to Volumes: creates
Kubernetes defines interfaces and lets plugins implement them, so that the core does not have to know about every runtime, network and disk:
| Interface | Who calls it | What the plugin does | Common choices |
|---|---|---|---|
| CRI, Container Runtime Interface | The kubelet, over a gRPC socket | Pulls images, creates and stops containers | containerd, CRI-O |
| CNI, Container Network Interface | The container runtime, when a Pod sandbox starts | Gives the Pod an interface and an IP, and routes between nodes | Calico, Cilium, Flannel |
| CSI, Container Storage Interface | The kubelet and the CSI controller sidecars | Creates, attaches and mounts volumes | Cloud disk drivers, NFS, Ceph, local-path |
The CRI socket is the one you meet first: kubeadm looks for it at unix:///var/run/containerd/containerd.sock
(containerd) or unix:///var/run/crio/crio.sock (CRI-O). Docker Engine is not a CRI runtime any more; it needs the
separate cri-dockerd adapter, and almost nobody uses it for new clusters.
How it works: what kubeadm does and leaves to you
kubeadm has a deliberately narrow job. It assumes the machines exist and are prepared, and it leaves the add-ons that have many good answers to you.
| Yours, before kubeadm | kubeadm's job | Yours, after kubeadm |
|---|---|---|
| Machines (VMs or bare metal), network between them | Preflight checks of the machine | A CNI plugin, so nodes become Ready |
| Swap, kernel settings, a container runtime | Certificates in /etc/kubernetes/pki | A load balancer in front of several control planes |
The kubelet, kubeadm and kubectl packages | Static Pod manifests for etcd and the control plane | A CSI driver and a default StorageClass |
| A load balancer address, for HA | kubeconfig files, CoreDNS, kube-proxy, join tokens | Ingress or Gateway controllers, metrics-server |
Most of the failures in a first install come from the left column: a runtime with the wrong cgroup driver, swap still on, a firewall closing port 6443. The next lesson but one, Prepare nodes for kubeadm, works through it.
Under the hood · Which ports must be open between machines
These are the defaults on a kubeadm cluster. In a lab everything is usually open; in a cloud you write them into security groups.
| Port | Component | Who connects |
|---|---|---|
| 6443 | kube-apiserver | Everyone: nodes, kubectl, the load balancer |
| 2379-2380 | etcd client and peer | The API servers, other etcd members |
| 10250 | kubelet API | The control plane (logs, exec, metrics) |
| 10256 | kube-proxy health | Load balancers checking nodes |
| 10257 | kube-controller-manager | Itself (localhost) |
| 10259 | kube-scheduler | Itself (localhost) |
| 30000-32767 | NodePort Services | Clients of NodePort Services |
Your CNI plugin adds its own: BGP on TCP 179 for Calico, VXLAN on UDP 4789 or 8472 for overlays.
How many control plane nodes?
| Control plane nodes | Survives losing | Good for |
|---|---|---|
| 1 | Nothing: if it is down, nobody can change the cluster | Labs, the exam, small dev clusters |
| 2 | Still nothing, because etcd needs a majority (2 of 2) | Never: worse than 1, with more to break |
| 3 | One node | Most production clusters |
| 5 | Two nodes | Large or critical clusters |
Running workloads keep running when the control plane is down; what stops is every change, every reschedule and every self-healing action. The High availability control plane lesson explains why the numbers are odd.
Using it
Example · Read the design of a cluster you have been given
In the exam you never design from scratch, but tasks assume you know the shape of the cluster. Four commands tell you:
kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP OS-IMAGE CONTAINER-RUNTIME
controlplane Ready control-plane 12d v1.37.0 192.168.56.10 Ubuntu 24.04.3 LTS containerd://2.1.4
node01 Ready <none> 12d v1.37.0 192.168.56.11 Ubuntu 24.04.3 LTS containerd://2.1.4
One control plane, one worker, containerd as the CRI runtime. Now the network and its address ranges:
ls /etc/cni/net.d/ # on any node: which CNI plugin
kubectl cluster-info dump | grep -m1 -- --cluster-cidr # Pod range
kubectl -n kube-system get pod -l component=kube-apiserver \
-o yaml | grep -- --service-cluster-ip-range # Service range
10-calico.conflist calico-kubeconfig
"--cluster-cidr=192.168.0.0/16",
- --service-cluster-ip-range=10.96.0.0/12
Calico, Pods in 192.168.0.0/16, Services in 10.96.0.0/12.
Example · Sketch a small production design
A team needs an on-premises cluster for about 60 small services, must survive one machine failing, and wants to upgrade without downtime.
| Decision | Choice | Why |
|---|---|---|
| Installer | kubeadm | On premises, no managed service |
| Control plane | 3 nodes, stacked etcd, 2 CPUs and 4 GB each | Survives one failure; stacked is simplest |
| Load balancer | HAProxy pair with a virtual IP, or kube-vip | One address for the API server |
| Workers | 4 nodes, 4 CPUs and 16 GB each | 60 services fit on 3, so one can always be drained |
| Runtime | containerd, systemd cgroup driver | The default for kubeadm |
| Network | Calico, Pods in 10.244.0.0/16 | Supports NetworkPolicy; range does not overlap the LAN 192.168.10.0/24 |
| Storage | The storage array's CSI driver, one default StorageClass | Dynamic PVs |
Notice that two choices cannot be changed later without a rebuild: the control plane endpoint and the Pod range.
Tricks
Common mistakes
- Choosing a Pod range that overlaps the node network. Pods then shadow real machines, and routing breaks in confusing ways. Pick ranges from different private blocks.
- Expecting kubeadm to install the network. After
kubeadm init, nodes stayNotReadyand CoreDNS staysPendinguntil you install a CNI plugin. - Starting with one control plane and planning to "add HA later" without a stable endpoint. kubeadm cannot
turn a single control plane cluster into an HA one unless it was created with
--control-plane-endpoint. - Sizing workers so tightly that none can be drained. Upgrades and OS patches then mean downtime.
- Treating Docker as the runtime. Since v1.24 the kubelet talks CRI only; use containerd or CRI-O.
Recap
- Decide purpose, then size, then installer, then plugins.
- The CKA world is kubeadm: you bring prepared machines, a runtime and a network plugin; kubeadm builds the cluster.
- CRI (runtime), CNI (Pod network) and CSI (storage) are interfaces; Kubernetes ships none of the plugins.
- Production control planes have 3 or 5 nodes behind one stable address. Never 2.
- The Pod range and the control plane endpoint are fixed at
kubeadm init: choose them first.
Official docs
Quiz: check what you learned
5 questions on this lesson · about 3 min · instant feedback. Missed questions come back in your review queue.
Sign in to take the quiz and keep your score.
Practise: try it on a real cluster
A hands-on lab for this lesson. You get goals, not steps: any solution that reaches them passes.
Two new machines have containerd, kubelet and kubeadm and nothing else. Build a cluster on them with kubeadm init and join, give it a pod network, and set up kubectl for your own user.
Build · Level 2 · standard · target 25 min
Discussion
Learners ask and answer questions here. Sign in to read and join the discussion.