通过ingress在kubernetes集群上通过子路径暴露kibana

5cg8jx4n  于 2023-04-10  发布在  Kibana
关注(0)|答案(1)|浏览(191)

我在我的kubernetes集群上安装并运行了弹性操作符,我希望能够通过/kibana子路径访问kibana。我有一个配置如下的入口:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-kb
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules: 
  - host: ""
    http:
      paths:
      - path: /kibana(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: kb-qs-kb-http
            port:
              number: 5601

我的kibana示例的yaml文件应该是什么样子,这样才能通过/kibana路径访问它?

ujv3wf0j

ujv3wf0j1#

试试这个:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: kibana-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
    - host: "localhost" #OR YOUR HOST
      http:
        paths:
          - pathType: Prefix
            path: "/kibana"
            backend:
              service:
                name: kb-qs-kb-http
                port:
                  number: 5601

也可以看看这个链接,更清楚地了解NGINX重写是如何工作的:https://kubernetes.github.io/ingress-nginx/examples/rewrite/

相关问题