You need a blue/green deployment without a service mesh. How do you do it with plain Kubernetes?
IntermediateScenarioDeployments and rollouts
Answer
Situation read → The team wants instant cutover and instant rollback for a payments service.
What I'd do →
- Run two Deployments,
app-blueandapp-green, each with aversionlabel - Point the Service selector at
version: blue - Deploy and test green through a separate Service or port-forward
- Cut over with
kubectl patch svc app -p '{"spec":{"selector":{"app":"app","version":"green"}}}' - Keep blue running until you are confident, then scale it down
Why → A Service selector is evaluated continuously, so changing it re-points endpoints within seconds and the change is trivially reversible.
Interview tip → Mention the cost: you run double capacity during the window, and DB schema changes must be backward compatible.
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?IntermediateHow would you do a canary release with only Deployments and a Service?IntermediateWhat is the difference between Recreate and RollingUpdate strategies and when would you pick Recreate?BeginnerAfter a deploy, pods are Ready but users get 502s for a few seconds. What is happening and how do you fix it?Intermediate