Kibana not able to connect to Elasticsearch via internal dns, even though everything appears to be correct?


Got a weird one here. Just set up a new docker host, added it to rancher and moved across my ELK stack to it. The stack is the 3 separate official containers with standard settings but for some reason my Kibana container is just not happy trying to connect to the Elasticsearch container when it’s linked.

8/1/2016 10:37:44 AMe[34m  log  e[39m [09:37:44.019] [e[31merrore[39m][elasticsearch] Request error, retrying -- getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200
8/1/2016 10:37:44 AMe[34m  log  e[39m [09:37:44.020] [e[31mwarninge[39m][elasticsearch] Unable to revive connection: http://elasticsearch:9200/
8/1/2016 10:37:44 AMe[34m  log  e[39m [09:37:44.020] [e[31mwarninge[39m][elasticsearch] No living connections

Here’s where the weirdness comes in. Everything seems to be correct. I can ping the linked name and elasticsearch appears to be working fine. I’ve tried switching to the IP instead and this works fine.

I even went and installed curl on my official kibana container and tried the linked name, again it works fine:

root@772b81c8ad66:/# curl elasticsearch:9200
  "name" : "Human Fly",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.4",
    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
    "build_timestamp" : "2016-06-30T11:24:31Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  "tagline" : "You Know, for Search"

Yet despite all this kibana is still not happy and just keeps posting the above error. It only happens when I try to use the linked name even though I can actually connect fine on the container shell…

Any ideas? :confused:

You’ll want to make sure it’s in the same Namespace as kibana, so when kibana looks for elasticsearch it’ll be able to.

If you have kibana in, say frontend, and elasticsearch in backend. Kibana can only reach elasticsearch via elasticsearch.backend.

But default kibana configuration looks for elasticsearch.

So it’ll fail