DevOps Dictionary

A straightforward reference for DevOps terms and concepts.

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

Kubernetes Pod Affinity and Anti-Affinity

Container Orchestration

Kubernetes Pod Affinity and Anti-Affinity are scheduling rules that place a Pod based on the labels of Pods already running. Affinity puts a Pod close to matching Pods (for example, an app next to its cache on the same node), and anti-affinity keeps it away from them, which spreads replicas across nodes or zones. A topology key defines what "close" means, and each rule is either required or preferred.

Patent-style sketch of Kubernetes Pod Affinity and Anti-Affinity: a scheduler crane setting pod boxes onto two node platforms, two pods placed together on one platform and two replicas kept apart on different platforms, labelled 10 SCHEDULER, 12 NODES, 14 PLACED TOGETHER, 16 KEPT APART.

See also Kubernetes Pod Topology Spread Constraints, Kubernetes PodDisruptionBudget (PDB), Kubernetes PriorityClass, Kubernetes Readiness Probe, Kubernetes ReplicaSet, Kubernetes Resource Requests and Limits.