PSI in Kubernetes: diagnosing resource pressure

Practical guide to PSI in Kubernetes: read CPU, memory and I/O pressure from the kubelet, collect it with Prometheus, alert and compare with throttling.

CloudScript Technology
December 4, 20269 min read
PSI in Kubernetes: diagnosing resource pressure

PSI in Kubernetes (Pressure Stall Information) answers a question that utilization leaves open: how much time workloads spend waiting for CPU, memory or I/O. A recent post on the Kubernetes blog shows the typical case. On a node with two CPUs, kubectl top reported 2001m in two runs of the same workload, but CPU pressure was 0.33% in one and 99.63% in the other. Utilization was the same. Waiting was not. Since v1.36, kubelet PSI metrics are stable, and you can use them in production with Prometheus and Grafana. This guide explains what PSI is, when to rely on each signal and how to set up collection, queries and alerts without falling into the most common mistakes.

What PSI is

PSI is a Linux kernel feature, available since version 4.20, that measures the time tasks spend stalled for lack of a resource (kernel documentation). The measurement comes in two kinds:

  • some: time during which at least one task was stalled waiting for the resource. It is the first sign of contention.
  • full: time during which all non-idle tasks were stalled at the same time. No work moves forward, which is much more serious.

For each kind, the kernel publishes moving averages over 10, 60 and 300 seconds (avg10, avg60, avg300) and a cumulative total. According to the Kubernetes documentation on PSI, an avg10 well above avg300 points to a recent burst of contention rather than a sustained bottleneck.

In Kubernetes, the kubelet collects PSI at node, pod and container level and exposes the data through two paths (system component metrics):

  • Summary API (/stats/summary): JSON with the totals and the avg10, avg60 and avg300 averages.
  • /metrics/cadvisor: cumulative stall-time counters, in seconds, in Prometheus format. There are six: container_pressure_{cpu,memory,io}_waiting_seconds_total and container_pressure_{cpu,memory,io}_stalled_seconds_total.

Starting with v1.36, the KubeletPSI feature gate is locked to true (node metrics data). Because PSI is a Linux kernel feature, Windows nodes do not expose these metrics.

When to use it and how to choose the signal

PSI does not replace utilization: the two signals complement each other. Use the table as a starting point for each symptom:

SituationSignal to checkLikely reading
Unexplained latency and normal kubectl topPod CPU PSI (some)Contention on the node or throttling
High utilization and low pressureNode CPU PSIThe CPUs are busy, but the work fits
High utilization and high pressureNode and pod CPU PSIThere is more runnable work than CPU
High pressure on a pod while the node has headroomThrottling countersThe pod is held back by its own limit
High I/O pressure and low memory pressureio and memory PSIWaiting on disk, not lack of RAM

The last four readings come from the source post and the PSI documentation.

As for the collection path, the Summary API is useful for ad hoc investigation, because it already delivers the averages. Proxying to the kubelet, however, is a privileged operation, and the GA announcement warns about that risk. For history, alerts and dashboards, use /metrics/cadvisor with Prometheus and compute rates from the counters.

Step by step

1. Check the kernel, PSI and cgroup v2

The prerequisites are kernel 4.20 or later with PSI enabled and nodes running cgroup v2 (beta announcement). For cgroup v2, Kubernetes requires kernel 5.8 or later (About cgroup v2). Some distributions build PSI disabled by default (CONFIG_PSI_DEFAULT_DISABLED). In that case, you need to pass psi=1 on the kernel command line (PSI project overview). On the node:

# Should return cgroup2fs
stat -fc %T /sys/fs/cgroup/

# Each file should contain the "some" and "full" lines
cat /proc/pressure/cpu
cat /proc/pressure/memory
cat /proc/pressure/io

On managed clusters, confirm this on the node image used by each node pool.

2. Read the Summary API

With administrator permissions, query a container's PSI through the API server proxy, as shown in the documentation:

NODE="<node-name>"
CONTAINER_NAME="<container-name>"

