Skip to content
The Chat Archive
gpt-4-0314· OpenAI WildChat-4.8M (AI2)

The Prometheus metric containercpuusersecondstotal is showing odd values when querying…

  1. User

    The Prometheus metric container_cpu_user_seconds_total is showing odd values when querying it for containers running in Kubernetes pods. These values are missing the "container" label, but are still contributing to the CPU metric. What are these values?

  2. Assistant

    The "container_cpu_user_seconds_total" metric with missing "container" label usually represents values for the "pause" container in each pod.

    In Kubernetes, each pod has an infrastructure container, also known as a "pause container", created first before the actual containers start. The pause container holds the network namespace and other shared resources used by the other containers in the same pod. This container has very minimal resource usage, and it's not visible, but it contributes to CPU and other system metrics.

    Since it's not relevant to most use-cases, you can exclude this container from your queries and aggregations by using the "container" label. For example, you can get the actual container CPU usage without the pause container as follows:

    container_cpu_user_seconds_total{container!=""}