Orchestration Concepts (Scheduling, Self-Healing, Desired State)
Learn scheduling, desired state, and self-healing ideas shared by Swarm and Kubernetes.
In plain words
Describe desired state and SLO constraints, not imperative one-time commands, when the system spans many nodes and churn.
Think of it like…
Orchestration is a thermostat: a target is declared, sensors report reality and a controller repeatedly adjusts the machinery, but it cannot fix a broken heater.
Where you’ve seen it
In practice, docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1 is the concrete move for this job: learn scheduling, desired state, and self-healing ideas shared by Swarm and Kubernetes. The release is not accepted until drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns confirms the result.
Words you’ll hear
- Scheduling
- The implementation control in
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1for learn scheduling, desired state, and self-healing ideas shared by Swarm and Kubernetes. - Desired State
- The result to observe with
drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns, rather than infer from a successful command alone. - Self-Healing
- The production boundary exposed when describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests.
Visual diagram
Theory & deep dive
Scheduling control path
The concrete mechanism is docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1. The observable result is drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns; if those disagree, inspect the runtime evidence before changing unrelated settings.
Learn scheduling, desired state, and self-healing ideas shared by Swarm and Kubernetes. Keep Scheduling, Desired State and Self-Healing in the same deployment record so the intent and the observed state cannot drift apart.
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1
drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns, not with command success alone.Self-Healing failure boundary
A scheduler can only use declared requests/limits and health. Without readiness, a replacement is scheduled but traffic may reach it too soon; without resource request it can be placed on an exhausted node. The narrow failure to design for is describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests.
Accept this compromise explicitly: Declarative reconciliation improves scale and recovery; controllers require stable APIs, observability and well-defined failure behavior. The controlled check-drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns-also identifies the point where a different design is safer.
Exercise this failure safely: describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests.
How it works, step by step
Step 1 of 41. State the boundary
Write down why the workload needs this: A scheduler can only use declared requests/limits and health. Without readiness, a replacement is scheduled but traffic may reach it too soon; without resource request it can be placed on an exhausted node.
- Intent
- Scheduling
When to use it & trade-offs
What it is
An orchestrator continuously compares desired state-replica count, placement and resources-with observed state, schedules workloads to eligible nodes and reconciles failures. Self-healing means controllers create/replace objects within policy, not that bugs or data inconsistencies disappear.
Why it matters: A scheduler can only use declared requests/limits and health. Without readiness, a replacement is scheduled but traffic may reach it too soon; without resource request it can be placed on an exhausted node.
When to reach for it
- The fit is strongest for this job: learn scheduling, desired state, and self-healing ideas shared by Swarm and Kubernetes. Pair it with
drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returnsin the runbook. - Production Scheduling changes should make Desired State observable through
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1, rather than trusting the runtime default. - Keep a rollback example for the case where describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests.
When to avoid or be careful
- Do not accept command success while the system can still fail by describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests.
- Avoid erasing Self-Healing protection merely to dodge this cost: “Declarative reconciliation improves scale and recovery; controllers require stable APIs, observability and well-defined failure behavior”.
- Do not replace the evidence path-
drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns-with a screenshot or a mutable tag.
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1: practical choices
Strengths: An orchestrator continuously compares desired state-replica count, placement and resources-with observed state, schedules workloads to eligible nodes and reconciles failures. Self-healing means controllers create/replace objects within policy, not that bugs or data inconsistencies disappear.
Watch out: Declarative reconciliation improves scale and recovery; controllers require stable APIs, observability and well-defined failure behavior.
Strengths: It can begin with docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1 and fewer surrounding controls.
Watch out: It silently accepts describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests, which makes the result hard to reproduce after promotion.
Strengths: A scheduler can only use declared requests/limits and health. Without readiness, a replacement is scheduled but traffic may reach it too soon; without resource request it can be placed on an exhausted node.
Watch out: The platform adds an ownership and debugging layer; retain drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns as the direct check.
Interview signals & numbers to know
When this topic comes up
- docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1
- drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns
- Failure signature: describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests
- Trade-off: Declarative reconciliation improves scale and recovery; controllers require stable APIs, observability and well-defined failure behavior.
Benchmarks & rules of thumb
- 3 control-loop parts
- desired, observed and reconciler
- 3 replicas
- example desired state
- 1 placement constraint
- zone= a in the example
Common mistakes & follow-ups
Common interview mistakes
- Treating a successful
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1as proof and skippingdrain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns. - Describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests
- Optimizing Scheduling without accepting that declarative reconciliation improves scale and recovery; controllers require stable APIs, observability and well-defined failure behavior.
Likely interviewer follow-ups
- Why does
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1address Scheduling here rather than through application code? - How would you distinguish healthy Desired State from the failure “describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests” using
drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns? - When would this trade-off-“Declarative reconciliation improves scale and recovery; controllers require stable APIs, observability and well-defined failure behavior”-justify a different Self-Healing design?
docker service create --replicas 3 --constraint node.labels.zone==a --limit-cpu .5 --name api api:2.1-and one proof-drain or stop one node, inspect service convergence and confirm traffic remains after the desired replica count returns. Then name the boundary: describing self-healing as “it never goes down,” or relying on desired replicas without readiness and resource requests.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Orchestration Concepts (Scheduling, Self-Healing, Desired State) with generative AI interview Q&A and hands-on practice.