2017-10-13 193 views
1

我有一個正在運行的elasticsearch集羣,我試圖將kibana連接到這個集羣(同一節點)。目前,當我嘗試在我的瀏覽器中使用以下命令打開服務時,頁面會掛起。 。在我kibana莢日誌,在POD的最後幾個日誌消息:被安裝到kibana莢將kibana連接到kubernetes集羣中的elasticsearch

{"type":"log","@timestamp":"2017-10-13T17:23:46Z","tags":["listening","info"],"pid":1,"message":"Server running at http://0.0.0.0:5601"} 
{"type":"log","@timestamp":"2017-10-13T17:23:46Z","tags":["status","ui settings","error"],"pid":1,"state":"red","message":"Status changed from uninitialized to red - Elasticsearch plugin is red","prevState":"uninitialized","prevMsg":"uninitialized"} 
{"type":"log","@timestamp":"2017-10-13T17:23:49Z","tags":["status","plugin:[email protected]","error"],"pid":1,"state":"red","message":"Status changed from yellow to red - Request Timeout after 3000ms","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"} 

我kibana.yml文件具有以下配置:

server.name: kibana-logging 
server.host: 0.0.0.0 
elasticsearch.url: http://elasticsearch:9300 
xpack.security.enabled: false 
xpack.monitoring.ui.container.elasticsearch.enabled: true 

和我elasticsearch .yml文件具有以下配置設置(我有3種ES莢)

cluster.name: elasticsearch-logs 
node.name: ${HOSTNAME} 
network.host: 0.0.0.0 

bootstrap.memory_lock: false 
xpack.security.enabled: false 
discovery.zen.minimum_master_nodes: 2 
discovery.zen.ping.unicast.hosts: ["172.17.0.3:9300", "172.17.0.4:9300", "172.17.0.4:9300"] 

我覺得這個問題是目前與network.host領域,但我不知道。我缺少什麼字段/是否需要修改以便連接到彈性搜索的kibana容器,如果它們在同一集羣/節點中?謝謝!

ES服務:

apiVersion: v1 
kind: Service 
metadata: 
    name: elasticsearch 
    labels: 
    component: elasticsearch 
    role: master 
spec: 
    type: NodePort 
    selector: 
    component: elasticsearch 
    role: master 
    ports: 
    - name: http 
    port: 9200 
    targetPort: 9200 
    nodePort: 30303 
    protocol: TCP 

Kibana SVC

apiVersion: v1 
kind: Service 
metadata: 
    name: kibana 
    namespace: default 
    labels: 
    component: kibana 
spec: 
    type: NodePort 
    selector: 
    component: kibana 
    ports: 
    - port: 80 
    targetPort: 5601 
    protocol: TCP 

編輯: 在這裏kibana.yml改變端口9200後是我在日誌在年底看到當我嘗試訪問kibana:

{"type":"log","@timestamp":"2017-10-13T21:36:30Z","tags":["listening","info"],"pid":1,"message":"Server running at http://0.0.0.0:5601"} 
{"type":"log","@timestamp":"2017-10-13T21:36:30Z","tags":["status","ui settings","error"],"pid":1,"state":"red","message":"Status changed from uninitialized to red - Elasticsearch plugin is red","prevState":"uninitialized","prevMsg":"uninitialized"} 
{"type":"log","@timestamp":"2017-10-13T21:36:33Z","tags":["status","plugin:[email protected]","error"],"pid":1,"state":"red","message":"Status changed from yellow to red - Request Timeout after 3000ms","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"} 
{"type":"log","@timestamp":"2017-10-13T21:37:02Z","tags":["error","elasticsearch","admin"],"pid":1,"message":"Request error, retrying\nPOST http://elasticsearch:9200/.reporting-*/esqueue/_search?version=true => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200"} 
{"type":"log","@timestamp":"2017-10-13T21:37:32Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"} 
{"type":"log","@timestamp":"2017-10-13T21:37:33Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"} 
{"type":"log","@timestamp":"2017-10-13T21:37:37Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"} 
{"type":"log","@timestamp":"2017-10-13T21:37:38Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"} 
{"type":"log","@timestamp":"2017-10-13T21:37:42Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"} 
+0

你可以發佈你的服務定義?您正嘗試連接到「elasticsearch.default:9300」,但是您是否已將此作爲服務正確公開,尚不清楚。 – vascop

+0

當然,編輯我的帖子來添加服務定義,我也改變了我的文件使用elasticsearch:9300,而不是添加默認 – appdap1

回答

2

這裏的問題是你在端口上暴露Elasticsearch 9200,但正試圖連接到您的kibana.yml文件中的端口9300。

你要麼需要修改kibana.yml文件中使用:

elasticsearch.url: http://elasticsearch:9200 

還是在elasticsearch服務端口更改爲9300

+0

哦,男人,我一直盯着這太久,我完全錯過了。謝謝!然而,改變端口似乎沒有改變,結果仍然掛起 – appdap1

+0

當我嘗試使用'minikube service kibana'訪問kibana時,我看到一條錯誤消息(請參閱編輯) – appdap1

+0

您的3個端口通過端口9300發現。你有暴露該服務的端口嗎?此外,對這種pod IP進行硬編碼也是非常糟糕的做法。你看過有狀態組嗎? – vascop