最近遇到一个需求,是这样的,apache kylin的UI界面是http://localhost:7070/kylin,不过如下List-1所示,我们想请求的url没有kylin前缀,但是到k8s那里,uri要加上kylin前缀。

    List-1


http://kylin.com:7070/   ->  http://kylin.com:7070/kylin

    经过一方探索,可以给ingress加上app-root来实现,如下List-2,参考的这里。 

  List-2

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kylin-ingress
  annotations:
    nginx.ingress.kubernetes.io/app-root: /kylin
spec:
  rules:
    - host: kylin.com
      http:
        paths:
          - path: /
            backend:
              serviceName: kylin
              servicePort: 8080

 

Reference

  1. https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md

转载于:https://my.oschina.net/u/2518341/blog/3060638

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