kubernetes 部署后无法使用入口路径 url 访问 Kibana
Kibana not accessible with ingress path url after kubernetes deployment
我无法通过入口路径 UI 访问 Kibana 服务器 url 我已经在 Kubernetes 集群上部署了 Kibana pod 和 Elasticsearch。在访问 UI 时,它显示为“503 服务不可用”,并且将路径重定向为 https://myserver.com/spaces/enter。 elasticsearch 和 kibana pods 都是 运行。我可以通过我的入口路径 url curl 我的 elasticsearch pod。有人可以帮助解决这个问题吗?
Kibana yaml 文件:
deployment.yaml
---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "kibana-development"
namespace: "development"
spec:
selector:
matchLabels:
app: "kibana-development"
replicas: 1
strategy:
type: "RollingUpdate"
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
minReadySeconds: 5
template:
metadata:
labels:
app: "kibana-development"
spec:
containers:
-
name: "kibana-development"
image: "docker.elastic.co/kibana/kibana:7.10.2"
imagePullPolicy: "Always"
env:
- name: "ELASTICSEARCH_HOSTS"
value: "https://my-server.com/elasticsearch"
ports:
-
containerPort: 5601
protocol: TCP
imagePullSecrets:
-
name: "kibana"
service.yaml
---
apiVersion: "v1"
kind: "Service"
metadata:
name: "kibana-development"
namespace: "development"
labels:
app: "kibana-development"
spec:
ports:
-
port: 56976
targetPort: 5601
selector:
app: "kibana-development"
ingress.yaml
---
apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
metadata:
name: "kibana-development-ingress"
namespace: "development"
annotations:
nginx.ingress.kubernetes.io/rewrite-target: "/"
spec:
rules:
-
host: "my-server.com"
http:
paths:
-
backend:
serviceName: "kibana-development"
servicePort: 56976
path: "/kibana/(.*)"
我可以通过 cluster-ip:port 访问 Kibana,但不能使用入口路径 url。有没有我遗漏的注释?或者用于 elasticsearch 和 kibana 的版本 7.10.2 不稳定。我检查了我的端点,它显示了我的 cluster-ip
问题现已解决,需要在 deployment.yaml 文件中添加以下两个环境变量。
-
name: "SERVER_BASEPATH"
value: "/kibana-development"
-
name: "SERVER_REWRITEBASEPATH"
value: "false"
不要忘记 SERVER_BASEPATH 值中的“/”
我无法通过入口路径 UI 访问 Kibana 服务器 url 我已经在 Kubernetes 集群上部署了 Kibana pod 和 Elasticsearch。在访问 UI 时,它显示为“503 服务不可用”,并且将路径重定向为 https://myserver.com/spaces/enter。 elasticsearch 和 kibana pods 都是 运行。我可以通过我的入口路径 url curl 我的 elasticsearch pod。有人可以帮助解决这个问题吗?
Kibana yaml 文件:
deployment.yaml
---
apiVersion: "apps/v1"
kind: "Deployment"
metadata:
name: "kibana-development"
namespace: "development"
spec:
selector:
matchLabels:
app: "kibana-development"
replicas: 1
strategy:
type: "RollingUpdate"
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
minReadySeconds: 5
template:
metadata:
labels:
app: "kibana-development"
spec:
containers:
-
name: "kibana-development"
image: "docker.elastic.co/kibana/kibana:7.10.2"
imagePullPolicy: "Always"
env:
- name: "ELASTICSEARCH_HOSTS"
value: "https://my-server.com/elasticsearch"
ports:
-
containerPort: 5601
protocol: TCP
imagePullSecrets:
-
name: "kibana"
service.yaml
---
apiVersion: "v1"
kind: "Service"
metadata:
name: "kibana-development"
namespace: "development"
labels:
app: "kibana-development"
spec:
ports:
-
port: 56976
targetPort: 5601
selector:
app: "kibana-development"
ingress.yaml
---
apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
metadata:
name: "kibana-development-ingress"
namespace: "development"
annotations:
nginx.ingress.kubernetes.io/rewrite-target: "/"
spec:
rules:
-
host: "my-server.com"
http:
paths:
-
backend:
serviceName: "kibana-development"
servicePort: 56976
path: "/kibana/(.*)"
我可以通过 cluster-ip:port 访问 Kibana,但不能使用入口路径 url。有没有我遗漏的注释?或者用于 elasticsearch 和 kibana 的版本 7.10.2 不稳定。我检查了我的端点,它显示了我的 cluster-ip
问题现已解决,需要在 deployment.yaml 文件中添加以下两个环境变量。
-
name: "SERVER_BASEPATH"
value: "/kibana-development"
-
name: "SERVER_REWRITEBASEPATH"
value: "false"
不要忘记 SERVER_BASEPATH 值中的“/”