Skip to content
LF Cert Trainer

Lesson 4 · Section 2: Core Concepts

Lesson 4: Cluster architecture: who does what in a Kubernetes cluster

A map of the control plane and the nodes: what each component does, how they cooperate through the API server to turn a manifest into running containers, how kubeadm runs them, and how to find and check each one. · 22 min read · 4 min video

1/10Cluster architecture
0:00 / 4:16

Narrated by the local narrator voice. Keys: Space plays and pauses, J and L step, C captions, F full screen.

Why a cluster has parts

You have twenty containers and five machines. Someone has to decide which container runs where, start it there, notice when a machine dies, and start replacements somewhere else. Doing that by hand does not scale, and doing it with one big program on one machine gives you a single thing whose failure stops everything.

Kubernetes splits the work into a few small programs with one job each. You tell the cluster what you want (the desired state: "three replicas of this image"), and those programs work together, continuously, to make the real world match. The split is not an implementation detail you can ignore: in the CKA exam, almost every troubleshooting task comes down to knowing which program is responsible for the thing that is not happening.

What a cluster is made of

The parts of a clusterControl planeEvery nodeHTTPSread, writewatch, fixwatch, bindwatch, reportwatchCRIrunskubectlyou, or a pipelineetcdcluster state :2379kube-apiserverthe front door :6443controller-managerkeeps counts rightkube-schedulerpicks a nodekubeletnode agent :10250kube-proxyService rulesContainer runtimecontainerdPodsyour containers
The parts of a cluster. The control plane decides, the nodes run. Every arrow ends at the API server: it is the only component the others talk to, and the only one that talks to etcd.

Parts:

  • kubectl (you, or a pipeline)
  • etcd (cluster state :2379), in Control plane
  • kube-apiserver (the front door :6443), in Control plane
  • controller-manager (keeps counts right), in Control plane
  • kube-scheduler (picks a node), in Control plane
  • kubelet (node agent :10250), in Every node
  • kube-proxy (Service rules), in Every node
  • Container runtime (containerd), in Every node
  • Pods (your containers), in Every node

Connections:

  • kubectl to kube-apiserver: HTTPS
  • kube-apiserver and etcd: read, write
  • controller-manager to kube-apiserver: watch, fix
  • kube-scheduler to kube-apiserver: watch, bind
  • kubelet to kube-apiserver: watch, report
  • kube-proxy to kube-apiserver: watch
  • kubelet to Container runtime: CRI
  • Container runtime to Pods: runs

A cluster has two kinds of machine. Control plane nodes run the programs that manage the cluster. Worker nodes (usually just called nodes) run your Pods. In a small cluster one machine can be both.

Control plane components

ComponentIts one jobListens on
kube-apiserverServes the Kubernetes API over HTTPS. Authenticates, authorises and validates every request, then reads or writes etcd. Everything else is its client.6443
etcdA consistent key-value store that holds every object in the cluster. If it is lost without a backup, the cluster is lost.2379 (clients), 2380 (peers)
kube-schedulerFinds Pods that have no node yet and chooses a node for each. It only writes the choice down; it starts nothing.10259
kube-controller-managerRuns dozens of controllers in one process: Deployment, ReplicaSet, Node, Job, EndpointSlice, ServiceAccount and more. Each compares desired and actual state and corrects the difference.10257
cloud-controller-managerOptional. Talks to a cloud provider's API: load balancers for Services, node addresses, routes. Absent on bare kubeadm clusters.10258

Node components

These run on every node, control plane nodes included:

ComponentIts one jobListens on
kubeletThe node agent. Registers the node, watches for Pods assigned to it, tells the runtime to start and stop containers, runs probes, and reports Pod and node status.10250
Container runtimePulls images and runs containers. Usually containerd, sometimes CRI-O. The kubelet talks to it over the Container Runtime Interface (CRI), a local socket.a Unix socket
kube-proxyWatches Services and EndpointSlices and writes the kernel rules (iptables, nftables or IPVS) that send Service traffic to Pods. Optional: some network plugins replace it.10256 (health)

Addons

Addons are ordinary workloads that the cluster needs to be useful. They are not part of the control plane, and they run as normal Pods that the scheduler places:

  • A network plugin (CNI) such as Calico, Cilium or Flannel, which gives Pods their IP addresses and connects them across nodes. Until one is installed, nodes stay NotReady.
  • CoreDNS, the cluster DNS, which turns Service names into IP addresses.
  • Optional extras such as metrics-server.

