Infrastructure

AKS: diagnose blocked zone spread before relaxing placement

A runbook for explaining Pending pods with topology spread, separating capacity from eligible domains, and validating a repair or temporary placement exception.

03 Dec 2026 azureakskubernetesschedulingtopologyavailabilityobservabilityrunbookrollbackproduction

An AKS deployment stalls: several replicas still serve traffic, but a new pod remains Pending. A FailedScheduling event points to a spread constraint. Switching straight to ScheduleAnyway may get the pod running while concentrating replicas in one zone.

In this fictional incident, an API spreads replicas across three zones and one zone no longer has usable capacity. The task is to explain the scheduler’s calculation and its other filters, then restore capacity or explicitly accept a temporary reduction in resilience.

Preserve evidence and service capacity

Pause competing changes and record the cluster, namespace, deployment, revision, first failure time in UTC and decision owner. Capture available replicas, errors, latency and remaining headroom. Do not delete healthy pods merely to restart scheduling.

Adapt these read-only commands to the authorized environment. Their output can contain infrastructure details.

NS=orders-prod
APP=orders-api
POD=orders-api-example

kubectl -n "$NS" describe pod "$POD"
kubectl -n "$NS" get deploy "$APP" -o yaml
kubectl -n "$NS" get pods -l app=orders-api -o wide --show-labels
kubectl get nodes -L topology.kubernetes.io/zone
kubectl -n "$NS" get events --sort-by=.lastTimestamp

Events are transient and aggregated by reason: preserve the complete message and timestamp. A Pending pod may instead be waiting for an image or volume. Establish that scheduling is failing and read every FailedScheduling reason, not just the first.

Reconstruct the spread calculation

On the actual pod, inspect topologySpreadConstraints, labelSelector, matchLabelKeys, topologyKey, maxSkew, minDomains and whenUnsatisfiable. Compare the labels actually present on pods from both old and new revisions. The selector counts matching pods in the same namespace; a wrong or revision-sensitive selector changes the calculation. Check effective values and field support on the cluster version as well.

For DoNotSchedule, the scheduler compares the matching-pod count in a candidate domain after placement with the global minimum. With three eligible domains containing 2, 2 and 1 pods and maxSkew: 1, placing the next pod in a zone with 2 would produce a skew of 2 against the minimum of 1, so that placement is rejected. The zone with 1 remains a candidate for this constraint, but may still fail other filters.

When fewer domains are eligible than minDomains, the global minimum used is zero; that does not mean every placement is forbidden. If minDomains is omitted, it behaves as 1. Multiple constraints must all be satisfied. ScheduleAnyway expresses a spreading preference, not a guarantee.

Separate eligible domains from usable nodes

Compare node zone labels and state, cordons and taints, the pod’s nodeSelector, affinity, tolerations and resource requests. Check volume constraints and pod or IP limits too. Use kubectl describe node and scheduler events to test these observations against each rejection reason; allocatable resources alone do not establish free capacity.

nodeAffinityPolicy and nodeTaintsPolicy determine which nodes are included in the spread calculation; they do not replace the other scheduling filters. When omitted, they behave as Honor and Ignore respectively. A zone can therefore contribute to the minimum without offering a node on which the pod can actually run. A zone with no node bearing the topology key is not the same as a counted zone with zero pods. Check behavior and feature availability for the version in use.

In AKS, compare this evidence with node pool health in each zone, quotas, VM size availability and free addresses. Adding nodes in another zone does not necessarily fix a zonal constraint. Do not remove a protective taint or widen a toleration without assessing other workloads.

Choose, validate and restore

FindingDecision to assess
Candidate zone lacks usable capacityRestore that capacity or correct the node constraint after analysis.
Selector or labels do not match the intended populationFix the manifest and check both revisions during rollout.
Capacity is unavailable and the service is under pressureAgree a time-limited relaxation with the owner, weighing the risk of losing a zone.

For a temporary change, retain the approved manifest and its GitOps source, set an expiry and owner, and define minimum healthy replicas and stop conditions. Test a representative canary first. Check pods per zone, Ready status, traffic, errors and dependencies. Work through expected placement before expanding; a scheduled pod alone does not prove resilience. Do not promise that ScheduleAnyway ensures placement: other filters still apply.

If thresholds deteriorate, stop the rollout, stabilize the service and restore the previous configuration through GitOps after checking capacity. Restoring the constraint does not automatically redistribute pods already placed. Any later replacement must be gradual, with availability and disruption budgets checked throughout. If the zone cannot be restored, keep the accepted risk visible and escalate rather than declaring rollback complete.

Resume only when the required replicas are ready, placement and application signals meet the approved decision, and every exception has an owner and expiry.

References