What is the main purpose of podAffinity in Kubernetes?
easy📝 Conceptual Q11 of 15
Kubernetes - Scheduling
What is the main purpose of podAffinity in Kubernetes?
ATo automatically restart pods on failure
BTo prevent pods from running on the same node
CTo limit the number of pods per node
DTo schedule pods close to other pods with matching labels
Step-by-Step Solution
Solution:
Step 1: Understand podAffinity concept
Pod affinity is used to place pods close to other pods that have specific labels, improving communication or resource sharing.
Step 2: Compare options with podAffinity purpose
Only To schedule pods close to other pods with matching labels describes placing pods close to others with matching labels, which matches podAffinity's goal.
Final Answer:
To schedule pods close to other pods with matching labels -> Option D
Quick Check:
podAffinity = place pods close [OK]
Quick Trick:Affinity means placing pods near each other [OK]
Common Mistakes:
Confusing affinity with anti-affinity
Thinking affinity limits pods per node
Mixing affinity with pod restart policies
Master "Scheduling" in Kubernetes
9 interactive learning modes - each teaches the same concept differently