How the parts work together

From kubectl to running containers1 create2 save3 add Pods4 bind5 watch, 7 status6 startkubectlcreate deploymentetcdstores every objectkube-apiserverchecks, then savescontroller-managercreates 3 Podskube-schedulersets nodeNamekubeleton the chosen nodecontainerdpulls and starts
From kubectl to running containers. Nobody gives orders. Each component watches the API server, notices something that is its job, does it and writes the result back. The numbers show the order.

Parts:

  • kubectl (create deployment)
  • etcd (stores every object)
  • kube-apiserver (checks, then saves)
  • controller-manager (creates 3 Pods)
  • kube-scheduler (sets nodeName)
  • kubelet (on the chosen node)
  • containerd (pulls and starts)

Connections:

  • kubectl to kube-apiserver: 1 create
  • kube-apiserver and etcd: 2 save
  • controller-manager to kube-apiserver: 3 add Pods
  • kube-scheduler to kube-apiserver: 4 bind
  • kubelet and kube-apiserver: 5 watch, 7 status
  • kubelet to containerd: 6 start

Follow one command, kubectl create deployment web --image=nginx --replicas=3, through the cluster:

  1. kubectl sends an HTTPS request to the API server. The API server authenticates you, checks that you are allowed to create Deployments, and validates the object.
  2. The API server saves the Deployment in etcd and answers deployment.apps/web created. At this moment nothing is running, and kubectl is already done.
  3. The Deployment controller (inside the controller manager) is watching Deployments. It sees one with no ReplicaSet and creates it. The ReplicaSet controller sees a ReplicaSet that wants three Pods and has none, and creates three Pod objects. They are Pending, with an empty spec.nodeName.
  4. The scheduler is watching for Pods without a node. For each one it filters out the nodes that cannot run it, scores the rest, and writes the winner into spec.nodeName (this is called binding).
  5. The kubelet on each chosen node is watching for Pods whose nodeName is its own. It sees the new Pod.
  6. The kubelet asks the container runtime to create the Pod's sandbox, the runtime calls the CNI plugin to give it a network and an IP, then pulls the image and starts the containers.
  7. The kubelet writes the Pod's status (Running, its IP, its conditions) back through the API server. Other watchers react in turn: the EndpointSlice controller adds the Pod to its Services, and kube-proxy on every node updates its rules.

Two things in this story explain most of Kubernetes' behaviour:

  • Nobody calls anybody. The scheduler never contacts a kubelet, and the controller manager never contacts the scheduler. Each component only reads and writes objects through the API server. That is why you can restart any of them, or run several copies, without the others noticing.
  • The loops never stop. A controller does not run once per command. It keeps comparing desired and actual state for as long as the cluster lives. Delete one of the three Pods and the ReplicaSet controller creates a fourth, and the whole sequence from step 4 repeats. This is reconciliation, and it is where self-healing comes from.
Under the hood · Why everything goes through the API server
  • One place to secure. Authentication, authorisation (RBAC), admission control and audit logging happen in the API server. Because nothing else may touch etcd, no component can bypass them.
  • One place to validate. A request passes, in order: authentication, authorisation, mutating admission, schema validation, validating admission, and only then is it written to etcd.
  • Watches instead of polling. Clients open a long-lived watch and the API server streams every change to them. A component that restarts first lists the current objects and then watches from there, so it never needs a history of events. This design is called level-triggered: components act on the current state, not on messages they might have missed.
  • Safe concurrent writes. Every object carries a resourceVersion. If two components update the same object at once, the second write is rejected with a conflict and the component retries with fresh data.
  • Freedom to change the store. Only the API server knows how objects are laid out in etcd, so storage formats and API versions can change without touching the other components.
Under the hood · How the control plane knows a node is alive
  • Each kubelet renews a small Lease object named after its node, in the kube-node-lease namespace, every 10 seconds by default. It also updates the Node's status, but far less often.
  • The node controller (in the controller manager) watches those Leases. If a node stops renewing for the grace period (under a minute by default), it marks the Node's Ready condition Unknown and taints the node node.kubernetes.io/unreachable.
  • Pods tolerate that taint for 300 seconds by default. After that they are evicted, and their controllers create replacements on healthy nodes. This is why Pods on a dead node take about five minutes to come back elsewhere.
  • Look at the heartbeats with kubectl -n kube-node-lease get leases.
