I run a v1.9.2
custom setup of Kubernetes and scrape various metrics with Prometheus v2.1.0
. Among others, I scrape the kubelet
and cAdvisor
metrics.
I want to answer the question: "How much of the CPU resources defined by requests
and limits
in my deployment are actually used by a pod (and its containers) in terms of (milli)cores?"
There are a lot of scraped metrics available, but nothing like that. Maybe it could be calculated by the CPU usage time in seconds, but I don't know how.
I was considering it's not possible - until a friend told me she runs Heapster in her cluster which has a graph in the built-in Grafana that tells exactly that: It shows the indivual CPU usage of a pod and its containers in (milli)cores.
Since Heapster also uses kubelet
and cAdvisor
metrics, I wonder: how can I calculate the same? The metric in InfluxDB is named cpu/usage_rate
but even with Heapster's code, I couldn't figure out how they calculate it.
Any help is appreciated, thanks!