ReplicaSets: keeping copies alive
How Kubernetes keeps N running.
In plain terms
A ReplicaSet is a manager told “always keep three of these on shift.” One clocks out, it calls a replacement; too many showed up, it sends one home.
So what keeps three copies of your app running? A ReplicaSet. Its entire job is to match a number: you say “three,” and it makes sure exactly three matching pods exist at all times.
If a pod disappears, the ReplicaSet notices the count dropped and creates a replacement. If somehow there are too many, it removes one. You almost never create a ReplicaSet yourself — a Deployment creates and manages it for you — but this counting is the engine behind scaling and self-healing.
terminal
$ kubectl get rsNAME DESIRED CURRENT READY AGEweb-7d4b 3 3 3 2m# DESIRED is what you asked for; CURRENT/READY is reality catching up
The copies are identical
Every pod a ReplicaSet makes comes from the same template, so they are interchangeable — any one can handle any request. That is what lets Kubernetes freely add, remove, and replace them.