The cluster and the manifest
Kubernetes runs containers across a cluster: a group of machines called nodes. A control plane manages them. You normally do not say "start this here"; you say what you want, and Kubernetes keeps the real state matching it.
A manifest is a YAML file (a plain-text settings format) describing an object. This Deployment asks for three replicas (copies) of a Pod running the container image nginx:1.27. It states the goal, not the steps to reach it: that is declarative.
From file to running Pods
kubectl, the Kubernetes command-line tool, runs apply -f web.yaml to send the manifest to the API server, the front door of the control plane. It checks the object and saves it in etcd, the cluster's database. Desired state is now 3 Pods; running is 0.
A controller sees 3 wanted, 0 existing, and creates 3 Pods. A Pod is the smallest unit Kubernetes runs: one or more containers sharing a network address. The scheduler then assigns each new Pod to a node.
Each node runs an agent called the kubelet. It sees a Pod assigned to its node, pulls the image nginx:1.27 and asks the container runtime (the program that runs containers) to start it. The Pods turn Running: 3 of 3.
Pods come and go, and each has its own address. A Service gives them one stable name and IP. It finds the Pods by their label app: web, and each request goes to one of them.
Scaling and self-healing
More visitors? Change replicas: 3 to replicas: 4 and apply again. Nothing else changes. The controller sees 4 wanted, 3 existing, creates one more Pod, and the scheduler places it.
Node 3 loses power. Its kubelet stops reporting, the node is marked not ready, and after a timeout its Pod is evicted. Desired is still 4, but only 3 are running. Nobody has to notice.
The controller sees 4 wanted, 3 running, and creates a new Pod. The scheduler skips the dead node and places it on Node 2. Running is 4 again.
This is the whole idea. You declare the desired state in a file. Controllers loop forever: watch the actual state, compare, act to close the gap. A thermostat works the same way.
What happens
;; step 1/10 · cluster cluster = control plane + worker nodes control plane API server the front door etcd the store of state scheduler picks a node per Pod controllers close the gap nodes: Node 1, Node 2, Node 3
Strictly, a Deployment creates a ReplicaSet and the ReplicaSet controller creates the Pods; the figure shows both controllers as one block. Both run inside kube-controller-manager. A dead node is not handled at once. Kubernetes adds a default toleration of 300 seconds for node.kubernetes.io/not-ready and unreachable, so Pods stay bound to the node for 5 minutes before they are evicted and replaced.