Search code examples
elasticsearchdockerkubernetesgraylog2

Graylog cannot connect to Elasticsearch in Kubernetes cluster


I deployed Graylog on a Kubernetes cluster and everything was working fine, until I decided to add an environment variable and update the graylog deployment.

Now, some things stopped working. I can see that all inputs are running and they are accepting messages:

enter image description here

However, if I try to see the received messages, it returns 500 error with the following message:

a

The docs say that the Graylog container needs a service called elasticsearch

docker run --link some-mongo:mongo --link some-elasticsearch:elasticsearch -p 9000:9000 -e GRAYLOG_WEB_ENDPOINT_URI="http://127.0.0.1:9000/api" -d graylog2/server

And if I attach to the graylog pod and curl elasticsearch:9200, I see a successful result:

{
  "name" : "Vixen",
  "cluster_name" : "graylog",
  "cluster_uuid" : "TkZtckzGTnSu3JjERQNf4g",
  "version" : {
    "number" : "2.4.4",
    "build_hash" : "fcbb46dfd45562a9cf00c604b30849a6dec6b017",
    "build_timestamp" : "2017-01-03T11:33:16Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
}

But if the graylog logs say that it is trying to connect to the localhost:

enter image description here

Again, everything was working to this day. Why is it trying to connect to the localhost, not the elastic search service?


Solution

  • Looks like it was a version problem. I downgraded the graylog container to the previous stable version: 2.2.3-1 and it started working again.

    My guess is that when I updated the images today, it pulled the latest version which corrupted some things