Overview
Container orchestration automates deploying, scheduling, networking, scaling, and healing containers across a cluster of machines. Running a few containers by hand is easy; running thousands across hundreds of hosts, with rolling updates, service discovery, secrets, and failure recovery, requires an orchestrator.
Kubernetes is the dominant orchestrator; alternatives include Amazon ECS (simpler, AWS-native), HashiCorp Nomad (lightweight, also runs non-container workloads), and serverless container platforms (AWS Fargate, Google Cloud Run, Azure Container Apps) that hide the cluster entirely.
Thousands of shipping containers arrive daily. The port's system decides which crane unloads each, where to stack it, which truck takes it, and reroutes when a crane breaks. Orchestrators do this for software containers.
When to use it
- Running many containerized services in production.
- Needing self-healing, rolling updates, and autoscaling.
- Efficient bin-packing of workloads onto shared machines.
- Standardizing deployments across teams.
Where it shows up in interviews
Recognize it when: Kubernetes or something simpler?
- Choose a runtime for a startup
- Design an internal developer platform
Where it is used in real software
EKS, GKE, and AKS run most large container fleets.
Used by many AWS-centric companies for simpler container operations, often with Fargate.
Runs containers serverlessly with request-based scaling to zero.
Key terms
- Scheduling
- Placing containers on nodes based on resources and constraints.
- Bin packing
- Fitting workloads efficiently onto machines.
- Desired state
- Declared configuration the orchestrator maintains.
- Self-healing
- Restarting and rescheduling failed containers.
- Affinity / anti-affinity
- Rules to co-locate or spread workloads.
How it works, step by step
- 1Declare the workload
Image, replicas, resources, ports, config.
- 2Scheduler places containers
Spreading across zones and nodes.
- 3Networking connects them
Service discovery and load balancing.
- 4Controllers maintain state
Replace failures, roll out updates.
- 5Autoscalers adjust capacity
Pods and nodes.
Orchestration options
Choose by team size and needs
| Platform | Complexity | Flexibility | Best for |
|---|---|---|---|
| Kubernetes (EKS/GKE/AKS) | High | Highest, huge ecosystem | Large platforms, multi-cloud |
| Amazon ECS + Fargate | Low-medium | AWS-focused | AWS teams wanting simplicity |
| Nomad | Low | Containers + VMs + binaries | Mixed workloads, HashiCorp stacks |
| Cloud Run / Container Apps | Lowest | Request-driven services | Small teams, spiky HTTP services |
NOWPlatform: Kubernetes (EKS/GKE/AKS) | Complexity: High | Flexibility: Highest, huge ecosystem | Best for: Large platforms, multi-cloud
Kubernetes is powerful but not always necessary; pick the simplest platform that meets requirements.
Implementation
{ "family": "api", "requiresCompatibilities": ["FARGATE"], "networkMode": "awsvpc", "cpu": "512", "memory": "1024", "containerDefinitions": [ { "name": "api", "image": "containers.artifactory.tools.bestbuy.com/team/api:abc1234", "portMappings": [{ "containerPort": 3000 }], "healthCheck": { "command": ["CMD-SHELL", "wget -qO- http://localhost:3000/health || exit 1"], "interval": 15 }, "secrets": [{ "name": "DATABASE_URL", "valueFrom": "arn:aws:secretsmanager:us-east-1:123456789012:secret:api-db" }], "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "/ecs/api", "awslogs-region": "us-east-1", "awslogs-stream-prefix": "api" } } } ]}Complexity and performance
Per pod.
Per cluster.
Trade-offs
Kubernetes offers the most control and ecosystem; managed serverless containers offer the least operational work.
Kubernetes is portable across clouds; ECS and Cloud Run are tied to their provider.
Variants and related techniques
Simple orchestrator built into Docker; less common today.
K3s and similar lightweight distributions for edge devices.
Common mistakes
- Adopting Kubernetes too early.
Fix: Small teams may move faster on managed container platforms.
- All replicas in one zone.
Fix: Use topology spread constraints or anti-affinity.
Interview questions
What problems does a container orchestrator solve?
Scheduling containers across machines, service discovery and load balancing, rolling updates and rollbacks, self-healing, autoscaling, configuration and secrets management, and efficient resource utilization.
When would you choose ECS or Cloud Run over Kubernetes?
When the team is small, workloads are standard web services or workers, and you want minimal operations on one cloud, without needing Kubernetes' ecosystem or portability.
Practice problems
| Problem | Difficulty | What it trains |
|---|---|---|
| Compare EKS and ECS for a 10-service app | Medium | Trade-offs. |
| Design zone-resilient scheduling | Medium | Spread constraints. |