Multi-path application with path based routing in Kubernetes ingress

5/24/2021

I want to run a spring boot application over ingress having multiple path Like

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

On localhost when i run this application it automatically redirect to /login

I am using traefik ingress controller. The pod and service is running. Ingress configured as below.

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: {}

when i open https://config.example.com/config it redirects to https://config.example.com/login and i get 404 error.

What annotations can be used so that it allow me to do further sub path routing.

-- Mohit Dhingra
kubernetes
kubernetes-ingress
nginx-ingress
traefik-ingress

0 Answers