Why Orchestration?
Orchestration automates the manual, error-prone work of running many containers across many servers.
Running a single container by hand is easy. But production systems bring hard questions that you would otherwise answer manually, over and over:
- Which server has enough CPU and memory for this container?
- What happens when a server reboots at 3 a.m.?
- How do I roll out version 2 without downtime?
- How do containers find and talk to each other?
The orchestrator's job
An orchestrator answers all of these automatically. You describe what you want, not how to achieve it. This is called a declarative approach.
Imperative: "Start a container on server 3, then another on server 5."
Declarative: "I want 5 containers running — you figure out where."
Reconciliation loop
Kubernetes runs a continuous loop: compare desired state to actual state, then take action to close the gap. If a container dies, the loop notices and starts a replacement — no human needed.
Example
# Declarative: tell Kubernetes the desired state in a file
kubectl apply -f app.yaml
# Kubernetes now keeps reconciling reality toward that file.
# Delete a Pod and it will be recreated automatically:
kubectl delete pod my-app-podWhen to use it
- A video-streaming service uses orchestration to automatically scale transcoding workers up during peak upload hours and back down overnight.
- A fintech company relies on orchestration to reschedule payment-processing containers onto healthy nodes when hardware fails.
- An online retailer uses orchestration to roll out a new checkout service to a small traffic slice first, then promote it after validation.
More examples
Scale replicas to handle load
Increases the running replica count of a deployment to 10 with one command, letting the orchestrator handle scheduling.
kubectl scale deployment web --replicas=10
kubectl rollout status deployment/webAutomatic pod restart on failure
Shows that when a pod crashes, Kubernetes automatically restarts it without any manual intervention, demonstrating self-healing.
kubectl get pods -w
# NAME READY STATUS RESTARTS AGE
# api-0 0/1 OOMKilled 1 30s
# api-0 1/1 Running 2 35sDesired-state Deployment spec
Demonstrates desired-state orchestration: the cluster continuously reconciles reality to match this declared spec.
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: myapp:2.0
Discussion