The previous lesson listed the triggers for outgrowing single-host Compose.
This one is about what you are actually adopting when you act on them β
because the three orchestrators differ wildly in size and ecosystem, and are
identical in the one mechanism that changes how you work.
That mechanism is a control loop. Everything operationally strange about
orchestrators, and everything they cost, comes from it.
Imperative and declarative
The consequence people meet on day one is that imperative commands stop
working. Kill a container that an orchestrator is managing and it comes
back within seconds, on that node or another:
Service impact possiblefutileβ Removing a managed container does not remove it.
Same task, new container ID, four seconds later. This is not a bug and it is
not something to fight. To stop a service you change the desired state β
scale it to zero, or remove the service object β and the loop does the rest.
What the loop is good at
The loop is why an orchestrator can offer things a single host cannot:
Self-healing. A node dies, the controller observes that three of four
replicas exist, and places the fourth somewhere else. No human involved.
Rolling updates. Changing the image in the desired state makes the diff
non-zero for every replica; the controller works through them at whatever
parallelism you configured, checking health as it goes.
Rescheduling. Draining a node for maintenance is a desired-state change
(βno work on this nodeβ), and the loop moves everything off it.
Convergence after partial failure. A deploy interrupted halfway leaves
the desired state intact, so the loop finishes the job when the control
plane comes back.
None of that is free.
What the loop costs
What an orchestrator does not do
It is worth being blunt, because this is where most disappointment comes
from.
Problem
Does an orchestrator solve it?
A node dies and stateless replicas must move
Yes
Rolling out a new image without downtime
Yes
Spreading work across hosts by resource fit
Yes
Making a single-writer database highly available
No β that is the databaseβs replication and failover, not the schedulerβs
Data that must follow a container between nodes
No β you need shared or replicated storage, which is its own project
An application that cannot run two copies at once
No β it makes it worse, because the loop wants to run two during an update
Sticky sessions held in local memory
No
Deciding what βhealthyβ means
No β you still write the health check, and a wrong one causes rolling restarts of a working service
An orchestrator schedules processes. It does not make an application
distributed, and pointing one at a stateful monolith usually produces a
less reliable system than the single host it replaced, because there are now
two things that can fail.
Knowledge check
Knowledge check Β· 4 questions
Q1. What does an orchestrator do that a Docker restart policy does not?
Q2. `docker service update` and `kubectl apply` return once the desired state has been accepted, which can be well before reality has converged to match it.
Q3. Which new operational obligations does adopting an orchestrator create? Select all that apply.
Q4. Four replicas are requested; three are running and the fourth never appears. Where do you look first?
Passing score: 75%. Answers are checked in this browser.