# Kubernetes module not getting resource limits

**URL:** <https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 6, 2019, 3:53am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210 "2019-02-06T03:53:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [February 6, 2019, 3:53am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/1 "2019-02-06T03:53:36Z")

</div>

I enabled the Kubernetes module ([https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-kubernetes.html](https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-kubernetes.html)) and everything works fine. But the `kubernetes.pod.memory.usage.limit.pct` field is falling back to total node allocatable memory even if there is a resource limit. Actually, all of my containers in pods have resource limits and all of the percentage numbers is based on the node maximum instead of the limit.

The percentage number and the visualization in Infra panel are becoming meaningless due to this problem. (In fact, I have been misled by the wrong percentage number for quite a long time. The docker module worked well though ) How to resolve this problem?

---

<div class="post-metadata">

**Author:** ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)\
**Post date:** [February 6, 2019, 3:45pm UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/2 "2019-02-06T15:45:17Z")

</div>

Hi @fr0der1c 🙂

Can you please share more details like Metricbeat version, please?

Also, can you share the output of this commands:

```auto
kubectl get node <node name> -o jsonpath='{.status.allocatable}{"\n"}{.status.capacity}{"\n"}'
kubectl get pod -n <namespace> <pod name> -o jsonpath='{range .spec.containers[*]}{.resources}{"\n"}{end}'

```

We don't see anything wrong in the code that sets that value.

Thanks!

---

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [February 8, 2019, 5:58am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/3 "2019-02-08T05:58:14Z")

</div>

Sorry. I forgot to add the version information. My Metricbeat is aligned with the whole Elastic stack at 6.6.0.

```bash
# kubectl get node 10.100.1.16 -o jsonpath='{.status.allocatable}{"\n"}{.status.capacity}{"\n"}'
map[cpu:3920m ephemeral-storage:47438478872 hugepages-1Gi:0 hugepages-2Mi:0 memory:7215564Ki pods:253]
map[cpu:4 ephemeral-storage:51474044Ki hugepages-1Gi:0 hugepages-2Mi:0 memory:8167884Ki pods:253]

# kubectl get pod -n default discourse-web-b75c85f74-qb8g4 -o jsonpath='{range .spec.containers[*]}{.resources}{"\n"}{end}'
map[limits:map[cpu:1 memory:1Gi] requests:map[cpu:500m memory:500Mi]]

```

You can see I actually set the 1Gi memory limitation from the result above. But the pod detail says I'm using 12% of the memory.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f1b950c421cf627bed3c7dfe72cb4755dff59377.png)

While the container detail says I'm using more than 80%. This is a single-container pod, so the memory usage in pod detail and container detail should be the same.

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

---

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [February 13, 2019, 9:29am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/4 "2019-02-13T09:29:17Z")

</div>

@Mario_Castro  
Hello. I've provided the information. Could you please tell me where the problem is?

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [February 14, 2019, 4:20pm UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/5 "2019-02-14T16:20:06Z")

</div>

Is this the same issue as here? [https://github.com/elastic/beats/issues/10658](https://github.com/elastic/beats/issues/10658)

---

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [February 15, 2019, 6:12am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/7 "2019-02-15T06:12:15Z")

</div>

Umm... The issue link you provided references back to this thread. I'm not sure what you mean.😕

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [February 15, 2019, 8:42pm UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/8 "2019-02-15T20:42:19Z")

</div>

@fr0der1c Sorry, my bad. I understand why you were confused. I didn't realise that it's linking to this discuss topic. As it seems this is a bug, I suggest we continue the discussion in the Github issue.

---

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [February 16, 2019, 1:25am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/9 "2019-02-16T01:25:25Z")

</div>

@ruflin Ok. Should I provide more information there or just wait for the fix?

---

<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:** [March 16, 2019, 1:25am UTC](https://discuss.elastic.co/t/kubernetes-module-not-getting-resource-limits/167210/10 "2019-03-16T01:25:32Z")

</div>

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