# Apm agent lost some kubernetes metadata

**URL:** <https://discuss.elastic.co/t/apm-agent-lost-some-kubernetes-metadata/309723>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [July 15, 2022, 8:53am UTC](https://discuss.elastic.co/t/apm-agent-lost-some-kubernetes-metadata/309723 "2022-07-15T08:53:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [July 15, 2022, 8:53am UTC](https://discuss.elastic.co/t/apm-agent-lost-some-kubernetes-metadata/309723/1 "2022-07-15T08:53:46Z")

</div>

cluster: 7.15.2，7.17.3  
apm dotnet agent

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

According to the documentation, apm agent can automatically capture kubernetes-related metadata. Why can only kubernetes.pod.name and kubernetes.pod.uid be captured?

I specifically increased the processor but it didn't make any difference.

```auto
processors:
  - add_kubernetes_metadata:
      default_indexers.enabled: false
      default_matchers.enabled: false

      add_resource_metadata:
        namespace:
          include_labels: [","]
        deployment: false
        cronjob: false

```

In addition, according to the forum search, I found [kubernetes-data](https://www.elastic.co/guide/en/apm/guide/master/metadata-api.html#kubernetes-data), but I didn't understand, I need to add to each pod Kubernetes Downward API environment variable?

---

<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:** [August 5, 2022, 4:54am UTC](https://discuss.elastic.co/t/apm-agent-lost-some-kubernetes-metadata/309723/2 "2022-08-05T04:54:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [August 8, 2022, 1:30pm UTC](https://discuss.elastic.co/t/apm-agent-lost-some-kubernetes-metadata/309723/3 "2022-08-08T13:30:40Z")

</div>

Hi @wajika,

which other kubernetes metadata would you like to collect? Typically we collect what makes sense and is useful and it's not a huge overhead to collect.

> In addition, according to the forum search, I found [kubernetes-data](https://www.elastic.co/guide/en/apm/guide/master/metadata-api.html#kubernetes-data), but I didn't understand, I need to add to each pod Kubernetes Downward API environment variable?

The way this technically works in the .NET agent is that the agent looks for environment variables like `KUBERNETES_NAMESPACE`, `KUBERNETES_POD_NAME`, etc. I'm not a kubernetes expert, but from what I know those environment variables are not present by default, unless you set those with the Downward API. So the answer is: if the environment variables are present, then you are good to go. If they aren't present by default, then probably you'll need to set those.
