Practical technical guides / Core IT: Kubernetes scheduling

A Pod Stays Pending on a Half-Empty Cluster: Requests, Allocatable and Fragmented Free Capacity

A pod requesting 1.5 CPU stays Pending with 4.6 cores free: requests not usage, allocatable not capacity, and fragmented free space. Worked numbers and three fixes.

By Sandeep Belgavi · Published 2026-11-06

A pod requesting 1.5 CPU stays Pending with 4.6 cores free: requests not usage, allocatable not capacity, and fragmented free space. Worked numbers and three fixes.

Pending, with 4.6 cores free

The catalogue team at Belgavi's Book Store deployed a new indexer to their four-node Kubernetes cluster. It asked for 1.5 CPU and 3 GiB of memory. It stayed in Pending. The cluster dashboard showed the nodes at about 30 percent CPU usage, and a quick sum of free requestable CPU across the cluster came to 4.6 cores, three times what the pod needed. Someone suggested the scheduler was broken.

It was not. Three separate facts explain the event, and each one has a different fix: the scheduler places pods by requests, not usage; each node offers only its allocatable resources, not its capacity; and free capacity spread across nodes is not free capacity on any one node. This guide works through the numbers on a synthetic cluster with the companion calculation.

Requests, not usage

The Kubernetes documentation on resource management states the rule plainly: "The scheduler ensures that, for each resource type, the sum of the resource requests of the scheduled containers is less than the capacity of the node." It adds that even when "actual memory or CPU resource usage on nodes is very low, the scheduler still refuses to place a Pod on a node if the capacity check fails."

So the 30 percent usage on the dashboard is irrelevant to placement. What counts is the sum of requests of every pod already bound to the node, including DaemonSet pods such as log agents, which are easy to forget because nobody deployed them for this application.

Allocatable, not capacity

The node does not offer all of its capacity either. The kubelet reserves resources for itself and the operating system. In the documentation's words, it "calculates 'Allocatable' by subtracting kubeReserved, systemReserved, and the eviction thresholds from the node's Capacity", and "the scheduler does not over-subscribe 'Allocatable'".

The synthetic nodes have 4 CPU and 16 GiB each, with these settings:

SettingCPUMemory
Capacity4000m16384 Mi
kubeReserved200m1024 Mi
systemReserved100m512 Mi
Hard eviction thresholdnone100 Mi
Allocatable3700m14748 Mi

kubectl describe node prints both Capacity and Allocatable, and the difference is usually the first surprise: here 300 millicores and about 1.6 GiB per node are not available to pods at all.

Fragmentation, not shortage

Now subtract the requests already on each node:

NodePods and their CPU requestsRequestedFree CPU
node-acatalogue-api 1000m, search 1500m, log-agent 100m2600m1100m
node-borders 2000m, recommender 600m, log-agent 100m2700m1000m
node-chelpdesk-agent 1500m, nightly-report 1000m, log-agent 100m2600m1100m
node-dpayments 2200m, log-agent 100m2300m1400m

Free CPU adds up to 4,600 millicores, but the largest single block is 1,400 on node-d, and the indexer needs 1,500. Every node fails the CPU check, and the calculation produces the summary the scheduler would report:

0/4 nodes are available: 4 Insufficient cpu.

The documentation's own example of this event reads 0/42 nodes available: insufficient cpu; the exact wording varies between Kubernetes versions, but the shape is the same: a count of nodes and the reason each one failed. Read the reasons, not the count. If some nodes say Insufficient memory and others Insufficient cpu, no node has both, which is a different problem from every node lacking CPU. If the reasons are about taints, affinity or volume zones, resources are not the issue at all.

Memory, priority and preemption

Memory follows the same arithmetic. Here each node has between 8.2 and 11.2 GiB of memory unrequested, so the indexer's 3 GiB fits everywhere and memory is not the problem. Had the pod asked for 12 GiB, every node would have reported insufficient memory instead, and no amount of CPU tuning would help. The calculation reports the two resources separately for that reason.

Priority changes the picture. If the indexer had a PriorityClass higher than some running pods, the scheduler would try preemption: evicting lower-priority pods on one node to make room. The scheduler's message then includes what preemption found. Preemption is a policy decision, not a fix for over-requesting: it moves the shortage to whichever workload has the lowest priority, so give batch jobs such as the nightly report a low class deliberately rather than discovering the order during an incident.

Three fixes, in order of preference

Right-size the request. The indexer's request came from a guess. The companion example takes 200 synthetic CPU usage samples, takes the 95th percentile, adds 20 percent headroom and rounds up to 50 millicores:

def usage_based_request(samples_m, headroom=1.2):
    s = sorted(samples_m)
    p95 = s[min(len(s) - 1, int(round(0.95 * (len(s) - 1))))]
    v = int(p95 * headroom)
    return v + (-v) % 50

That gives 1,050 millicores, and the pod then fits on node-a, node-c and node-d. Requests set from measured usage are the fix that also helps every future pod. Keep memory requests close to real peak usage too, because memory is not compressible: a container that exceeds its memory limit is killed, while CPU above its limit is throttled.

Consolidate. One movable pod is in the way. If the recommender (600m) moved from node-b to node-a, node-b would have 1,600m free and the indexer would fit there. The example searches for exactly such a single move. In a real cluster that is the job of the descheduler project, which evicts pods according to policies so the scheduler can place them better, or of a deliberate manual drain. Only move pods whose disruption you have accounted for with PodDisruptionBudgets.

Change node shape. If large pods are normal, many small nodes waste capacity in fragments. Larger nodes, or a separate node pool for large pods, reduce fragmentation. A cluster autoscaler would add a node for a Pending pod if a node group could fit it, which is why autoscaled clusters rarely show this symptom for long, at the cost of a node that may stay mostly empty.

What not to do: remove requests from the pod. A pod without requests is scheduled anywhere and competes for CPU with everything else; on a busy node the indexer would then slow down the payments service that did declare its needs.

Finding it in a real cluster

  1. kubectl describe pod <name> and read the FailedScheduling event: which resource, on how many nodes.
  2. kubectl describe node for the candidate nodes: compare Allocatable with the Allocated resources section, which lists the sum of requests and limits.
  3. Include DaemonSets and system pods in the sum. They are on every node and their requests are rarely small in total.
  4. Compare the pod's request with the largest free block, not with the cluster total.
  5. If the request looks too large, check usage history before shrinking it, and change it in the workload definition, not by hand on the running object.

Failure modes

  • Usage-based dashboards hiding request saturation. Add a panel for requested over allocatable per node; it is the number the scheduler uses.
  • A request copied from another service. Every template default becomes fragmentation later.
  • Init containers. If an init container requests more than the containers that run after it, the documentation says the pod's request is based on that init container request, and the node keeps it reserved even after initialization finishes. A heavy init step can block scheduling of a light pod.
  • Limits mistaken for requests. When only limits are set, Kubernetes copies the limit as the request, which can make a pod much harder to place than its authors intended.
  • Rebalancing without budgets. Evicting pods to consolidate space is a disruption; PodDisruptionBudgets decide whether it is allowed.

Verification

The companion calculation has six offline tests: allocatable from the reservations, the Pending verdict with 4,600 millicores free and 1,400 as the largest block, a memory-only failure reported separately, the single consolidating move, the right-sized request fitting three nodes, and the quantity parsing. It implements only the resource fit check, not kube-scheduler: affinity, taints, topology spread, host ports and volume topology all add their own reasons, and the real event text depends on your Kubernetes version.

Primary references and authorship

Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/k8s_request_fit. Views are my own and do not represent any employer, past or present.