What is a ReplicaSet and why do you rarely create one directly?
BeginnerScenarioDeployments and rollouts
Answer
Situation read → A new teammate asks why kubectl get rs shows several ReplicaSets for one Deployment.
What I'd do →
kubectl get rs -l app=webto list them- Note that old ReplicaSets are scaled to 0 and kept for rollback
kubectl describe rs <name>shows the owner Deployment- Limit the clutter with
revisionHistoryLimit: 5
Why → A Deployment owns one ReplicaSet per pod-template revision. Rolling updates are just scaling one up and another down.
Interview tip → Say you always create Deployments, which add rollout and rollback on top of ReplicaSets.
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?IntermediateWhat is the difference between Recreate and RollingUpdate strategies and when would you pick Recreate?Beginner