All-Things-Docker-and-Kubernetes

Pod Affinity

Like Node Affinity, Pod Affinity is used to constrain the nodes that can receive Pods by matching labels of the existing Pods that are already running on the nodes.

The main difference between the two affinities are:

Pod affinities also support the same operators as Node affinity:

However, the conditions are specific for the Pod labels, not the node labels. This means the conditions are evaluated based on the labels of the Pods running on each node.

After the conditions are evaluated, the topology key is used in deciding the node in which the pod will be scheduled on. This key usually corresponds to a physical domain such as datacenter, region, server rack, etc.


Back to first page