Back to all scenarios
Scenario #67
Cluster Management
K8s v1.23, Azure AKS
Unsuccessful Pod Scaling Due to Affinity/Anti-Affinity Conflict
Pod scaling failed due to conflicting affinity/anti-affinity rules that prevented pods from being scheduled.
Find this helpful?
What Happened
A deployment’s pod scaling was unsuccessful due to the anti-affinity rules that conflicted with available nodes.
Diagnosis Steps
- 1Checked pod scaling logs and identified unschedulable errors related to affinity rules.
- 2Reviewed affinity/anti-affinity settings in the pod deployment configuration.
Root Cause
The anti-affinity rule required pods to be scheduled on specific nodes, but there were not enough available nodes.
Fix/Workaround
• Relaxed the anti-affinity rule to allow pods to be scheduled on any available node.
• Increased the number of nodes to ensure sufficient capacity.
Lessons Learned
Affinity and anti-affinity rules should be configured carefully, especially in dynamic environments with changing node capacity.
How to Avoid
- 1Test affinity and anti-affinity configurations thoroughly.
- 2Use flexible affinity rules to allow for dynamic scaling and node availability.