Pod Deletion Cost Architecture

Pod Deletion Cost Architecture An architecture diagram generated by Archify. Scale-down Request · replicas decreased · ReplicaSet Controller Scale-down Request replicas decreased ReplicaSet Controller · decides which pods to delete · ReplicaSet Controller ReplicaSet Controller decides which pods to delete Get Pod List · pods owned by the ReplicaSet · Pod Selection Process Get Pod List pods owned by the ReplicaSet Check Deletion Cost Annotation · read pod-deletion-cost value · Pod Selection Process Check Deletion Cost Annotation read pod-deletion-cost value Sort by Cost · lowest → highest · Pod Selection Process Sort by Cost lowest → highest Select Low Cost Pods · as many as replicas removed · Pod Selection Process Select Low Cost Pods as many as replicas removed Pod-1 · cost: 100 · Pods owned by the ReplicaSet Pod-1 cost: 100 Pod-2 · cost: 50 · Pods owned by the ReplicaSet Pod-2 cost: 50 Pod-3 · cost: -10 · Pods owned by the ReplicaSet Pod-3 cost: -10 Pod-4 · cost: 0 · Pods owned by the ReplicaSet Pod-4 cost: 0 Deleted Pods · Pod-3, Pod-4 · Architecture component Deleted Pods Pod-3, Pod-4 Pod-3, then Pod-4 Delete first Delete next ReplicaSet Controller Pod Selection Process Pods owned by the ReplicaSet Legend Controller processing step Deletion candidate pod Scale-down request / deletion result

Pod Deletion Cost Concept

  • • Introduced in Kubernetes 1.22
  • • Assigns a cost value to each pod through the controller.kubernetes.io/pod-deletion-cost annotation
  • • Controls which pods are deleted first when a ReplicaSet, Deployment, or StatefulSet scales down

Key Features

  • • Default value: 0
  • • Range: -2147483648 to 2147483647 (int32)
  • • Higher value = more important pod (deleted later)
  • • Lower value = less important pod (deleted first)