Kubernetes · Orchestration under pressure
How does a Deployment work?
Short answer
A Deployment declares a pod template and replica count. It creates a ReplicaSet and replaces it during updates, giving you rolling rollouts, scaling and revision history.
You describe the desired pod template in a Deployment. The Deployment controller creates a ReplicaSet for that template and scales it to the requested replica count. When you change the template, it creates a new ReplicaSet and shifts replicas over according to the rollout strategy.
- Deployments are stateless by assumption; use StatefulSet for stable identity
- The pod template hash becomes part of the ReplicaSet name and revision history
- Scaling a Deployment scales the active ReplicaSet
- Old ReplicaSets are retained for rollback until revisionHistoryLimit is exceeded
- Readiness probes determine when new pods count as available
kubectl create deployment api --image=registry.example.com/api:1.4.2 --replicas=3
kubectl scale deployment api --replicas=6
kubectl rollout status deployment/api
kubectl get deployment api -o wideA Deployment only manages pod replicas. It does not create a Service, a PodDisruptionBudget, or autoscaling. Those are separate objects, and forgetting them is a common reason a rollout looks healthy while traffic still fails.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What object does a Deployment actually create?
- 2How does a Deployment decide a rollout is complete?
- 3When would you use a StatefulSet instead?
- 4What happens to old ReplicaSets after a rollout?
Say it in the interview
A Deployment is the standard workload for stateless services. I declare a pod template and replica count, and the Deployment controller creates a ReplicaSet and shifts replicas during updates. It gives me scaling, rollout status and revision history, but not Services or disruption budgets. I rely on readiness probes and rollout status to judge whether a release is actually healthy.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Kubernetes mock interview and get scored feedback on depth, clarity and confidence.