Interactive visualization of ReplicaSet controller behavior
ReplicaSet is maintaining the desired replica count
ReplicaSet controller creates new pods when desired > current
Process: New pods created → ContainerCreating → Running
Controller terminates excess pods when current > desired
Process: Pods marked for deletion → Terminating → Removed
Automatically replaces failed pods to maintain desired count
Trigger: Pod crash, node failure, or manual deletion
Manual: kubectl scale or edit replicas field
HPA: Automatic scaling based on CPU/memory metrics
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend-rs
labels:
app: frontend
spec:
replicas: 5 # Desired number of pod replicas
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: nginx
image: nginx:1.21
ports:
- containerPort: 80
# Scale manually:
kubectl scale replicaset frontend-rs --replicas=3
# View ReplicaSet status:
kubectl get replicaset frontend-rs