What happens when you delete a Pod that belongs to a Deployment?
The ReplicaSet notices the count is below the desired replicas and immediately creates a replacement Pod with a new name and IP. To really remove the app, delete or scale the Deployment instead.
Explain it simply
Remove one player from a team of eleven mid-match and the captain calls a substitute at once. The team size is the desired state; the substitute is the new Pod.
The Deployment's ReplicaSet runs a control loop comparing desired replicas with actual. After kubectl delete pod web-abc12, it sees 2 of 3 and creates web-xyz98. The new Pod gets a new name and IP, and may land on a different node. While it starts, the Service stops sending traffic to the deleted Pod and waits for the new one to pass readiness. This self-healing is why Kubernetes is called declarative: you state what you want, not what to do.
To stop the app, use kubectl delete deployment web or kubectl scale deployment web --replicas=0.
Example
kubectl get pods
kubectl delete pod web-7d4b9c6f5-abc12
kubectl get pods # a new pod appears within seconds
kubectl scale deployment web --replicas=0 # actually stopWhat to say in the interview
"The ReplicaSet controller sees fewer Pods than desired and creates a replacement with a new name and IP. To stop the workload I delete or scale down the Deployment, not the Pod."
Common mistakes
- Deleting Pods repeatedly to stop an app instead of scaling the Deployment.