In World 1 you ran kubectl and Pods appeared. This lesson is about the machinery that made that happen.
Two halves
A cluster has a control plane and nodes. The control plane decides. The nodes run containers.
control plane
┌─────────────────────────────────────────────────┐
│ kube-apiserver ──▶ etcd (all cluster state) │
│ ▲ ▲ │
│ │ └── kube-scheduler (assigns nodes) │
│ └───── kube-controller-manager │
│ (Deployments, ReplicaSets, ...) │
└────────┬────────────────────────────────────────┘
│ watch / report
┌────────▼──────────────┐ ┌───────────────────────┐
│ node 1 │ │ node 2 │
│ kubelet │ │ kubelet │
│ kube-proxy │ │ kube-proxy │
│ container runtime │ │ container runtime │
└───────────────────────┘ └───────────────────────┘The components
kube-apiserver is the only entry point. kubectl, the scheduler, the controllers and every kubelet talk to it over HTTPS. It validates each object and stores it.
is the database. It holds every object in the cluster: Pods, Deployments, Services, Secrets, Nodes. If it is lost, the cluster has no memory of what should exist.
kube-scheduler watches for Pods that have no spec.nodeName and chooses a node for each one, based on resources, labels and constraints.
kube-controller-manager runs the control loops. The Deployment controller creates ReplicaSets. The ReplicaSet controller creates Pods. Each loop compares desired state in etcd with actual state and fixes the difference.
On every node:
- The watches for Pods assigned to its node, pulls images, starts containers through the container runtime and reports status back.
- kube-proxy programs the node's network rules so Service IPs reach Pods.
- The container runtime (containerd here) runs the containers.
One request, end to end
kubectl apply -f web.yaml
1. API server validates the Deployment and writes it to etcd
2. Deployment controller creates a ReplicaSet
3. ReplicaSet controller creates 3 Pod objects (no node yet)
4. Scheduler sets spec.nodeName on each Pod
5. kubelet on that node pulls nginx and starts the container
6. kubelet reports status.phase: RunningSteps 2 to 6 happen without you. That is the model: you write desired state, controllers converge on it.
Next: ask the cluster what it is made of.