Posts

Showing posts with the label Affinity

KB: Kubernetes Affinity

Affinity rules in Kubernetes are constraints that influence the scheduling of pods based on certain conditions. These rules help you control the placement of pods on nodes or in relation to other pods, ensuring optimal performance, resource utilization, and reliability. Affinity rules come in three main types: node affinity , pod affinity , and pod anti-affinity . Practical Use Cases Node Affinity: Ensuring pods with high memory requirements are scheduled on nodes with high memory capacity. Pod Affinity: Scheduling web servers close to caching servers to reduce latency. Pod Anti-Affinity: Spreading replicas of a service across different nodes to ensure high availability. By using affinity and anti-affinity rules, Kubernetes administrators can fine-tune pod scheduling to meet specific application requirements and optimize the cluster's overall performance. Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector