What is the difference between Recreate and RollingUpdate strategies and when would you pick Recreate?
BeginnerScenarioDeployments and rollouts
Answer
Situation read → A legacy app holds an exclusive lock on a ReadWriteOnce volume and cannot run two versions together.
What I'd do →
- Use
strategy.type: Recreatefor that Deployment - Expect downtime: all old pods are terminated before new ones start
- Schedule the change in a maintenance window
- Confirm with
kubectl get pods -wthat the old pods are gone before the new ones appear
Why → RollingUpdate overlaps old and new pods. Apps that cannot tolerate two versions, or share a single-attach volume, need Recreate.
Interview tip → Mention that a StatefulSet or a proper RWX volume is often the better long-term fix.
More on Deployments and rollouts
You applied a new image tag and the rollout seems stuck at "1 out of 3 new replicas have been updated". What do you check first?BeginnerHow do you roll back a bad release and verify you are back on the previous version?BeginnerA rollout must never reduce capacity below current replicas. How do you configure the strategy?IntermediateYou need a blue/green deployment without a service mesh. How do you do it with plain Kubernetes?IntermediateHow would you do a canary release with only Deployments and a Service?IntermediateAfter a deploy, pods are Ready but users get 502s for a few seconds. What is happening and how do you fix it?Intermediate