gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 11:35:43 25 4
gpt4 key购买 nike

我在尝试在本地设置 fluentd-elasticsearch 时尝试访问 Kibana 仪表板。这是link我跟着。我检查了 Kibana 的 pod 日志。它显示以下错误:

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

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

最佳答案

经过讨论,似乎哪里出了问题就更加清楚了。

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

  1. 修改kibana-deployment.yaml并删除 env 下的以下内容:
- name: SERVER_BASEPATH
value: /api/v1/namespaces/kube-system/services/kibana-logging/proxy

这样你kibana-deployment.yaml看起来像:

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
  1. 修改kibana-service.yaml将服务类型设置为 NodePort:
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

Kibana 应该可以通过 http://<clusterip>:30601 访问

背景

您将直接访问http://clusterip:30601没有给定的基本路径。所以必须删除它,这样 kibana 才能使用 /作为基本路径。否则它会尝试将基本路径/api/v1/[...] 附加到您的网址。如果你想测试它,你可以试试。

This comment from an elastic search guy mentions ,如果你想使用 /,你必须完全删除 base_path .

将服务修改为NodePort是必要的,因为K8s默认不发布端口。我刚刚在 this question 上回答了类似的问题.

原答案(错误)

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

env:
- name: ELASTICSEARCH_URL
value: http://elasticsearch-logging:9200
- name: SERVER_BASEPATH
value: /api/v1/namespaces/kube-system/services/kibana-logging/proxy

你是否相应地设置了它们?

假设您有一个直接连接到 kibana 实例的入口、负载均衡器或 NodePort,因此您希望使用 http://yourserver:9200/ 直接访问它.然后 SERVER_BASEPATH/

关于elasticsearch - 无法在 Ubuntu 上的 kubernetes cluser 中访问 Kibana 仪表板服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52414767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com