Skip to main content

What is Pod Affinity/Anti-Affinity?

Junior Kubernetes
Quick Answer Pod Affinity schedules a Pod near other Pods with specific labels รขโ‚ฌโ€ useful when two services communicate heavily and benefit from co-location. Pod Anti-Affinity spreads Pods away from each other รขโ‚ฌโ€ put replicas on different nodes so a single node failure doesn't take down all replicas. Both use topology keys (node, zone, region) to define "near" and "far."

Answer

Affinity co-locates Pods; anti-affinity spreads them for HA.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice