ReplicaSets
ReplicaSets ensure a specified number of pod replicas are running at any given time.
ReplicaSet - Maintains 3 Replicas
Auto-replaces failed pods
Mental Model
A ReplicaSet is like an auto-scaling team manager. If someone quits or gets sick, the manager hires a replacement. If too many people are working, some are let go. The team size stays constant.
YAML Example
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: web-replicaset
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: nginxCommon Misconceptions
- ✗ReplicaSets are for rolling updates - FALSE: Use Deployments for that
- ✗ReplicaSets manage pods exactly - FALSE: Use match labels, not names
- ✗Manually created pods count - FALSE: ReplicaSet only manages its own pods
Key Takeaways
- • ReplicaSets ensure a specified number of pod replicas are running at any given time.
- • A ReplicaSet is like an auto-scaling team manager. If someone quits or gets sick, the manager hires ...
- • Check the YAML example for implementation details
- • Be aware of the common misconceptions listed above