Add description of replica controller scaledown sort logic

pull/26993/head
Mike Dame 2021-03-10 12:16:54 -05:00
parent 74b2a80ef2
commit 10162f7776
1 changed files with 11 additions and 0 deletions

View File

@ -310,6 +310,17 @@ assuming that the number of replicas is not also changed).
A ReplicaSet can be easily scaled up or down by simply updating the `.spec.replicas` field. The ReplicaSet controller
ensures that a desired number of Pods with a matching label selector are available and operational.
When scaling down, the ReplicaSet controller chooses which pods to delete by sorting the available pods to
prioritize scaling down pods based on the following general algorithm:
1. Pending (and unschedulable) pods are scaled down first
2. If controller.kubernetes.io/pod-deletion-cost annotation is set, then
the pod with the lower value will come first.
3. Pods on nodes with more replicas come before pods on nodes with fewer replicas.
4. If the pods' creation times differ, the pod that was created more recently
comes before the older pod (the creation times are bucketed on an integer log scale)
If all of the above match, then selection is random.
### ReplicaSet as a Horizontal Pod Autoscaler Target
A ReplicaSet can also be a target for