Junior — Middle
Explain what pod deletion in Kubernetes is and what it is used for.
sobes.tech AI
Answer from AI
In Kubernetes, deleting a pod is the process of removing a Pod object from the cluster. A pod is the smallest deployable unit that contains one or more containers.
Pod deletion is applied in the following cases:
- Application update: when deploying a new version, pods are deleted and recreated with the updated image.
- Scaling: when decreasing the number of replicas, pods are deleted.
- Cleaning up non-functioning or stuck pods.
- Resource management and maintaining the desired state of the cluster.
It is important to note that when using controllers (e.g., Deployment), deleting a pod results in the creation of a new one to maintain the specified number of replicas.
Example command to delete a pod:
kubectl delete pod <pod-name>