kubectl get --raw "/api/v1/nodes/${NODE}/proxy/stats/summary" \
  | jq '.pods[].containers[]
        | select(.name=="'"$CONTAINER_NAME"'")
        | {name, cpu: .cpu.psi, memory: .memory.psi, io: .io.psi}'

# CPU pressure for the whole node (some, 10 s window)
kubectl get --raw "/api/v1/nodes/${NODE}/proxy/stats/summary" \
  | jq '.node.cpu.psi.some.avg10'

The averages are a percentage of time. In the JSON, the total field accumulates stall time in microseconds.

3. Confirm the /metrics/cadvisor endpoint

Before configuring collection, confirm that the counters show up on the endpoint:

kubectl get --raw "/api/v1/nodes/${NODE}/proxy/metrics/cadvisor" \
  | grep -E '^container_pressure_(cpu|memory|io)_(waiting|stalled)_seconds_total' \
  | head -n 12

4. Collect with Prometheus

Prometheus needs an identity with read access to kubelet metrics. Kubelet authorization maps the /metrics/* paths to the nodes/metrics subresource. So you can skip nodes/proxy, which is much broader:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: prometheus-kubelet-metrics
rules:
  - apiGroups: [""]
    resources: ["nodes"]
    verbs: ["get", "list", "watch"]
  - apiGroups: [""]
    resources: ["nodes/metrics"]
    verbs: ["get"]

The scrape job below follows the official Prometheus example for Kubernetes and uses node discovery from kubernetes_sd_config:

scrape_configs:
  - job_name: kubernetes-cadvisor
    scheme: https
    metrics_path: /metrics/cadvisor
    tls_config:
      ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    authorization:
      credentials_file: /var/run/secrets/kubernetes.io/serviceaccount/token
    kubernetes_sd_configs:
      - role: node
    relabel_configs:
      - action: labelmap
        regex: __meta_kubernetes_node_label_(.+)

If the cluster already scrapes the kubelet cAdvisor some other way, the PSI counters arrive in the same job with no extra configuration.

5. Build the PromQL queries

The counters add up stalled seconds. The rate() function turns that total into stalled seconds per second, that is, the fraction of time spent waiting. Multiply by 100 to get a percentage:

# % of time with some task waiting for CPU, per container
100 * sum by (namespace, pod, container) (
  rate(container_pressure_cpu_waiting_seconds_total{container!=""}[5m])
)

# Equivalent to avg10 vs avg300: short window against long window
sum by (namespace, pod) (rate(container_pressure_cpu_waiting_seconds_total{container!=""}[1m]))
/
sum by (namespace, pod) (rate(container_pressure_cpu_waiting_seconds_total{container!=""}[5m]))

# Fraction of throttled CPU periods, per container
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]))

/metrics/cadvisor does not provide avg10 or avg300, only the counters. To reproduce that comparison, use a short window against a long one. A ratio well above 1 points to a recent burst. The short window must cover several scrapes. The throttling counters are described in the cAdvisor documentation.

6. Create baseline alerts

There is no universal PSI threshold, and the source post itself avoids proposing one. Store the rate in a recording rule and compare the current value with the workload's own history. Use the for clause of alerting rules to ignore short spikes:

groups:
  - name: psi
    rules:
      - record: namespace_pod_container:container_pressure_cpu_waiting:rate5m
        expr: |
          sum by (namespace, pod, container) (
            rate(container_pressure_cpu_waiting_seconds_total{container!=""}[5m])
          )
      - alert: PressaoCPUAcimaDaLinhaDeBase
        # Factors and windows are examples: calibrate with the workload history
        expr: |
          namespace_pod_container:container_pressure_cpu_waiting:rate5m
            > 2 * quantile_over_time(0.95,
                namespace_pod_container:container_pressure_cpu_waiting:rate5m[7d])
          and namespace_pod_container:container_pressure_cpu_waiting:rate5m > 0.10
        for: 15m
        labels:
          severity: warning
        annotations:
          summary: "CPU pressure above baseline in {{ $labels.namespace }}/{{ $labels.pod }}"
          description: "Compare with container throttling and node pressure before acting."

Create the same rules for memory and I/O. For those resources, stalled (full) indicates a complete loss of progress and usually deserves a higher severity.

7. Cross-check pressure and throttling in Grafana

In Grafana, create a time series panel on the Prometheus data source with three queries per pod: CPU pressure, throttling fraction and CPU usage. Next to it, add the node's CPU pressure. Read it like this:

  • High pressure, high throttling and a node with headroom: the pod is held back by its own CPU limit. A bigger node will not fix it. Review the limit (resource management for containers).
  • High pressure, low throttling and a pressured node: pods are contending with each other. Investigate requests, neighbors and placement.
  • Low pressure and high utilization: the node is well used. There is nothing to fix.

Best practices

Security: restrict access to the kubelet

Give Prometheus only nodes/metrics and reserve nodes/proxy for whoever administers the nodes. Summary API queries through the proxy are privileged and should stay out of scripts with broad credentials.

Scale: watch cardinality

There are six PSI series per container, plus the pod and node series. Use recording rules for dashboards and, if retention gets heavy, drop the series you do not need through relabeling.

Cost: keep only what drives decisions

Keep the aggregated rates that feed alerts and dashboards at high resolution. Raw series from ephemeral containers rarely justify long retention.

Operations: write the runbook before the alert

Every pressure alert should point to the next steps: check throttling, node pressure, neighbors and application latency. Without that, PSI becomes yet another chart nobody owns.

Baseline: compare the workload with itself

Databases, queues and inference services have different profiles. Measure each one under normal operation before defining factors and windows.

Common mistakes

  • Alerting on utilization only. The source case shows 2001m in both runs and pressure of 0.33% against 99.63%. Utilization does not see the wait.
  • Mistaking pressure for lack of capacity. If the node has headroom and throttling is high, the cause is the pod's limit. Adding nodes will not reduce that pressure.
  • Using a fixed threshold without a baseline. A value that is normal for a batch job can be an incident for a latency-sensitive API.
  • Adding up different scopes. The node contains the pods, and the pods contain the containers. Summing these levels counts the same time more than once.
  • Alerting on node-level CPU full. At system level, the full line of /proc/pressure/cpu is always zero.
  • Expecting PSI on Windows nodes. Mixed clusters need dashboards that handle the absence of these series.

Frequently asked questions

Do I need to enable a feature gate?
Not from v1.36 on. KubeletPSI is locked to true. You only need to meet the kernel and cgroup v2 prerequisites.

What is the difference between waiting and stalled in the metrics?
waiting corresponds to some: some task waiting. stalled corresponds to full: all non-idle tasks stalled. Start with waiting to detect contention and use stalled for serious memory and I/O cases.

Does PSI replace utilization metrics?
No. Utilization shows how much of the resource is in use, and PSI shows how much work is waiting for it. The diagnosis comes from combining both, along with application metrics and traces.

Conclusion

PSI in Kubernetes fills the gap between "the resource is busy" and "the application is waiting". With the kernel and cgroup v2 prerequisites checked, collection through /metrics/cadvisor, queries that compare windows, baseline alerts and the cross-check with throttling, the team can tell node contention apart from a poorly sized limit before buying capacity. To build this layer into your platform, see our observability consulting and our SRE service. For another perspective on the topic, read The power of application monitoring and observability with the Elastic Stack. To talk to a specialist, visit the CloudScript contact page.


Sources

Kubernetes, Linux, Prometheus, Grafana and cAdvisor are trademarks of their respective owners, cited only to identify the technologies. CloudScript is not affiliated with these owners unless otherwise stated.

Stay up to date

Get our articles on DevOps, Kubernetes, Platform Engineering and Cloud Native delivered to your inbox.

No spam. Unsubscribe anytime.

CloudScript is a Platform Engineering company focused on enterprise-grade cloud-native application architecture.

No spam. Unsubscribe anytime.
Follow us

24/7 support for contracted clients via OpsScript.

© 2026 CloudScript Technology. All rights reserved.