# What is the source of kubernetes.pod.memory.usage.bytes and kubernetes.pod.cpu.usage.nanocores metrics?

**URL:** <https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053>\
**Category:** Beats\
**Created:** [April 1, 2021, 4:02pm UTC](https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053 "2021-04-01T16:02:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eeijlar](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@eeijlar](https://discuss.elastic.co/u/eeijlar)\
**Post date:** [April 1, 2021, 4:02pm UTC](https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053/1 "2021-04-01T16:02:45Z")

</div>

I am wondering where the metrics `kubernetes.pod.memory.usage.bytes` and `kubernetes.pod.cpu.usage.nanocores` in metricbeat are obtained from? Are they OS statistics? If so, which statistic? I am trying to compare them against `kubectl top`

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [April 6, 2021, 3:49pm UTC](https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053/2 "2021-04-06T15:49:43Z")

</div>

I believe these metrics are from `stats/summary` endpoint based on the code: [beats/pod.go at master · elastic/beats · GitHub](https://github.com/elastic/beats/blob/master/metricbeat/module/kubernetes/pod/pod.go#L33)

@ChrsMark Please correct me if I'm wrong here. TIA!

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [April 8, 2021, 7:35am UTC](https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053/3 "2021-04-08T07:35:18Z")

</div>

That's correct. These are metrics collected from `kubelet`'s endpoint Kaiyan provided above.

---

<div class="post-metadata">

**Author:** ![eeijlar](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@eeijlar](https://discuss.elastic.co/u/eeijlar)\
**Post date:** [April 8, 2021, 9:27am UTC](https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053/4 "2021-04-08T09:27:45Z")

</div>

@ChrsMark , @Kaiyan_Sheng

So, from that it looks like both `metricbeat` and `kubectl top` use the same source:

> **[Resource metrics pipeline](https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/)**
>
> Resource usage metrics, such as container CPU and memory usage, are available in Kubernetes through the Metrics API. These metrics can be accessed either directly by the user with the kubectl top command, or by a controller in the cluster, for...

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e2d80e09256a349be482cbca5b3f94d17fbf5c9e.png)

Kubectl top uses Metrics Server

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 6, 2021, 9:27am UTC](https://discuss.elastic.co/t/what-is-the-source-of-kubernetes-pod-memory-usage-bytes-and-kubernetes-pod-cpu-usage-nanocores-metrics/269053/5 "2021-05-06T09:27:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
