A service gets slow. You check kubectl top, and the node shows the same CPU usage as yesterday, when everything was fast. CPU looks “fine”, so you look somewhere else.

The missing piece is waiting. CPU usage tells you how busy the CPUs are. It doesn’t tell you how many tasks are queued for a CPU and not getting one. Two nodes can both show 100% busy CPUs, one with work that fits and one with three times more work than CPU.

Linux measures that waiting with Pressure Stall Information (PSI), and the kubelet exposes it for every node, Pod, and container. This post reproduces three cases on a test cluster: busy but fine, busy and starving, and idle but throttled. It shows how to tell them apart from two numbers, and ends with two Prometheus alert rules: one for CPU waiting, and one that tells you whether a CPU limit causes it.

Code for this post: _resource/kubernetes-psi-cpu-pressure. I ran every test on Kind (Kubernetes 1.37.0) in Docker Desktop on 2026-12-04, and the outputs below come from that run. The idea and the workload follow the Kubernetes blog post Beyond CPU Utilization: Using PSI to Diagnose Kubernetes Resource Contention.

What CPU Pressure Measures

PSI answers one question: what share of the time was at least one task ready to run, but waiting for a CPU? The kernel reports it as some:

  • some avg10=25 means that over roughly the last 10 seconds, at least one task waited about a quarter of the time.
  • avg60 and avg300 are the same over 1 and 5 minutes. avg10 reacts fastest.
  • full is the share of time when all non-idle tasks were waiting at once. For CPU, some is the one to watch.

The kernel keeps these numbers for the whole machine and for each cgroup. Every Pod and container runs in its own cgroup, so a Pod’s pressure counts only that Pod’s tasks, while the node’s number counts everything on the node.

Usage and pressure answer different questions. Usage says how busy the CPUs are. Pressure says how much work had to wait. You need both.

The kubelet shows PSI next to CPU usage in its Summary API, for the node and for every Pod and container. These PSI metrics are stable since Kubernetes v1.36. The kubelet also exports container_pressure_cpu_waiting_seconds_total on its cAdvisor metrics endpoint for Prometheus.

Set Up the Lab

The lab is a two-node Kind cluster. The worker node is pinned to exactly 2 CPUs, so it’s easy to fill them. The control plane gets two other CPUs, so it doesn’t compete with the test.

cd _resource/kubernetes-psi-cpu-pressure
./setup.sh

setup.sh creates the cluster, runs docker update --cpuset-cpus on each Kind node (each node is a Docker container, so Docker can limit its CPUs), and installs metrics-server so kubectl top works. It prints worker CPUs: 2 when the pin is in place.

Note: Every script in the lab calls kubectl --context kind-psi-lab. If your current context points at a real cluster, nothing in this lab can touch it.

The workload is a Deployment whose Pods run busy loops. Each loop keeps one CPU fully busy whenever it gets one, so the number of loops controls how much work competes for the two CPUs.

Two scripts read the numbers:

  • psi.sh prints CPU usage and CPU pressure (some.avg10) for the worker node and each Pod, from the kubelet Summary API.
  • avg-pressure.sh takes 12 node readings, 10 seconds apart, and prints the average, so one noisy reading doesn’t decide the result.

Both scripts call the same kubelet endpoint through the API server. You can use it on any cluster where your user is allowed to get the nodes/proxy resource:

kubectl get --raw "/api/v1/nodes/<node-name>/proxy/stats/summary" \
  | jq '{cores: (.node.cpu.usageNanoCores / 1e9), psi: .node.cpu.psi}'

Run A: Busy, but the Work Fits

One Pod with two loops on two CPUs. Each loop gets a CPU to itself.

K="kubectl --context kind-psi-lab"
$K apply -f spinners.yaml && $K rollout status deployment/spinners
sleep 60
$K top nodes
./psi.sh
./avg-pressure.sh
NAME                    CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
psi-lab-control-plane   136m         1%     661Mi           8%
psi-lab-worker          1999m        24%    184Mi           2%
NODE  cpu=1996m  pressure(some.avg10)=4.24%
POD   spinners-5c9c9987fc-2nq7r  cpu=1969m  pressure=1.19%
avg pressure (12 readings): 10.33%

The worker uses about 2000m, so both of its CPUs are fully busy. The Pod itself waited about 1% of the time. The node average is 10%, higher than the Pod’s. The node’s number also counts the kubelet, containerd, and the other system processes on those two CPUs, and they sometimes wait behind the loops. (That’s my reading of the gap; the lab doesn’t break it down per process.)

CPU% says 24%, not 100%. Kubernetes counts all 8 CPUs of the Docker Desktop VM as the node’s capacity and doesn’t know about the 2-CPU pin. In a real cluster the percentage is right, but the lesson holds: a CPU percentage on its own doesn’t tell you whether work is waiting.

Run B: Busy, and the Work Doesn’t Fit

Three Pods, six loops, the same two CPUs. Only two loops can run at a time.

$K scale deployment spinners --replicas=3 && $K rollout status deployment/spinners
sleep 60
$K top nodes
$K top pods
./psi.sh
./avg-pressure.sh
NAME                    CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
psi-lab-control-plane   211m         2%     682Mi           8%
psi-lab-worker          1995m        24%    208Mi           2%
NAME                        CPU(cores)   MEMORY(bytes)
spinners-5c9c9987fc-2nq7r   628m         0Mi
spinners-5c9c9987fc-gpv5g   705m         0Mi
spinners-5c9c9987fc-wtz98   602m         0Mi
NODE  cpu=1993m  pressure(some.avg10)=98.76%
POD   spinners-5c9c9987fc-wtz98  cpu=544m  pressure=79.52%
POD   spinners-5c9c9987fc-gpv5g  cpu=674m  pressure=64.28%
POD   spinners-5c9c9987fc-2nq7r  cpu=625m  pressure=69.9%
avg pressure (12 readings): 96.82%

Node CPU usage is the same as in Run A: about 2000m. If you only looked at kubectl top nodes, the two runs are identical. Pressure is not: it went from 10% to 97%. Almost all the time, at least one loop was waiting for a CPU.

kubectl top pods adds a second trap. Each Pod now uses about 600–700m, much less than the 1969m of Run A. That doesn’t mean the Pods need less CPU. They’re sharing two CPUs three ways. A team looking at those numbers might lower the Pods’ CPU requests to match, and that makes it worse: smaller requests let the scheduler place even more Pods on the same node. Pod pressure of 64–80% shows the real picture. Most of the time, at least one loop in each Pod was waiting.

Run C: Not Busy, and Still Waiting

One Pod with two loops, but with a CPU limit of 500m. The node has plenty of spare CPU. Scale to zero first and wait, so the averages from Run B settle.

$K scale deployment spinners --replicas=0; sleep 240
$K set resources deployment spinners --limits=cpu=500m
$K scale deployment spinners --replicas=1 && $K rollout status deployment/spinners
sleep 60
$K top nodes
./psi.sh
./avg-pressure.sh
NAME                    CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
psi-lab-control-plane   120m         1%     720Mi           9%
psi-lab-worker          527m         6%     202Mi           2%
NODE  cpu=536m  pressure(some.avg10)=75.86%
POD   spinners-b9c447786-m28lk  cpu=500m  pressure=73.71%
avg pressure (12 readings): 75.96%

The worker is three-quarters idle, yet pressure is 76%. The Pod is held back by its own limit. The kernel enforces a CPU limit in periods, 100 ms each by default, and a 500m limit allows 50 ms of CPU time per period. Two busy loops use up those 50 ms in about 25 ms, and the kernel pauses the container until the next period starts. That pause is throttling, and PSI counts it as waiting.

Node pressure rose too, because the node’s number includes this Pod’s tasks. On its own, the node reading looks like Run B. The per-Pod pressure and the throttling counters show that one Pod is waiting on its own limit, not on a crowded node:

$K get --raw /api/v1/nodes/psi-lab-worker/proxy/metrics/cadvisor \
  | grep -E 'container_cpu_cfs_(throttled_)?periods_total' | grep 'container="spin"'
container_cpu_cfs_periods_total{container="spin",...} 2395
container_cpu_cfs_throttled_periods_total{container="spin",...} 2388

(Labels trimmed for width.) The container was throttled in 2,388 of 2,395 periods. Adding nodes wouldn’t help this Pod at all. Only raising or removing the limit would.

A 2 by 2 grid of CPU usage against CPU pressure. Run A, 2000m and 10% pressure, is busy but the work fits. Run B, also 2000m but 97% pressure, has more work than CPU. Run C, 530m and 76% pressure, is throttled by its own 500m limit. The low usage, low pressure corner is idle.

How to Read the Three Cases

