Skip to content
Latchkey

What Is Pod Affinity?

Pod affinity is a scheduling rule that places a pod on a node based on the labels of other pods already running there. Affinity attracts pods toward each other for locality, while anti-affinity spreads them apart for resilience. The rules are scoped by a topology key such as node, zone, or region.

Why it matters

Anti-affinity spreads replicas across failure domains so a single node or zone loss does not take down a whole service. Affinity co-locates tightly coupled pods to cut cross-node network latency.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →