# Kubernetes metadata missing from APM documents

**URL:** <https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190>\
**Category:** APM\
**Created:** [February 5, 2019, 7:49pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190 "2019-02-05T19:49:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![drinnird](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@drinnird](https://discuss.elastic.co/u/drinnird)\
**Post date:** [February 5, 2019, 7:49pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/1 "2019-02-05T19:49:57Z")

</div>

**Kibana V. 6.5.4** :

**ES V. 5.6** :

**APM V 6.6.0** :

**APM agent nodeJS v 1.12** :

\*\*Installed from docker image [docker.elastic.co/apm/apm-server:6.6.0](http://docker.elastic.co/apm/apm-server:6.6.0) \*\*:

**Fresh install**

**Is there anything special in your setup?** Using kubernetes, deploying APM as a Service, default namespace, no customizations except adding kubernetes metadata:

Sample config:

> <https://gist.github.com/digressionary/573939468d9f6d2afe284d2c6014d52b>

**Problem: Kubernetes metadata is not added to the APM traces** :

**Steps to reproduce** :

1. Launch APM-server using kubectl and this config file:  
[https://gist.github.com/digressionary/573939468d9f6d2afe284d2c6014d52b](https://gist.github.com/digressionary/573939468d9f6d2afe284d2c6014d52b)
2. Configure a node.js app which is running in kubernetes to connect to this APM-server
3. Hit the node.js app endpoint
4. the following output is missing kubernetes metadata  
[https://gist.github.com/digressionary/3ffbca67eb0940cb2992e5475aace8ab](https://gist.github.com/digressionary/3ffbca67eb0940cb2992e5475aace8ab)

---

<div class="post-metadata">

**Author:** ![stephenbelanger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenbelanger/32/34880_2.png) [@stephenbelanger](https://discuss.elastic.co/u/stephenbelanger)\
**Post date:** [February 5, 2019, 11:41pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/2 "2019-02-05T23:41:30Z")

</div>

v1 of the Node.js agent doesn't report kubernetes data. You'll need to upgrade to v2.

---

<div class="post-metadata">

**Author:** ![drinnird](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@drinnird](https://discuss.elastic.co/u/drinnird)\
**Post date:** [February 6, 2019, 7:07pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/3 "2019-02-06T19:07:33Z")

</div>

Thank you for your kind response.  
I upgraded the APM agent to 2.5.1.

All configuration is the same.

However, I am experiencing the same issue (the metadata is not added).

Could this be a problem specific to running kubernetes as "docker-for-desktop" on a MacBook?

Thankyou,

---

<div class="post-metadata">

**Author:** ![stephenbelanger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenbelanger/32/34880_2.png) [@stephenbelanger](https://discuss.elastic.co/u/stephenbelanger)\
**Post date:** [February 6, 2019, 7:51pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/4 "2019-02-06T19:51:16Z")

</div>

Only pod id and name are recorded automatically, and only if they have been found by the [container-info](https://github.com/Qard/container-info) module. You can try running that module in your environment to see what it gets, if you like. If that is unable to identify your environment then you will need to supply the data manually via the [`agent.start(...)` options](https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#kubernetes-node-name).

---

<div class="post-metadata">

**Author:** ![drinnird](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@drinnird](https://discuss.elastic.co/u/drinnird)\
**Post date:** [February 6, 2019, 8:50pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/5 "2019-02-06T20:50:33Z")

</div>

Okay I'm a bit confused.

Here, the docs list all the kubernetes fields that are "exported" which I took to mean "added to the document"

[https://www.elastic.co/guide/en/apm/server/current/exported-fields-kubernetes-processor.html](https://www.elastic.co/guide/en/apm/server/current/exported-fields-kubernetes-processor.html)

However, your answer seems to indicate that only two of these fields would be populated, and only in certain circumstances. Could you clarify?

Thank you.

---

<div class="post-metadata">

**Author:** ![stephenbelanger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenbelanger/32/34880_2.png) [@stephenbelanger](https://discuss.elastic.co/u/stephenbelanger)\
**Post date:** [February 6, 2019, 8:55pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/6 "2019-02-06T20:55:21Z")

</div>

That is where data is mapped to in the Elasticsearch documents created by apm-server, if it is given the appropriate input data to include that. It will not record that data itself, it will only map it from the input it gets from agents.

---

<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:** [February 27, 2019, 4:55pm UTC](https://discuss.elastic.co/t/kubernetes-metadata-missing-from-apm-documents/167190/7 "2019-02-27T16:55:30Z")

</div>

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