What you see What it means Where to look next
High usage, low pressure (Run A) The CPUs are busy, but the work fits Nothing, unless latency is also up
High usage, high pressure (Run B) More runnable work than CPU on the node Which Pods share the node, CPU requests, placement, more nodes
Low node usage, high pressure on one Pod (Run C) The Pod is capped by its own CPU limit container_cpu_cfs_throttled_periods_total, the Pod’s limit

There’s no universal “bad” pressure number. 30% may be normal for a batch job and a problem for a latency-sensitive API. Compare pressure with the workload’s own baseline, and check whether it rose at the same time as latency or queue depth.

Alert on It with Prometheus

The kubelet’s cAdvisor metrics include container_pressure_cpu_waiting_seconds_total, the total time tasks in a container waited for CPU. Its rate over a window is the share of that window spent waiting: 0.25 means a quarter of the time. The lab’s psi-alerts.yaml has two rules:

groups:
- name: cpu-pressure
  rules:
  - alert: ContainerCPUPressureHigh
    expr: |
      sum by (namespace, pod, container) (
        rate(container_pressure_cpu_waiting_seconds_total{container!=""}[5m])
      ) > 0.25
    for: 10m
    labels:
      severity: warning

  - alert: ContainerCPUThrottled
    # More than half of the CFS periods were throttled: the Pod is held back by its own CPU limit.
    expr: |
      sum by (namespace, pod, container) (rate(container_cpu_cfs_throttled_periods_total{container!=""}[5m]))
        /
      sum by (namespace, pod, container) (rate(container_cpu_cfs_periods_total{container!=""}[5m]))
        > 0.5
    for: 10m
    labels:
      severity: info

The first rule says “this container waited for CPU more than a quarter of the time for 10 minutes”. The second tells you which kind of waiting it is: if it fires too, the cause is the Pod’s own limit (Run C), not a crowded node (Run B). CFS periods are counted only for containers with a CPU limit, so the second rule never fires for Pods without one. Start with these thresholds, then tune them per workload against its baseline. (The full file in the lab also has summary and description annotations.)

Check the rules before you load them:

docker run --rm -v "$PWD":/w --entrypoint promtool prom/prometheus:v3.5.0 check rules /w/psi-alerts.yaml
Checking /w/psi-alerts.yaml
  SUCCESS: 2 rules found

I checked the rule syntax and that both metrics exist on the lab’s kubelet. I didn’t run a full Prometheus and Alertmanager stack to see them fire.

Before You Use This in Production

  • Check that your nodes support PSI. It needs cgroup v2 and a kernel with PSI enabled. On a node, stat -fc %T /sys/fs/cgroup should print cgroup2fs, and cat /proc/pressure/cpu should print a some line. Some distributions build the kernel with PSI turned off by default; on those, the kernel needs the psi=1 boot parameter.
  • Check your Kubernetes version. PSI metrics are stable since v1.36. On older versions, check your version’s documentation before relying on them.
  • Make sure your Prometheus scrapes the kubelet’s cAdvisor endpoint (/metrics/cadvisor). Most kube-prometheus setups already do.
  • Use Pod and container pressure for alerts, not only the node. Node pressure includes everything on the node; the per-container number points to the workload that suffers.

Clean Up

./cleanup.sh

It deletes only the psi-lab cluster. Kind may have switched your current kubectl context when it created the cluster; switch it back with kubectl config use-context <your-context>.

Summary

  • CPU usage shows how busy the CPUs are, not how much work waits for them. In the lab, kubectl top showed about 2000m for both a healthy node (Run A) and a starving one (Run B).
  • PSI measures the waiting. Node pressure went from 10% in Run A to 97% in Run B. A Pod with a 500m limit showed 76% pressure on an almost idle node (Run C).
  • Read the two together. High usage with low pressure is fine. High usage with high pressure is contention on the node. Low node usage with high pressure on one Pod is that Pod’s own CPU limit.
  • Alert on rate(container_pressure_cpu_waiting_seconds_total[5m]), and pair it with the throttling ratio to tell contention from limits.

As a next step, pick one node from your busiest node pool and compare its pressure with the CPU usage you’ve been watching. psi.sh works outside the lab if you set the context and pass the node name, and NS picks the namespace, for example CTX=<your-context> NS=payments ./psi.sh <node-name>. NS=all lists every namespace. Reading the Summary API needs permission to get nodes/proxy.

Resources