# Connection reset by peer when connecting to Elastic

**URL:** https://discuss.elastic.co/t/connection-reset-by-peer-when-connecting-to-elastic/296065
**Category:** Beats
**Tags:** beats-module, heartbeat
**Created:** [February 2, 2022, 1:12pm UTC](https://discuss.elastic.co/t/connection-reset-by-peer-when-connecting-to-elastic/296065 "2022-02-02T13:12:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![brampurnot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brampurnot/32/101233_2.png) [@brampurnot](https://discuss.elastic.co/u/brampurnot)
#### Post date: [February 2, 2022, 1:12pm UTC](https://discuss.elastic.co/t/connection-reset-by-peer-when-connecting-to-elastic/296065/1 "2022-02-02T13:12:36Z")

</div>

Hi all,

I'm trying to setup Heartbeat without Logstash (directly integrated into Elastic ECK) on a kubernetes platform.  
When the pod is starting, I can see the following error message:  
Failed to connect to backoff(Elasticsearch([http://elsmonitor-es-transport.elastic-system.svc.cluster.local:9300](http://elsmonitor-es-transport.elastic-system.svc.cluster.local:9300))): Get "[http://elsmonitor-es-transport.elastic-system.svc.cluster.local:9300](http://elsmonitor-es-transport.elastic-system.svc.cluster.local:9300)": read tcp 10.250.0.4:59966-\>100.96.0.226:9300: **read: connection reset by peer**

For some reason, the connection fails. I have metricbeat configured and that is working fine. Here is the Elasticsearch output I configured (logstash output is commented out btw):

```auto
      output.elasticsearch:
        hosts: ['elsmonitor-es-http.elastic-system.svc.cluster.local:9200']
        username: ${ELASTICSEARCH_USERNAME}
        password: ${ELASTICSEARCH_PASSWORD}
      setup.kibana:
        host: "http://kibmonitor-kb-http.elastic-system.svc.cluster.local:5601"

```

Any help is appreciated because I tried all kinds of things but without any luck. I also checked the Elastic logs but couldn't find any log back for why the connection was reset.

Bram

---

<div class="post-metadata">

### Author: ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)
#### Post date: [February 3, 2022, 9:14pm UTC](https://discuss.elastic.co/t/connection-reset-by-peer-when-connecting-to-elastic/296065/2 "2022-02-03T21:14:58Z")

</div>

Hi @brampurnot , `connection was reset` could encompass a number of issues, all of which are typically network related. Are you sure the pod has connectivity to ES? Is Metricbeat in the same pod? If it was a credentials related issue you'd get a different error.

Unfortunately it's hard to say more than that, it seems that the container heartbeat is running in can't even get as far as a TCP connection. You could also try `curl` from the same pod to make sure those credentials work.

---

<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: [March 3, 2022, 11:15pm UTC](https://discuss.elastic.co/t/connection-reset-by-peer-when-connecting-to-elastic/296065/3 "2022-03-03T23:15:37Z")

</div>

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