# Metricbeat error fetching kube-state-metrics

**URL:** https://discuss.elastic.co/t/metricbeat-error-fetching-kube-state-metrics/277493
**Category:** Beats
**Created:** [June 30, 2021, 7:31pm UTC](https://discuss.elastic.co/t/metricbeat-error-fetching-kube-state-metrics/277493 "2021-06-30T19:31:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anupshrestha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anupshrestha/32/78726_2.png) [@anupshrestha](https://discuss.elastic.co/u/anupshrestha)
#### Post date: [June 30, 2021, 7:31pm UTC](https://discuss.elastic.co/t/metricbeat-error-fetching-kube-state-metrics/277493/1 "2021-06-30T19:31:42Z")

</div>

I am getting the following error in metricbeat deployment that is configured to fetch and push metrics from kube-state-metrics.

```auto
2021-06-30T19:25:11.318Z	ERROR	[kubernetes.state_statefulset]	state_statefulset/state_statefulset.go:97	decoding of metric family failed: context deadline exceeded (Client.Timeout or context cancellation while reading body)

```

Metricbeat Image: [docker.elastic.co/beats/metricbeat:7.13.0](http://docker.elastic.co/beats/metricbeat:7.13.0)  
Metricbeat config:

```auto
metricbeat:
  modules:
  - add_metadata: "true"
    hosts:
    - kube-state-metrics.monitoring:8080
    metricsets:
    - state_node
    - state_daemonset
    - state_deployment
    - state_replicaset
    - state_statefulset
    - state_pod
    - state_container
    - state_cronjob
    - state_persistentvolume
    - state_persistentvolumeclaim
    module: kubernetes
    period: 10s
output:
  elasticsearch:
    hosts:
    - https://gs-monitor-es-http.monitoring.svc:9200
    password: REDACTED
    ssl:
      certificate_authorities:
      - /mnt/elastic-internal/elasticsearch-certs/ca.crt
    username: metricbeat
setup:
  dashboards:
    enabled: true
  kibana:
    host: https://gs-monitor-kb-http.monitoring.svc:5601
    password: REDACTED
    ssl:
      certificate_authorities:
      - /mnt/elastic-internal/kibana-certs/ca.crt
    username: metricbeat

```

I think metricbeat is timing out getting the metrics from kube-state-metrics but I am not sure how to fix this. Any help will be much appreciated. Thanks!

---

<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: [July 28, 2021, 7:31pm UTC](https://discuss.elastic.co/t/metricbeat-error-fetching-kube-state-metrics/277493/2 "2021-07-28T19:31:56Z")

</div>

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