This README is a step-by-step lab guide to understand how ReplicaSet works with images
and why ReplicaSet is NOT suitable for image rollout.
This lab uses 3 image versions to clearly show:
Is lab ke baad aap clearly samajh jaoge:
docker push riteshatri/replicaset:v1
docker push riteshatri/replicaset:v2
docker push riteshatri/replicaset:v3
⚠️ NOTE: Har image me
index.htmlalag hai taaki browser me clearly difference dikhe
| File | Purpose |
|---|---|
| pod.yaml | Simple pod test |
| replicaset.yaml | ReplicaSet definition |
| service.yaml | Pod expose karne ke liye |
apiVersion: v1
kind: Pod
metadata:
name: ritpod
spec:
containers:
- name: ritcontainer
image: riteshatri/replicaset:v2
ports:
- containerPort: 80
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: replicaset
spec:
replicas: 10
selector:
matchLabels:
humhai: replicaset
template:
metadata:
labels:
humhai: replicaset
spec:
containers:
- name: ritcontainer
image: riteshatri/replicaset:v3
ports:
- containerPort: 80
apiVersion: v1
kind: Service
metadata:
name: ritservice
spec:
selector:
humhai: replicaset
ports:
- port: 6541
targetPort: 80
type: LoadBalancer
kubectl get pods
kubectl apply -f pod.yaml
kubectl port-forward pod/ritpod 7417:80
👉 Browser open karo:
http://localhost:7417
kubectl get pods
kubectl apply -f replicaset.yaml
kubectl get replicaset
kubectl get pods
kubectl get pods -o wide --show-labels
👉 Verify:
kubectl get service
kubectl apply -f service.yaml
kubectl get service
Browser me open karo:
http://<EXTERNAL-IP>:<SERVICE-PORT>
Example:
http://40.127.217.237:6541
kubectl get endpoints ritservice
kubectl get endpoints ritservice -o wide
kubectl describe service ritservice
kubectl describe endpoints ritservice
📌 Ye confirm karta hai ki:
replicaset.yamlimage: riteshatri/replicaset:v2
Apply:
kubectl apply -f replicaset.yaml
kubectl get rs
kubectl get pods
👉 ReplicaSet image rollout nahi karta
kubectl apply -f replicaset.yaml
kubectl get rs
kubectl get pods
kubectl apply -f replicaset.yaml
👉 Ab bhi:
kubectl get pods
kubectl delete pod replicaset-2zfgb replicaset-75w95 replicaset-7qxn2
👉 Ab kya hoga:
Browser refresh karo 👇
👉 Ab NEW IMAGE dikhai degi
| Action | Result |
|---|---|
| Image update | ❌ No effect |
| Replica increase | ❌ Old image |
| Pod delete | ✅ New image |
| Service | ✅ Load balance |
ReplicaSet = Pod count ka boss, Image ka nahi 😄
✔ ReplicaSet pod count maintain karta hai
✔ Image rollout nahi karta
✔ Manual delete required
✔ Production ke liye suitable nahi
✔ Deployment is the solution
👉 Deployment (Recreate Strategy)
👉 Deployment (RollingUpdate Strategy)
Created for Kubernetes Hands-on Learning
Happy Learning ☸️🔥
Content type
Image
Digest
sha256:306d1442e…
Size
21.9 MB
Last updated
9 months ago
docker pull riteshatri/replicaset:v3