无法在Ubuntu上的kubernetes cluser中访问Kibana仪表板服务

时间:2018-09-19 22:01:13

标签: elasticsearch kubernetes kibana fluentd

我试图访问Kibana仪表板,同时尝试在场所中建立流利的弹性搜索。这是我遵循的link。我检查了Kibana吊舱的日志。它显示以下错误:

{"type":"log","@timestamp":"2018-09-19T21:45:42Z","tags":["warning","config","deprecation"],"pid":1,"message":"You should set server.basePath along with server.rewriteBasePath. Starting in 7.0, Kibana will expect that all requests start with server.basePath rather than expecting you to rewrite the requests in your reverse proxy. Set server.rewriteBasePath to false to preserve the current behavior and silence this warning."}
root@mTrainer3:/logging# kubectl logs kibana-logging-66d577d965-mbbg5 -n kube-system
{"type":"log","@timestamp":"2018-09-19T21:45:42Z","tags":["warning","config","deprecation"],"pid":1,"message":"You should set server.basePath along with server.rewriteBasePath. Starting in 7.0, Kibana will expect that all requests start with server.basePath rather than expecting you to rewrite the requests in your reverse proxy. Set server.rewriteBasePath to false to preserve the current behavior and silence this warning."}
{"type":"log","@timestamp":"2018-09-19T21:46:08Z","tags":["status","plugin:kibana@6.4.1","info"],"pid":1,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}

有人可以建议我如何解决此问题吗?

2 个答案:

答案 0 :(得分:2)

在讨论之后,更清楚的是什么地方错了。

您正在使用没有负载均衡器的本地群集。您必须设置一个入口或使用NodePort作为服务类型。我将用NodePort描述解决方案。采取两个步骤:

  1. 修改COMAddin.Object并在kibana-deployment.yaml下删除以下内容:
env

使您- name: SERVER_BASEPATH value: /api/v1/namespaces/kube-system/services/kibana-logging/proxy 看起来像:

kibana-deployment.yaml
  1. 修改apiVersion: apps/v1 kind: Deployment metadata: name: kibana-logging namespace: kube-system labels: k8s-app: kibana-logging kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile spec: replicas: 1 selector: matchLabels: k8s-app: kibana-logging template: metadata: labels: k8s-app: kibana-logging annotations: seccomp.security.alpha.kubernetes.io/pod: 'docker/default' spec: containers: - name: kibana-logging image: docker.elastic.co/kibana/kibana-oss:6.3.2 resources: # need more cpu upon initialization, therefore burstable class limits: cpu: 1000m requests: cpu: 100m env: - name: ELASTICSEARCH_URL value: http://elasticsearch-logging:9200 ports: - containerPort: 5601 name: ui protocol: TCP 以将服务类型设置为NodePort:
kibana-service.yaml

然后执行

apiVersion: v1
kind: Service
metadata:
  name: kibana-logging
  namespace: kube-system
  labels:
    k8s-app: kibana-logging
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
    kubernetes.io/name: "Kibana"
spec:
  type: NodePort
  ports:
  - port: 5601
    protocol: TCP
    targetPort: ui
    nodePort: 30601
  selector:
    k8s-app: kibana-logging

应在kubectl apply -f kibana-deployment.yaml kubectl apply -f kibana-service.yaml 上访问基巴那语

背景

您将直接访问http://<clusterip>:30601,而无需提供给定的基本路径。因此必须将其删除,以使kibana使用http://clusterip:30601作为基本路径。否则,它将尝试将基本路径/ api / v1 / [...]附加到您的网址。如果要测试,可以尝试一下。

This comment from an elastic search guy mentions,如果要使用/,则必须完全删除base_path。

由于K8默认情况下不发布端口,因此必须将服务修改为NodePort。我刚刚在this question上回答了类似的问题。

原始答案(错误)

在您正在链接的仓库中,我可以看到kibana-deployment.yaml必须设置环境变量:

/

您是否进行了相应设置?

让我们假设您直接有一个入口,负载均衡器或NodePort到kibana实例,因此您想直接通过http://yourserver:9200/到达它。那么env: - name: ELASTICSEARCH_URL value: http://elasticsearch-logging:9200 - name: SERVER_BASEPATH value: /api/v1/namespaces/kube-system/services/kibana-logging/proxy SERVER_BASEPATH

答案 1 :(得分:0)

或者,您也可以通过指定环境变量来指定 Kibana 来重写服务器基本路径。

修改 kibana-deployment.yaml 以添加以下内容。

- name: SERVER_REWRITEBASEPATH
  value: "true"

现在申请: kubectl apply -f kibana-deployment.yaml

microk8s 上对此进行了测试,并且与 kubectl proxy 配合良好

http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/kibana-logging/proxy/app/kibana