如何将我的 Kibana pod 连接到 Kubernetes 中的 Elastic 集群
How can I connect my Kibana pod to my Elastic cluster in Kubernetes
我正在尝试在 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 pod 中检查过,这个 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 pod启动时使用的命令行(由helm chart生成)是
/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 集群 url 是正确的,并且可以访问。
但是,当我在浏览器中显示 UI 时,我得到以下页面
总而言之,两个版本是相同的:
- docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4
- docker.elastic.co/kibana/kibana:6.5.4
ElasticSearch url 是正确的,但是 Kibana 不想访问 ElasticSearch
我自己试过了,Kibana docker 图片 and/or Helm chart 中有一些关于如何将参数传递到 Kibana 的内容。基本上,命令行显示:
--elasticsearch.url=http://elasticsearch-client.elastic.svc.cluster.local:9200
但是,如果您 shell 进入 container/pod,您会看到 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
我认为您使用的是 OSS Elasticsearch 发行版和非 OSS Kibana 包。
你可以试试 docker.elastic.co/kibana/kibana-oss:6.5.4 吗?
我正在尝试在 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 pod 中检查过,这个 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 pod启动时使用的命令行(由helm chart生成)是
/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 集群 url 是正确的,并且可以访问。
但是,当我在浏览器中显示 UI 时,我得到以下页面
总而言之,两个版本是相同的:
- docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4
- docker.elastic.co/kibana/kibana:6.5.4
ElasticSearch url 是正确的,但是 Kibana 不想访问 ElasticSearch
我自己试过了,Kibana docker 图片 and/or Helm chart 中有一些关于如何将参数传递到 Kibana 的内容。基本上,命令行显示:
--elasticsearch.url=http://elasticsearch-client.elastic.svc.cluster.local:9200
但是,如果您 shell 进入 container/pod,您会看到 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
我认为您使用的是 OSS Elasticsearch 发行版和非 OSS Kibana 包。
你可以试试 docker.elastic.co/kibana/kibana-oss:6.5.4 吗?