首页 > 解决方案 > 在 Kubernetes 入口中具有基于路径的路由的多路径应用程序

问题描述

我想通过具有多条路径的入口运行 Spring Boot 应用程序

http://localhost:8888/login
http://localhost:8888/client/dev

在本地主机上,当我运行此应用程序时,它会自动重定向到 /login

我正在使用 traefik 入口控制器。pod 和服务正在运行。入口配置如下。

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/redirect-entry-point: https
    traefik.ingress.kubernetes.io/rewrite-target: /
  name: config
  namespace: default
spec:
  rules:
  - host: config.example.com
    http:
      paths:
      - backend:
          service:
            name: config
            port:
              number: 8888
        path: /config
        pathType: ImplementationSpecific
status:
  loadBalancer: {}

当我打开https://config.example.com/config时 ,它会重定向到https://config.example.com/login并且出现 404 错误。

可以使用哪些注释,以便允许我进行进一步的子路径路由。

标签: kuberneteskubernetes-ingressnginx-ingresstraefik-ingress

解决方案


推荐阅读