如何将Kibana Pod连接到Kubernetes中的Elastic集群

时间:2019-01-18 20:24:39

标签: elasticsearch kubernetes kibana

我正在尝试在Kubernetes集群中部署Elastic和Kibana。

我已使用Helm chart安装了Elastic:

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

然后是Kibana使用Helm图表:

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

我已经从我的Kibana窗格中进行了检查,该URL可以访问并产生以下结果

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"
}

在Kibana窗格中用于启动的命令行(由舵图生成)是

/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

因此,看来Elastic cluster url是正确的,并且可以访问。

但是,当我在浏览器中显示用户界面时,会显示以下页面

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

总而言之,两个版本是相同的:

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

ElasticSearch URL是正确的,但是Kibana不想访问ElasticSearch

2 个答案:

答案 0 :(得分:2)

我自己尝试过此操作,并且Kibana docker映像和/或Helm图表中包含有关如何将参数传递到Kibana的信息。基本上,命令行显示:

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

但是,如果您将其装入容器/吊舱中,则会看到Kibana命令行期望对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

因此,某些东西无法正确翻译Elasticsearch URL。

似乎默认值是localhost:9200,因此您可以在kibana部署中尝试使用sidecar容器,以便将端口localhost:9200上的所有内容转发到elasticsearch-client.elastic.svc.cluster.local:9200。也许跟随this

答案 1 :(得分:1)

我认为您正在使用OSS Elasticsearch发行版和Non-OSS Kibana软件包。

您可以尝试使用docker.elastic.co/kibana/kibana-oss:6.5.4吗?