Resolving Pending HPA Pods with AKS Node Autoscaling

AI-200 By islever Editorial Last updated

Implement container-orchestrated solutions

Short answer

D Enable node autoscaling, such as the AKS cluster autoscaler, so new nodes can satisfy the resource requests of pending pods while the HPA continues to set replica count.

Question

A horizontal pod autoscaler increases the desired replica count, but new pods remain pending because no node has capacity. What change addresses the unmet constraint?
  1. Raise the autoscaler's maximum replica count again.
  2. Add a public Service for the pending pods.
  3. Restart the pending pods until a node accepts them.
  4. Autoscale node capacity as well as pod replicas. Correct Answer

Key Takeaways

Horizontal pod autoscaling in AKS adjusts replica counts but cannot create node capacity; when new pods stay Pending, enabling node autoscaling is the change that satisfies their resource requests. Raising the HPA maximum, adding a Service, or restarting pods does not add schedulable compute.

Expert Analysis

The horizontal pod autoscaler has already requested additional replicas, so pod demand is being calculated correctly. The remaining constraint is node capacity: pending pods have nowhere to be scheduled. Autoscaling node capacity adds compute when scheduling demand exceeds available resources, while pod autoscaling continues to adjust the desired application replica count.

The decisive distinction is between a desired replica count and the schedulable compute that must back it. The horizontal pod autoscaler has already raised the replica target because its CPU, memory, or custom metric crossed the configured threshold; that action changes a Deployment or ReplicaSet's desired count, not the cluster's inventory of nodes. Once every existing node has allocated its available CPU and memory to running pods, the extra replicas exist only as Pod objects waiting for placement.

The missing mechanism is the scheduler's resource-fit predicate. For every new pod, the scheduler compares the pod's container resource requests with each node's allocatable capacity minus what is already requested by pods assigned there. If the HPA's new desired count causes the aggregate requests to exceed the remaining allocatable capacity on all nodes, every candidate node is filtered out and the pod remains Pending. Requests, not live utilization, drive that decision: an idle node whose CPU is not requested still rejects a pod that requests more CPU than its allocatable amount. The practical symptom is a Pending pod whose events cite insufficient CPU or memory, while the HPA reports that it has met or raised its desired replica count.

Option D addresses that unmet constraint directly. Enabling node autoscaling on the AKS node pool lets the cluster autoscaler observe pods that cannot be scheduled and add nodes to the pool, after which the scheduler can place the pending replicas. The two autoscalers remain complementary: the horizontal pod autoscaler continues to translate application load into a replica target, while node autoscaling translates unschedulable demand into additional compute. This preserves the HPA's decision rather than overriding it.

Option A only moves the pod-side ceiling. Raising the HPA's maximum replica count permits a larger desired count but supplies no additional node capacity; if new replicas are already pending, a higher maximum only allows more pods to join the same unschedulable queue. It answers a different problem—preventing the HPA from stopping at its configured maximum—and leaves the node-capacity constraint intact.

Option B changes network exposure. Adding a public Service creates a stable virtual IP and load-balancing rules for pods that are Ready, but a Pending pod has no node, no running container, and therefore no endpoint to route to. Service creation cannot make the scheduler accept a pod, so it does not address the capacity shortage and could produce a Service with no healthy backends.

Option C attempts to force placement by churn. Restarting a pending pod causes it to be deleted and recreated, but the scheduler re-evaluates the same resource requests against the same nodes and reaches the same result. Repeated restarts add control-plane work and can obscure the real event, while never creating the CPU or memory the pod requests. A restart is appropriate for a crashed container, not for an unschedulable one.

Operationally, the fix should be validated at both layers: confirm pending-pod events point to insufficient resources, verify the node pool's autoscaling bounds leave room to add nodes, and then let the cluster autoscaler scale up. If the node pool is already at its maximum node count, that bound—not the HPA maximum—is the next constraint to adjust. The durable design pairs HPA replica scaling with node autoscaling and resource requests that accurately describe each workload, so pending replicas trigger compute growth instead of accumulating indefinitely.

Official Reference

Exam Strategy

Separate the replica-scaling control loop from the node-capacity control loop. When an autoscaler has increased the desired count but pods remain Pending, look for evidence that the scheduler cannot fit their resource requests, then choose the action that adds nodes rather than one that only changes the replica ceiling, exposes a Service, or restarts pods. This pattern transfers to any Kubernetes question where a controller has made the right scaling decision but the underlying compute is missing.

Practice All AI-200 Questions

Access 69 questions with complete answers and detailed explanations.

View Full AI-200 Practice Test →

← Back to AI-200 Study Guide