Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between pod deletion and pod eviction?

From PodInterface the two operations Delete and Evict seems having the same effect: deleting the old Pod and creating a new Pod.

If the two operations have the same effect, why do we need two API to delete a Pod and create a new one?

like image 718
flyer Avatar asked Jan 24 '23 23:01

flyer


1 Answers

Deletion of a pod is done by an end user and is a normal activity. It means the pod will be deleted from ETCD and kubernetes control plane. Unless there is a higher level controller such as deployment, daemonset, statefulset etc the pod will not be created again and scheduled to a kubernetes worker node.

Eviction happens if resource consumption by pod is exceeded the limit and kubelet triggers eviction of the pod or a user performs kubectl drain or manually invoking the eviction API. It's generally not not a normal activity .Sometimes evicted pods are not automatically deleted from ETCD and kubernetes control plane. Unless there is a higher level controller such as deployment, daemonset, statefulset etc the evicted pod will not be created again and scheduled to a kubernetes worker node.

It's preferable to use delete instead of evict because evict comes with more risk compared to delete because eviction may lead to in some cases, an application to a broken state if the replacement pod created by the application’s controller(deployment etc.) does not become ready, or if the last pod evicted has a very long termination grace period

like image 192
Arghya Sadhu Avatar answered May 14 '23 05:05

Arghya Sadhu