Phase 0: Mental Model
Time: 1 evening. Goal: understand WHY k8s exists before touching it.
Why Kubernetes at all
What problem does k8s solve that docker run and docker compose don't?
- Scheduling across multiple machines. Compose runs on one host. k8s treats a fleet of machines as one big pool of CPU and memory.
- Self-healing. A container dies, a node dies, k8s reschedules the workload somewhere else without you waking up.
- Rolling updates. Replace v1 with v2 gradually, with health checks gating each step, and roll back with one command.
- Service discovery at scale. Built-in DNS and virtual IPs so services find each other no matter which node they land on.
The core idea: declarative desired state
With Docker you say "run this container" (imperative). With k8s you say "I want 3 replicas of this image to always exist" (declarative), and a control loop continuously makes reality match your declaration.
This is the single most important idea in Kubernetes. Everything else - controllers, reconciliation, kubectl apply - follows from it.
Architecture at a glance
You don't need to memorize this yet. Just know the API server is the front door and everything talks to it.
- Control plane: API server, scheduler, controller manager, etcd (the database holding desired state).
- Worker nodes: kubelet (the agent that runs pods), container runtime (containerd these days, not Docker itself).
The Docker-to-k8s map
Keep this table in your head. The full version lives in the cheat sheet.
| Docker concept | Kubernetes equivalent |
|---|---|
docker run | Pod (lowest unit, wraps 1+ containers) |
docker compose service | Deployment |
docker compose file | A set of YAML manifests |
| compose networks / service names | Service (ClusterIP) + cluster DNS |
-p 8080:80 | Service (NodePort/LoadBalancer) or Ingress |
| volumes | PersistentVolume + PersistentVolumeClaim |
.env / environment: | ConfigMap + Secret |
restart: always | Built-in, controllers reschedule pods |
docker logs / exec | kubectl logs / kubectl exec |
Checkpoint
Before moving on, you should be able to explain to a colleague, in your own words:
- What "declarative desired state" means and how it differs from
docker run. - Why compose is not enough once you have more than one machine.
- What the API server is.