Introduction
Sometimes you want your app to run on specific computers in your cluster or avoid certain ones. Node affinity and anti-affinity help you tell Kubernetes where to place your app pods based on labels on the nodes.
When you want your app to run only on nodes with special hardware like GPUs.
When you want to keep your app pods away from nodes that run other critical apps to avoid resource conflicts.
When you want to spread your app pods across different nodes for better availability.
When you want to schedule pods on nodes in a specific data center or zone.
When you want to avoid placing multiple pods of the same app on the same node to reduce risk.