# Can i get the pod labels in the metricsets

**URL:** <https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 11, 2018, 2:59pm UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079 "2018-10-11T14:59:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pastorsx](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@pastorsx](https://discuss.elastic.co/u/pastorsx)\
**Post date:** [October 11, 2018, 2:59pm UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079/1 "2018-10-11T14:59:04Z")

</div>

Hi,

I am interested in using metric beat but I need to do some filtering of pods based on labels for some kibana visualizations....  
Is there a way to do so?... I would have expected the pod metricset in kubernetes to support that, but it doesn't seem so.

I am not able to see the labels in the metricbeat output.

thanks,

---

<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:** [October 12, 2018, 10:44am UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079/2 "2018-10-12T10:44:36Z")

</div>

Hi @pastorsx 🙂

Please, can you post your current metricbeat configuration and the version you're using? In 6.4 all labels within a pod should be automatically attached to the metrics that are being sent.

Best regards!

---

<div class="post-metadata">

**Author:** ![pastorsx](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@pastorsx](https://discuss.elastic.co/u/pastorsx)\
**Post date:** [October 12, 2018, 11:55am UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079/3 "2018-10-12T11:55:22Z")

</div>

Thanks Mario to come back at me.... here is the content of the values.yaml (I am using helm to deploy it). As you can see, the version is 6.4.2, so it should be supported.

(spacing seems not respected here, sorry)

> image:  
> repository: [docker.elastic.co/beats/metricbeat](http://docker.elastic.co/beats/metricbeat)  
> tag: 6.4.2  
> pullPolicy: IfNotPresent
> 
> daemonset:  
> podAnnotations:   
> config:  
> metricbeat.config:  
> modules:  
> path: ${path.config}/modules.d/_.yml  
> reload.enabled: false  
> processors:  
> - add\_cloud\_metadata:  
> - add\_kubernetes\_metadata:  
> in\_cluster: true  
> output.file:  
> enabled: false  
> path: "/home/englab/metricbeat/data"  
> filename: metricbeat  
> rotate\_every\_kb: 10000  
> number\_of\_files: 5  
> output.elasticsearch:  
> hosts: ["[http://10.107.174.73:9200](http://10.107.174.73:9200)"]  
> modules:  
> system:  
> enabled: true  
> config:  
> - module: system  
> period: 10s  
> metricsets:  
> - cpu  
> - load  
> - memory  
> - network  
> - process  
> - process\_summary  
> processes: ['._']  
> process.include\_top\_n:  
> by\_cpu: 5 # include top 5 processes by CPU  
> by\_memory: 5 # include top 5 processes by memory  
> - module: system  
> period: 1m  
> metricsets:  
> - filesystem  
> - fsstat  
> processors:  
> - drop\_event.when.regexp:  
> system.filesystem.mount\_point: '^/(sys|cgroup|proc|dev|etc|host|lib)($|/)'  
> kubernetes:  
> enabled: true  
> config:  
> - module: kubernetes  
> metricsets:  
> - node  
> - system  
> - pod  
> - container  
> - volume  
> period: 10s  
> hosts: ["10.3.16.150:10255"]  
> enabled: true  
> add\_metadata: true  
> in\_cluster: true  
> deployment:  
> podAnnotations:   
> config:  
> metricbeat.config:  
> modules:  
> path: ${path.config}/modules.d/\*.yml  
> reload.enabled: false  
> processors:  
> - add\_cloud\_metadata:  
> - add\_kubernetes\_metadata:  
> in\_cluster: true  
> output.file:  
> enabled: false  
> path: "/home/englab/metricbeat/data"  
> filename: metricbeat  
> rotate\_every\_kb: 10000  
> number\_of\_files: 5  
> output.elasticsearch:  
> hosts: ["[http://10.107.174.73:9200](http://10.107.174.73:9200)"]  
> modules:  
> kubernetes:  
> enabled: true  
> config:  
> - module: kubernetes  
> metricsets:  
> - state\_node  
> - state\_deployment  
> - state\_replicaset  
> - state\_pod  
> - state\_container  
> period: 10s  
> hosts: ["kube-state-metrics:8080"]  
> add\_metadata: true  
> in\_cluster: true
> 
> plugins:
> 
> extraVolumes:   
> extraVolumeMounts:
> 
> resources: {}

---

<div class="post-metadata">

**Author:** ![pastorsx](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@pastorsx](https://discuss.elastic.co/u/pastorsx)\
**Post date:** [October 12, 2018, 6:46pm UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079/4 "2018-10-12T18:46:13Z")

</div>

I actually realized something today..... the labels still do work.. but not everywhere...

The kubernetes module using the state\* metricsets works fine and labels are showing up:  
kubernetes:  
enabled: true  
config:  
- module: kubernetes  
metricsets:  
- state\_node  
- state\_deployment  
- state\_replicaset  
- state\_pod  
- state\_container  
period: 10s  
hosts: ["kube-state-metrics:8080"]  
add\_metadata: true  
in\_cluster: true

but the kubernetes other metricsets dont' show any label... I tried different syntx as you can see.... but I just cannot have the labels in there... any idea if this is broken in 6.4.2:

```
kubernetes:
  enabled: true
  config:
    - module: kubernetes
      metricsets:
        - node
        - system
        - pod
        - container
        - volume
      period: 10s
      hosts: ["localhost:10255"]
      enabled: true
      add_metadata: true
      in_cluster: true
      processors:
      - add_cloud_metadata:
      - add_kubernetes_metadata:
          in_cluster: true

```

thanks,

---

<div class="post-metadata">

**Author:** ![cchenna](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@cchenna](https://discuss.elastic.co/u/cchenna)\
**Post date:** [November 5, 2018, 10:24pm UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079/5 "2018-11-05T22:24:09Z")

</div>

I am having the same issue. Are you able to resolve this issue?

---

<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:** [December 3, 2018, 10:24pm UTC](https://discuss.elastic.co/t/can-i-get-the-pod-labels-in-the-metricsets/152079/6 "2018-12-03T22:24:16Z")

</div>

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