design·lab

DevOps & platform

Kubernetes

You declare the state you want; a control loop keeps making reality match it — forever.

✗ Problem

Running containers by hand doesn't scale

One machine, one container — fine. Now do it for hundreds of containers across dozens of machines, and keep it up at 3am.

# node1: deploy
ssh node1 docker run app:v1
# node1 crashes at 3am — who restarts it?
ssh node1 docker run app:v1

# now scale to 10 replicas across 6 machines…
# …rolling update? networking? bin-packing? 😱
Restarts, scaling, rollouts, networking, bin-packing — doing all of this by hand, 24/7, across many machines is simply impossible to sustain.
✓ How it works

Declare desired state — a loop reconciles reality to match

You don't tell Kubernetes how to run containers — you declare what you want. The control plane (API server + scheduler + controllers) watches actual state and continuously reconciles it toward desired state.

kind: Deployment
spec:
  replicas: 3
  template:
    image: app:v1
Desired state
replicas: 3
Controller
reconcile loop
3 Pods
on Nodes
  • Pod — smallest deployable unit (one or more containers).
  • Deployment — desired replica count + rollout/rollback strategy.
  • Service — stable virtual IP that load-balances across matching Pods.
✓ See it live

Kill a pod, scale the fleet — watch it reconcile

Desired replicas = 3. Kill a pod and the controller notices the mismatch and recreates it (self-healing). Scale up or down and it converges to the new number.

Desired: 3 · Actual running: 3 ✓ converged
3 pods tracked
✓ Takeaway

You manage desired state — not individual containers

  • Declarative desired-state + reconciliation: say what you want, a loop makes it so.
  • Self-healing: crashed Pods get recreated automatically.
  • Horizontal scaling: change replica count, the controller adds/removes Pods.
  • Rolling updates & rollbacks: Deployments swap Pods gradually, safely.
  • Services give a stable network identity so Pods can churn underneath it.
  • You rarely touch Pods directly — you edit the desired state and let it converge. This is what enables GitOps.
🎯 Same idea, bigger scale: it's the same reconcile / self-correct loop as control loops — just applied to a whole cluster instead of a single call.