# Metricbeat on kubernetes - Desired pods and Available pods are wrong

**URL:** <https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 2, 2018, 12:15pm UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202 "2018-07-02T12:15:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![akd](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@akd](https://discuss.elastic.co/u/akd)\
**Post date:** [July 2, 2018, 12:15pm UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/1 "2018-07-02T12:15:48Z")

</div>

Hi. I have deployed metricbeat daemonset on my kubernetes cluster with predefined kibana dashboards. I also deployed kube-state-metrics and I configure metricbeat according to it. I get metrics and seems good. However, althoguh I have 72 pods according to kubectl, metricbeat shows desired and available pods as 205.

I've used [https://raw.githubusercontent.com/elastic/beats/6.3/deploy/kubernetes/metricbeat-kubernetes.yaml](https://raw.githubusercontent.com/elastic/beats/6.3/deploy/kubernetes/metricbeat-kubernetes.yaml) for daemonset configuration. I only added following module on configmap.

- module: kubernetes  
enabled: true  
metricsets:
  - state\_node
  - state\_deployment
  - state\_replicaset
  - state\_statefulset
  - state\_pod
  - state\_container  
period: 10s  
hosts: ["kube-state-metrics:8080"]

ps -\> I used 6.3.0 images for elasticsearch, kibana and metricbeat.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [July 2, 2018, 1:55pm UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/2 "2018-07-02T13:55:22Z")

</div>

Hi @akd,

To be sure, can you double check both numbers manually?

In kubernetes:

```auto
kubectl get pods --all-namespaces | wc -l

```

In Kibana:

Go to discover, using `metricbeat-*` index pattern and filter for `metricset.name: state_pod` and check if you find something wrong

Best regards

---

<div class="post-metadata">

**Author:** ![akd](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@akd](https://discuss.elastic.co/u/akd)\
**Post date:** [July 3, 2018, 1:15pm UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/3 "2018-07-03T13:15:24Z")

</div>

I inspected the issue and realized that I have 41 pods from deployments and 30 from daemonset. metricbeat does not support daemonset stats yet therefore the desired and available pod stats should show 41. However, it shows 205 where I have 5 nodes on my kubernetes. This means it multiplies the pod count with number of nodes. Is there any configuration for this situation or is this a bug?

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [July 4, 2018, 9:24am UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/4 "2018-07-04T09:24:11Z")

</div>

uhm that should not happen, although 41 x 5 == 205 is really suspicious. Did you modify the default `period` by a chance? Visualizations are minded for 10s period

---

<div class="post-metadata">

**Author:** ![akd](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@akd](https://discuss.elastic.co/u/akd)\
**Post date:** [July 4, 2018, 2:34pm UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/5 "2018-07-04T14:34:53Z")

</div>

I checked periods. They are 10 seconds. When I shut one node down it shows 164. It definitely multiplies with number of nodes. Interesting issue.

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [July 4, 2018, 2:53pm UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/6 "2018-07-04T14:53:40Z")

</div>

arg sorry, I finally understood what's going on. I didn't read your first post correctly (sorry again). `state_*` metricsets are global metrics. So by deploying them in the daemonset you are multiplying the output by the number of nodes.

This is why our reference manifests use an extra Deployment (apart from the Daemonset) for these: [https://github.com/elastic/beats/blob/6.3/deploy/kubernetes/metricbeat-kubernetes.yaml#L164-L250](https://github.com/elastic/beats/blob/6.3/deploy/kubernetes/metricbeat-kubernetes.yaml#L164-L250)

As for the daemonset metrics, we are working on them 🙂 Have a look to: [https://github.com/elastic/beats/issues/7058](https://github.com/elastic/beats/issues/7058)

Best regards

---

<div class="post-metadata">

**Author:** ![akd](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@akd](https://discuss.elastic.co/u/akd)\
**Post date:** [July 5, 2018, 6:18am UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/7 "2018-07-05T06:18:31Z")

</div>

Thanks. I didn't see thls comment # Deploy singleton instance in the whole cluster for some unique data sources, like kube-state-metrics. My bad.

---

<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 2, 2018, 8:30am UTC](https://discuss.elastic.co/t/metricbeat-on-kubernetes-desired-pods-and-available-pods-are-wrong/138202/8 "2018-08-02T08:30:10Z")

</div>

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