# APM agent cannot connect to apm server

**URL:** <https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130>\
**Category:** APM\
**Tags:** java\
**Created:** [January 30, 2020, 8:40am UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130 "2020-01-30T08:40:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [January 30, 2020, 8:40am UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/1 "2020-01-30T08:40:20Z")

</div>

**Kibana version** : 7.5.2

**Elasticsearch version** : 7.5.2

**APM Server version** : 7.5.2

\*\*APM Agent language \*\*: java

\*_Original install method_: ECK operator 1.0.0 GA

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

Apm agent unable to send data to apm server

**Provide logs and/or server output (if relevant)**:

2020-01-30 07:47:07.733 [apm-server-healthcheck] WARN co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server [http://apm-server-quickstart-apm-http.elastic-system.svc.cluster.local:8200/](http://apm-server-quickstart-apm-http.elastic-system.svc.cluster.local:8200/) is not available (Connection refu  
2020-01-30 07:47:07.733 [apm-server-healthcheck] ERROR co.elastic.apm.agent.report.HttpUtils - Exception when closing input stream of HttpURLConnection.  
2020-01-30 07:47:07.734 [apm-remote-config-poller] ERROR co.elastic.apm.agent.report.HttpUtils - Exception when closing input stream of HttpURLConnection.  
2020-01-30 07:47:07.734 [apm-remote-config-poller] ERROR co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Connection refused (Connection refused)  
2020-01-30 08:17:47.438 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error sending data to APM server: Server returned HTTP response code: 503 for URL: [http://apm-server-quickstart-apm-http.elast](http://apm-server-quickstart-apm-http.elast)  
2020-01-30 08:17:47.438 [apm-reporter] WARN co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - upstream connect error or disconnect/reset before headers. reset reason: connection failure  
2020-01-30 08:17:57.443 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)  
2020-01-30 08:18:34.339 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error sending data to APM server: Server returned HTTP response code: 503 for URL: [http://apm-server-quickstart-apm-http.elast](http://apm-server-quickstart-apm-http.elast)  
2020-01-30 08:18:34.340 [apm-reporter] WARN co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - upstream connect error or disconnect/reset before headers. reset reason: connection failure  
2020-01-30 08:18:44.346 [apm-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)  
2020-01-30 08:19:20.449 [apm-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error sending data to APM server: Server returned HTTP response code: 503 for URL: [http://apm-server-quickstart-apm-http.elast](http://apm-server-quickstart-apm-http.elast)  
2020-01-30 08:19:20.449 [apm-reporter] WARN co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - upstream connect error or disconnect/reset before headers. reset reason: connection failure

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 30, 2020, 10:17am UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/2 "2020-01-30T10:17:29Z")

</div>

Please take a look at our troubleshooting pages- [https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-no-data](https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-no-data) and [https://www.elastic.co/guide/en/apm/server/master/common-problems.html](https://www.elastic.co/guide/en/apm/server/master/common-problems.html)

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 30, 2020, 10:23am UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/3 "2020-01-30T10:23:13Z")

</div>

Maybe TLS is enabled in your APM server and you are using HTTP?

---

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [January 30, 2020, 12:39pm UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/4 "2020-01-30T12:39:22Z")

</div>

Yes, that was it. now disabled tls and tried to verify it worked.

Also how do i create own secret for elastic-user and apm agent authentication in eck?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 30, 2020, 12:46pm UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/5 "2020-01-30T12:46:28Z")

</div>

When you use the ECK's operator to start the APM server, a secret for the secret token is created automatically. Same for the default elastic user with Kibana. Did you happen to see the [blog post](https://www.elastic.co/blog/using-elastic-apm-java-agent-on-kubernetes-k8s) from two days ago?

---

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [January 30, 2020, 12:47pm UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/6 "2020-01-30T12:47:45Z")

</div>

Yes, but i want to provide known values for both of them, Please let me know to do that

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 30, 2020, 12:50pm UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/7 "2020-01-30T12:50:09Z")

</div>

Ahh, I don't know about that, but I assume it is not different from manipulating any other k8s secret (or adding new ones and using them...)

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 30, 2020, 12:52pm UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/8 "2020-01-30T12:52:03Z")

</div>

Regardless of secrets, you should check out this blog post, may be very useful for you for instrumenting Java app on k8s.

---

<div class="post-metadata">

**Author:** ![kumar\_kung](https://avatars.discourse-cdn.com/v4/letter/k/9dc877/32.png) [@kumar\_kung](https://discuss.elastic.co/u/kumar_kung)\
**Post date:** [January 30, 2020, 12:52pm UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/9 "2020-01-30T12:52:39Z")

</div>

Cool, 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:** [February 20, 2020, 9:02am UTC](https://discuss.elastic.co/t/apm-agent-cannot-connect-to-apm-server/217130/10 "2020-02-20T09:02:58Z")

</div>

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