🐳Key Takeaways
- 1Containers package code + dependencies into a portable unit — same behavior everywhere
- 2Docker builds images; Kubernetes orchestrates containers at scale (scheduling, scaling, networking, healing)
- 3K8s core: Pods (smallest unit), Deployments (desired state), Services (stable networking), Ingress (external access)
- 4Helm charts template K8s manifests; GitOps (ArgoCD) syncs cluster state from Git
From Docker to Kubernetes
Containers solved 'works on my machine' by packaging applications with all dependencies. Docker made containers developer-friendly. Kubernetes made running containers at scale manageable — handling scheduling, networking, scaling, and self-healing across clusters of machines.
Kubernetes Architecture
API Server: REST API — all K8s communication goes through here.
etcd: Distributed key-value store holding all cluster state (Raft consensus).
Scheduler: Assigns pods to nodes based on resource requirements and constraints.
Controller Manager: Runs control loops that watch cluster state and make changes (e.g., if desired replicas = 3 but only 2 are running, start another).
kubelet: Agent on each node that ensures containers are running as specified.
kube-proxy: Handles networking rules — routes traffic to correct pods.
Container Runtime: Actually runs containers (containerd, CRI-O).
Pod: Smallest deployable unit (1+ containers). Ephemeral — can be deleted/recreated anytime.
Deployment: Declarative desired state (image, replicas). Controller ensures reality matches desired state.
Service: Stable IP + DNS name for a set of pods. Types: ClusterIP (internal), NodePort, LoadBalancer.
Ingress: HTTP routing rules for external traffic (host/path-based routing, SSL termination).
Deployment Strategies
| Strategy | How It Works | Downtime | Rollback |
|---|---|---|---|
| Rolling Update | Replace pods one at a time | Zero | Automatic (K8s default) |
| Blue/Green | Run new version alongside old, switch traffic | Zero | Instant (switch back) |
| Canary | Route 1-5% traffic to new version, gradually increase | Zero | Pull canary |
| Recreate | Kill all old pods, start new ones | Yes | Redeploy old version |
Advantages
- •Kubernetes automates deployment, scaling, and healing
- •Declarative desired-state model prevents drift
- •Massive ecosystem (Helm, Istio, ArgoCD, etc.)
Disadvantages
- •K8s has a steep learning curve
- •Operational overhead for small teams
- •Debugging network issues in K8s is notoriously hard
🧪 Test Your Understanding
What does the Kubernetes scheduler do?