Why containers fit microservices
Running each microservice inside its own Virtual Machine (VM) wastes CPU, RAM, and boot time because a VM behaves like a full server with its own guest OS. Containers (see Linux Containers and Lightweight Virtualization) match microservices cleanly because they are:
- Self-contained (application code plus dependencies in one image)
- Low overhead and fast starting
- Easy to compose into multi-service apps and easy to replace when updating or recovering from crashes
Once an application consists of dozens or hundreds of containers across many machines, teams face a new operational question: how should those containers be placed, connected, monitored, and healed?
Three ways to deploy containers
| Method | Tools / examples | Strengths | Weaknesses |
|---|---|---|---|
| Manual | SSH into servers and run docker | Simple, no special tools; reasonable when not operating at scale | Not automated, not reproducible, not scalable, not self-healing |
| Scripting | Puppet, Chef, Ansible, Salt, custom scripts | Integrates with existing setups, reproducible, clear execution steps | Manual scheduling (you pick hosts), not scalable, not self-healing, usually non-portable |
| Dedicated orchestrator | Kubernetes, Docker Swarm, HashiCorp Nomad, Apache Mesos | Automatically maps containers to machines without human intervention; automated, reproducible, self-healing, scalable, portable | Operational overhead, new tooling and training, higher complexity |
What an orchestrator must do
Think of an orchestrator as an automated air-traffic controller plus ground crew operating on machine timescale (seconds) rather than human timescale (DevOps operators responding manually 24/7, as in older OpenStack-style workflows).
-
Must-Have capabilities:
- Lifecycle management: Start, stop, and replace containers.
- Scheduling: Match containers to machines automatically using resource needs (CPU, memory), affinity requirements (“put container X near container Y” for low latency), and labels (“put container X on a
testmachine”). - Replication: Maintain N running copies of a service.
- Machine failure handling: Reschedule containers off failed hosts automatically.
- Discovery: Let containers find peers/services dynamically without hardcoded IPs or
localhost. - Inspection: Expose cluster and container status to operators.
- Virtual networking & tenants: Connect containers across hosts via virtual networks and isolate tenants.
-
Nice-to-Have capabilities: Built-in load balancers, automated rolling updates, cluster auto-scaling (adjusting host count for utilization), app auto-scaling (adjusting container replicas for traffic spikes and troughs), storage provisioning, automatic restart on app crashes, and late-binding configuration.
Why Kubernetes became the de-facto standard
Originating at Google in 2014 (drawing on Borg and Omega) and hosted by the CNCF since 2015, Kubernetes became the dominant orchestrator—run in production by 82% of container users (CNCF 2025 survey, cited as 2026 status in the slides)—for four reasons:
- Declarative model (self-healing): Rather than issuing step-by-step imperative commands (“start container on server 3”), operators declare the desired state (“keep 5 replicas of
CartServicerunning”). Background controllers continuously reconcile actual state toward desired state, healing drift automatically. - Extensibility (“API engine”): Custom Resource Definitions (CRDs) and operators extend Kubernetes beyond microservices to manage batch jobs, databases, VMs (KubeVirt), and AI training/inference (66% of AI adopters use Kubernetes for inference, CNCF 2025).
- Vendor-neutral governance: CNCF stewardship and a vast ecosystem prevent single-vendor lock-in.
- Same API everywhere: Managed cloud offerings (GKE, EKS, AKS), on-premises distributions (OpenShift, Rancher), lightweight edge (k3s), and local laptop tools (kind, minikube) all share one API.
Its main limits are installation/operational complexity and a practical scale limit of roughly ~5,000 nodes per cluster.
Orchestrator landscape (source 2026 snapshot)
| Orchestrator | Origin | Key strengths | Key limits | Source status (2026) |
|---|---|---|---|---|
| Kubernetes | Google (2014), CNCF (2015) | Declarative + controllers, extensible (CRDs/operators), huge ecosystem | Complex to install/operate; ~5,000 nodes/cluster | De-facto standard (82% in prod, CNCF 2025) |
| Docker Swarm | Docker (2016) | Built into Docker Engine; very simple; reuses Compose files | Fewer features (no API extensions, basic autoscaling), small ecosystem | Niche but maintained (Mirantis support until at least 2030) |
| HashiCorp Nomad | HashiCorp (2015) | Single binary, simple; schedules containers, VMs, and plain executables | Smaller ecosystem; relies on Consul/Vault for networking and secrets | Active; BSL source-available (2023), part of IBM (2025) |
| Apache Mesos / Marathon | UC Berkeley (2009) | Two-level scheduler; 10k+ node clusters; mixed workloads (Spark, Hadoop, containers) | Complex setup and administration | Retired (moved to Apache Attic in 2025) |
| Cloud-proprietary (e.g., AWS ECS) | AWS (2015) | Fully managed, tight integration with cloud provider services | Vendor lock-in (runs only on that cloud) | Widely used within its own cloud |
When you do not need Kubernetes
The lecture emphasizes right-sizing tooling to scale (extending Docker Networking Lifecycle and Orchestration):
- Single host: Use Docker Compose.
- Small clusters: Docker Swarm or HashiCorp Nomad keep operations simpler.
- No dedicated ops team: Use managed Kubernetes or serverless containers (e.g., Google Cloud Run, AWS Fargate).
Common confusions
- A provisioning script is not an orchestrator: Tools like Ansible execute an imperative setup run; if a server dies at 3 a.m. or traffic triples, the script does not watch cluster health and reschedule replicas unless you build automation around it.
- Declarative vs. imperative: Saying “run 5 replicas” (declarative desired state) lets controllers react continuously to failures; saying “SSH to node 1 and run
docker run” (imperative) runs once and stops.
Retrieval
- Your team maintains an Ansible script that logs into 5 servers and starts 10 containers. Give two operational events that a declarative orchestrator like Kubernetes handles automatically while that script does not.
(1) If one server fails physically, Kubernetes controllers detect missing replicas against the desired state and reschedule them onto healthy nodes; (2) if traffic spikes, app auto-scaling and built-in service discovery/load balancing add replicas and route traffic to their new IPs without manual host assignment. - A 3-person startup wants to run 4 containerized microservices with minimal operational overhead. Why does the lecture advise against self-managed Kubernetes here, and what alternatives fit better?
Self-managed Kubernetes is complex to install and operate. For a single host, Docker Compose suffices; for small multi-host setups, Swarm or Nomad are simpler; and without an ops team, managed Kubernetes or serverless containers (Google Cloud Run, AWS Fargate) remove control-plane maintenance.
Source: Lecture 10 - Microservices and Containers Orchestration, PDF pages 20–24 (printed slides 20–22, 24–25). For Kubernetes’s internal objects, cluster architecture, and extensibility mechanisms, continue in Lecture 11 - Kubernetes (starting with Kubernetes Principles Controllers and Resource Model and Kubernetes Architecture Control Plane and Scheduling Flow).