Skip to content
LF Cert Trainer

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

1/8Design a Kubernetes cluster
0:00 / 2:46

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.

Four questions shape every clusterdecidesdecidesleaves opencompletes1. Purposelearn, dev, production2. Sizenodes, Pods, traffic3. How to installmanaged or self-run4. PluginsCRI, CNI, CSIYour clustera design on paper
Four questions shape every cluster. Answer them in this order. The purpose decides the size, the size and the budget decide how you install it, and the installer decides which plugins you still have to pick yourself.

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

PurposeWhat mattersTypical answer
Learning, CKA practiceCheap, fast to rebuild, close to the examkubeadm on 2 to 3 VMs, or a lab like this one
Development, CIStarts in seconds, thrown awaykind, minikube, k3d on one machine
Production, cloudUptime, upgrades, little ops workA managed service (EKS, AKS, GKE)
Production, on premises or edgeFull control, no cloudkubeadm (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:

LimitValue
Nodes per cluster5,000
Pods per cluster150,000
Containers per cluster300,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:NoSchedule for 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

Ways to get a clusterformeansused inforLocal toolskind, minikube, k3dManaged serviceEKS, AKS, GKEkubeadmyou run the nodesBy handevery binary, every certLaptop, CIminutes, throwawayCloud runs the CPyou get the nodesThe CKA examand on-prem prodLearning internalsrarely in prod
Ways to get a cluster. Left to right, you take on more of the work and get more control. The CKA exam lives in the kubeadm column: clusters you run yourself, built with kubeadm.

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

Three slots Kubernetes leaves openCRI (gRPC)via runtimeCSI (gRPC)runswirescreateskubeleton every nodeCRI runtimecontainerd, CRI-OCNI pluginCalico, Cilium, ...CSI driverdisks, NFS, cloudContainersrunc starts themPod networkan IP per PodVolumesPVs on demand
Three slots Kubernetes leaves open. The kubelet talks to the container runtime through CRI, a network plugin wires Pods together through CNI, and a storage driver creates volumes through CSI. Kubernetes ships none of the three plugins, so every install picks one of each.

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:

InterfaceWho calls itWhat the plugin doesCommon choices
CRI, Container Runtime InterfaceThe kubelet, over a gRPC socketPulls images, creates and stops containerscontainerd, CRI-O
CNI, Container Network InterfaceThe container runtime, when a Pod sandbox startsGives the Pod an interface and an IP, and routes between nodesCalico, Cilium, Flannel
CSI, Container Storage InterfaceThe kubelet and the CSI controller sidecarsCreates, attaches and mounts volumesCloud 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 kubeadmkubeadm's jobYours, after kubeadm
Machines (VMs or bare metal), network between themPreflight checks of the machineA CNI plugin, so nodes become Ready
Swap, kernel settings, a container runtimeCertificates in /etc/kubernetes/pkiA load balancer in front of several control planes
The kubelet, kubeadm and kubectl packagesStatic Pod manifests for etcd and the control planeA CSI driver and a default StorageClass
A load balancer address, for HAkubeconfig files, CoreDNS, kube-proxy, join tokensIngress 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.

PortComponentWho connects
6443kube-apiserverEveryone: nodes, kubectl, the load balancer
2379-2380etcd client and peerThe API servers, other etcd members
10250kubelet APIThe control plane (logs, exec, metrics)
10256kube-proxy healthLoad balancers checking nodes
10257kube-controller-managerItself (localhost)
10259kube-schedulerItself (localhost)
30000-32767NodePort ServicesClients 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 nodesSurvives losingGood for
1Nothing: if it is down, nobody can change the clusterLabs, the exam, small dev clusters
2Still nothing, because etcd needs a majority (2 of 2)Never: worse than 1, with more to break
3One nodeMost production clusters
5Two nodesLarge 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.

DecisionChoiceWhy
InstallerkubeadmOn premises, no managed service
Control plane3 nodes, stacked etcd, 2 CPUs and 4 GB eachSurvives one failure; stacked is simplest
Load balancerHAProxy pair with a virtual IP, or kube-vipOne address for the API server
Workers4 nodes, 4 CPUs and 16 GB each60 services fit on 3, so one can always be drained
Runtimecontainerd, systemd cgroup driverThe default for kubeadm
NetworkCalico, Pods in 10.244.0.0/16Supports NetworkPolicy; range does not overlap the LAN 192.168.10.0/24
StorageThe storage array's CSI driver, one default StorageClassDynamic 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 stay NotReady and CoreDNS stays Pending until 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.