How can I connect my Kibana pod to my Elastic cluster in Kubernetes

1/18/2019

I'm trying to deploy Elastic and Kibana in a Kubernetes cluster.

I have installed Elastic using Helm chart :

helm repo add elastic https://helm.elastic.co
helm repo update
helm install stable/elasticsearch --namespace elastic --name elasticsearch --set imageTag=6.5.4

And Kibana using Helm chart :

helm install elastic/kibana --namespace elastic --name kibana --set imageTag=6.5.4,elasticsearchURL=http://elasticsearch-client.elastic.svc.cluster.local:9200

I've checked from my Kibana pod, and this URL is reachable and produce the following result

curl -v http://elasticsearch-client:9200
* About to connect() to elasticsearch-client port 9200 (#0)
*   Trying 10.19.251.82...
* Connected to elasticsearch-client (10.19.251.82) port 9200 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: elasticsearch-client:9200
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-length: 519
<
{
  "name" : "elasticsearch-client-8666954ffb-kthcx",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "-MT_zbKySiad0jDJVc1ViQ",
  "version" : {
    "number" : "6.5.4",
    "build_flavor" : "oss",
    "build_type" : "tar",
    "build_hash" : "d2ef93d",
    "build_date" : "2018-12-17T21:17:40.758843Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

The command line used in the Kibana pod to start (generated by the helm chart) is

/usr/share/kibana/bin/../node/bin/node --no-warnings /usr/share/kibana/bin/../src/cli --cpu.cgroup.path.override=/ --cpuacct.cgroup.path.override=/ --elasticsearch.url=http://elasticsearch-client:9200

So it seems the Elastic cluster url is the right one, and reachable.

However, when I show the UI in my browser, I get the following page

My Kibana UI seems to indicates an error and an invalid version

So to sum up, both versions are identical :

  • docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4
  • docker.elastic.co/kibana/kibana:6.5.4

ElasticSearch url is correct, but Kibana don't want to access ElasticSearch

-- Riduidel
elasticsearch
kibana
kubernetes

2 Answers

1/19/2019

I tried this myself and there's something with the Kibana docker image and/or Helm chart on how the parameter is passed into Kibana. Basically, the command line shows:

--elasticsearch.url=http://elasticsearch-client.elastic.svc.cluster.local:9200

But if you shell into the container/pod you see that Kibana command line expect something different for the elasticsearch URL (-e, --elasticsearch <uri>):

$ /usr/share/kibana/bin/kibana --help

  Usage: bin/kibana [command=serve] [options]

  Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch.

  Commands:
    serve  [options]  Run the kibana server
    help  <command>   Get the help for a specific command

  "serve" Options:

    -h, --help                 output usage information
    -e, --elasticsearch <uri>  Elasticsearch instance
    -c, --config <path>        Path to the config file, can be changed with the CONFIG_PATH environment variable as well. Use multiple --config args to include multiple config files.
    -p, --port <port>          The port to bind to
    -q, --quiet                Prevent all logging except errors
    -Q, --silent               Prevent all logging
    --verbose                  Turns on verbose logging
    -H, --host <host>          The host to bind to
    -l, --log-file <path>      The file to log to
    --plugin-dir <path>        A path to scan for plugins, this can be specified multiple times to specify multiple directories
    --plugin-path <path>       A path to a plugin which should be included by the server, this can be specified multiple times to specify multiple paths
    --plugins <path>           an alias for --plugin-dir
    --optimize                 Optimize and then stop the server

So, something is not translating the elasticsearch URL correctly.

It seems like the default is localhost:9200 so you could try a sidecar container in your kibana deployment so that forwards everything on port localhost:9200 to elasticsearch-client.elastic.svc.cluster.local:9200. Perhaps following this

-- Rico
Source: StackOverflow

1/19/2019

I think you're using the OSS Elasticsearch distribution and the Non-OSS Kibana package.

Can you try with docker.elastic.co/kibana/kibana-oss:6.5.4 ?

-- lucabelluccini
Source: StackOverflow