apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: obfront namespace: observe annotations: nginx.ingress.kubernetes.io/enable-cors: "true" nginx.ingress.kubernetes.io/cors-allow-origin: "*" nginx.ingress.kubernetes.io/proxy-cache: "true" nginx.ingress.kubernetes.io/proxy-cache-path: "/tmp/nginx-cache" nginx.ingress.kubernetes.io/proxy-cache-methods: "GET,HEAD,POST" nginx.ingress.kubernetes.io/proxy-cache-min_uses: "1" nginx.ingress.kubernetes.io/proxy-cache-lock: "on" nginx.ingress.kubernetes.io/proxy-cache-valid: "10m" nginx.ingress.kubernetes.io/proxy-cache-max-size: "100m" spec: rules: - host: observe-ui.cestong.com.cn http: paths: - path: / pathType: Prefix backend: service: name: obf port: number: 80 ingressClassName: nginx --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: obui namespace: observe annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 spec: rules: - host: observe-ui.cestong.com.cn http: paths: - path: /top/(.*) pathType: Prefix backend: service: name: obui port: number: 80 ingressClassName: nginx --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: rewrite2grafana namespace: observe annotations: nginx.ingress.kubernetes.io/enable-cors: "true" nginx.ingress.kubernetes.io/cors-allow-origin: "*" nginx.ingress.kubernetes.io/rewrite-target: /$1 spec: rules: - host: observe-ui.cestong.com.cn http: paths: - path: /grafana(/|$)(.*) # 匹配外部 Grafana URL,并捕获字符 pathType: Prefix backend: service: name: grafana port: number: 80 ingressClassName: nginx