Cluster Architecture
A Kubernetes cluster runs many components on the control plane and every Node, yet none seems to talk to another directly. How do they interact, where does the cluster state live, and who is in charge?
Play the animation 7 steps, animated, plays on a computer or a tablet
Cluster Architecture, step by step
-
The API is the only way in for clients and controllers. Every read and every write goes through it, and a write clears authentication, authorization and admission before it is stored. Replicas are stateless and scale horizontally. One of the few paths that skip it is a static Pod, which the Kubelet reads from a local file or a URL.
Play from step 1 -
ETCD holds the cluster state the API serves, and in a standard cluster it has no client but the API. Every change is replicated through Raft, and a write is committed and the revision moves forward only once a quorum of replicas agrees.
Play from step 2 -
On the way back ETCD serves reads to the API, and that is a separate exchange, not the answer to that write. A watch keeps the stream open, and later changes arrive through it without another round trip. Clients watch the API and never ETCD, and the API answers them from its own cache.
Play from step 3 -
The controller-manager runs the built-in control loops, roughly one per resource kind (Deployment, ReplicaSet, Job and so on), plus loops shared by all kinds, like the garbage collector. Each loop watches the API, never ETCD, and writes back to reconcile observed state with desired state.
Play from step 4 -
The cloud-controller-manager runs loops that talk to a cloud provider and handle Node lifecycle, cloud routes and Service load balancers. It is optional and a cluster on your own hardware has none. It writes what it learns to the API and is split out so provider code lives outside the core.
Play from step 5 -
The Scheduler watches Pods that have no Node assignment yet, filters and scores the candidates, then posts a Binding back to the API. On the ordinary path it writes nothing else to the Pod. The exception is preemption, where it also deletes lower-priority Pods to make room. The Kubelet on the chosen Node takes it from there.
Play from step 6 -
The Kubelet watches the API for Pods assigned to its Node, then calls the Runtime over CRI to start their containers, and PATCHes Pod status back so the loops above have observed state to compare. Beside it kube-proxy watches the API on its own, for Services and EndpointSlices, and programs the local rules. It is optional too, and an eBPF dataplane can replace it.
Play from step 7