Skip to content
BIASED

Kubernetes: desired state and reconciliation

Block 1 of 5~3 min

Desired state and the loop

Scripts that ssh and docker run fail at placement, healing, rollouts, service addresses and multi-tenant isolation once you have dozens of machines. Key idea: store objects with spec (desired) and status (observed). Controllers reconcile forever: observe, compare, act, write status. The loop is level-triggered — it reacts to the gap between desired and observed, not to unmissable edge events. Missed events are fine; the next resync still sees "want 3, have 2" and creates a Pod. Borg and Omega used the thermostat analogy for the same reason.

Path of a Deployment apply: kubectl apply → API server persists to etcd → Deployment controller creates or updates a ReplicaSet → ReplicaSet creates Pods → scheduler binds Pods to nodes → kubelets pull images and start containers via CRI → readiness flips → status flows back up. If a Pod dies, the ReplicaSet sees too few replicas and creates another — healing without a human. If you delete a Pod you did not want deleted, the same loop recreates it; change the Deployment spec or scale to zero if you want it gone.

Reconciliation is eventually consistent. Briefly "wrong" states during rollouts are normal; design readiness probes and PodDisruptionBudgets so "briefly wrong" does not equal "serving errors."

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Replica reconciliation loopoptional

    Desired=3, current=2+CrashLoop: what the Deployment/ReplicaSet controller does on the next tick.

    ~20 min · easier on a computer · The matching course topic has been read.

    Self-check in the notebook — not part of mastery or the certificate.