K8s by Example: ReplicaSets
| A ReplicaSet ensures N identical Pods are running at all times. It implements self-healing: if a Pod fails, the ReplicaSet creates a replacement. You rarely create ReplicaSets directly since Deployments manage them for you. |
| replicaset.yaml | |
| ReplicaSets use the | |
| The Pod template defines the Pods. Labels must match the selector. | |
| terminal | |
| ReplicaSets run a reconciliation loop, constantly comparing desired state vs actual state. Delete a Pod and watch it get replaced. | |
| terminal | |
| DESIRED vs CURRENT is always reconciled automatically. This is the core of Kubernetes self-healing. | |
| terminal | |
| Deployments create a new ReplicaSet for each Pod template change. The RS name is deployment-name + pod-template-hash. | |
| terminal | |
| ReplicaSets use owner references to track Pods. When you delete a ReplicaSet, Kubernetes cascades the deletion to its Pods (all Pods are also deleted). | |
| replicaset-labels.yaml | |
| The selector links the ReplicaSet to its Pods. Pods must have all labels in the selector. Extra labels in the Pod template are fine. | |
| terminal | |
| Warning: scaling ReplicaSet replicas directly ( | |