Under the hood · More than one control plane node
  • In a highly available cluster, three (or five) control plane nodes each run the full set of components behind a load balancer.
  • Every API server is active at the same time; they are stateless and any of them can serve any request.
  • etcd members form one cluster and need a majority (quorum) to accept writes: three members survive the loss of one, five survive two. That is why control planes come in odd sizes.
  • The scheduler and controller manager must not act twice, so only one copy of each is active. The copies elect a leader through a Lease in kube-system; the others wait and take over if it stops renewing. See who leads with kubectl -n kube-system get lease kube-scheduler kube-controller-manager.

How the components are run

The same components can be packaged in different ways, and where you look for them depends on how the cluster was built:

Cluster typeWhere the control plane runsWhat you see in kube-system
kubeadm (the CKA's focus)Static Pods on the control plane nodesetcd-, kube-apiserver-, kube-controller-manager- and kube-scheduler- Pods, one per control plane node
Managed (EKS, AKS, GKE)On machines the provider owns and hidesOnly addons and node agents; kubectl get nodes lists workers only
Single binary (k3s, k0s)Inside one process on the server nodeNo control plane Pods at all
By hand ("the hard way")systemd services on the control plane hostsNo control plane Pods; use systemctl and journalctl

kubeadm and static Pods

How a kubeadm control plane starts itselfStatic PodsstartsreadCRIsystemdkubelet.servicekubeleta host processManifest folder4 YAML filescontainerda host processetcdetcd-cp1kube-apiserverkube-apiserver-cp1controller-manager…-manager-cp1kube-schedulerkube-scheduler-cp1
How a kubeadm control plane starts itself. systemd starts the kubelet. The kubelet reads the manifests in /etc/kubernetes/manifests and starts the four control plane Pods through containerd, before any API server exists.

Parts:

  • systemd (kubelet.service)
  • kubelet (a host process)
  • Manifest folder (4 YAML files)
  • containerd (a host process)
  • etcd (etcd-cp1), in Static Pods
  • kube-apiserver (kube-apiserver-cp1), in Static Pods
  • controller-manager (…-manager-cp1), in Static Pods
  • kube-scheduler (kube-scheduler-cp1), in Static Pods

Connections:

  • systemd to kubelet: starts
  • Manifest folder to kubelet: read
  • kubelet to containerd: CRI
  • containerd to etcd
  • containerd to kube-apiserver
  • containerd to controller-manager
  • containerd to kube-scheduler

kubeadm runs the control plane as Pods, which raises a chicken-and-egg question: Pods are created through the API server, so who creates the API server's Pod? The answer is the static Pod.

  • The kubelet and the container runtime are ordinary host processes, started by systemd. They are the only components that are never Pods.
  • The kubelet watches a folder on the node's own disk, set by staticPodPath in /var/lib/kubelet/config.yaml. With kubeadm it is /etc/kubernetes/manifests.
  • For every Pod manifest in that folder, the kubelet starts the Pod directly through the runtime. It needs no API server and no scheduler to do so. If the file changes, it recreates the Pod; if the file is removed, it stops the Pod.
  • Once the API server is up, the kubelet creates a read-only mirror Pod for each static Pod, so that you can see it with kubectl. Its name is the Pod name plus the node name: kube-apiserver-cp1.

kubeadm also installs two addons as normal workloads: kube-proxy as a DaemonSet (one Pod per node) and CoreDNS as a Deployment. And it taints control plane nodes with node-role.kubernetes.io/control-plane:NoSchedule, which is why your own Pods land on the workers.

Using it

Example · Find every component on a kubeadm cluster

You are dropped into a cluster you have never seen. Map it before changing anything.

kubectl get nodes -o wide                    # roles, IPs, runtime of each node
kubectl -n kube-system get pods -o wide      # which component runs on which node
NAME                          READY   STATUS    NODE
coredns-7c65d6cfc9-4xk2p      1/1     Running   node01      Deployment (addon)
etcd-cp1                      1/1     Running   cp1         static Pod
kube-apiserver-cp1            1/1     Running   cp1         static Pod
kube-controller-manager-cp1   1/1     Running   cp1         static Pod
kube-proxy-6ldfn              1/1     Running   node01      DaemonSet (addon)
kube-scheduler-cp1            1/1     Running   cp1         static Pod

A name that ends in a node name is a static Pod; a name with a random suffix belongs to a Deployment or DaemonSet. Then, on the control plane node (ssh cp1):

ls /etc/kubernetes/manifests                 # the four static Pod manifests
systemctl status kubelet containerd          # the two host services
sudo crictl ps                               # containers as the runtime sees them

Example · Read how a component is configured

Every setting of a kubeadm control plane component is a command-line flag in its manifest. To find the Service IP range, the etcd data directory and the folder the kubelet watches:

sudo grep service-cluster-ip-range /etc/kubernetes/manifests/kube-apiserver.yaml
#     - --service-cluster-ip-range=10.96.0.0/12
sudo grep data-dir /etc/kubernetes/manifests/etcd.yaml
#     - --data-dir=/var/lib/etcd
sudo grep staticPodPath /var/lib/kubelet/config.yaml
# staticPodPath: /etc/kubernetes/manifests

Without a shell on the node, read the same flags from the mirror Pod: kubectl -n kube-system get pod kube-apiserver-cp1 -o yaml.

Example · Prove what the scheduler does by stopping it

On a practice cluster, take the scheduler away and watch what happens. Moving the manifest out of the folder stops the static Pod.

sudo mv /etc/kubernetes/manifests/kube-scheduler.yaml /tmp/
kubectl run probe --image=nginx
kubectl get pod probe -o wide
NAME    READY   STATUS    RESTARTS   AGE   IP       NODE
probe   0/1     Pending   0          20s   <none>   <none>

The API server accepted the Pod and etcd stored it, but NODE is empty: nobody is binding Pods. Existing Pods are unaffected. Put the file back and the Pod starts within seconds:

sudo mv /tmp/kube-scheduler.yaml /etc/kubernetes/manifests/
kubectl get pod probe -o wide --watch

What breaks when a component is down

Use this table backwards in the exam: start from the symptom and it names the suspect.

Component downWhat you seeWhat keeps working
kube-apiserverkubectl fails with "connection refused" on port 6443Running Pods and existing Service rules
etcdThe API server cannot read or write: requests time out or fail, and the API server soon restartsRunning Pods
kube-schedulerNew Pods stay Pending with no node and no eventsEverything already scheduled
kube-controller-managerDeployments create no Pods, scaling does nothing, deleted Pods are not replaced, dead nodes are not noticedRunning Pods; bare Pods can still be scheduled
kubelet (one node)The node becomes NotReady; its Pods are evicted after about five minutesIts containers keep running until someone stops them
Container runtime (one node)The node becomes NotReady; nothing new starts thereOther nodes
kube-proxy (one node)Services created or changed later do not work from that nodeRules that were already written
CoreDNSNames such as web.shop do not resolveConnections by IP address
CNI pluginNodes NotReady, or new Pods stuck in ContainerCreatingPods that use the host network, such as the control plane

Tricks

Common mistakes

  • Looking for a kubelet Pod. The kubelet and the container runtime are systemd services on the host. Use systemctl and journalctl, on the node in question.
  • Deleting or editing the mirror Pod. It comes straight back and nothing changes. Work on the file in /etc/kubernetes/manifests on the node that runs it.
  • Leaving a backup in the manifest folder. The kubelet reads every file there, so kube-apiserver.yaml.bak can start a second, conflicting API server. Keep backups in /tmp or your home directory.
  • Working on the wrong machine. Static Pod manifests exist only on control plane nodes, and each node has its own kubelet. Check your prompt (hostname) before editing or restarting anything.
  • Thinking the scheduler starts Pods. It only fills in spec.nodeName. If a Pod has a node but does not start, the scheduler has done its work: look at the kubelet, the image and the events in kubectl describe pod.
  • Assuming a dead control plane kills the applications. Running Pods keep running and serving traffic. What you lose is change: no new Pods, no repairs, no kubectl.

Recap

  • The control plane (API server, etcd, scheduler, controller manager) decides; the nodes (kubelet, container runtime, kube-proxy) run the Pods.
  • Everything goes through the API server, and only the API server talks to etcd.
  • Components watch and reconcile; they never call each other. That is what makes the cluster self-healing.
  • On kubeadm the control plane is four static Pods from /etc/kubernetes/manifests, started by the kubelet, which is itself a systemd service.
  • To troubleshoot, match the symptom to the component, then use kubectl, crictl or journalctl where it runs.

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.

  • Walk through a kubeadm cluster and write down how its parts are run: which are static pods, which are ordinary workloads, and where the API server finds etcd.

    Investigate · Level 1 · warm-up · target 12 min

Discussion

Learners ask and answer questions here. Sign in to read and join the discussion.