Hello,
We are using traefik as our LB in our GCP kubernetes cluster. We have ingresses defined like this:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-service-ingress
annotations:
traefik.ingress.kubernetes.io/router.middlewares: traefik-tenant-api-auth@kubernetescrd
traefik.ingress.kubernetes.io/router.entrypoints: web, websecure
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
ingressClassName: traefik
rules:
- host: api.website.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-service
port:
number: 8080
Notice: we are using traefik-api-auth
which is forwardAuth
which after authorization sets header Code
.
What we want to achieve is to route traffic based on Code
header. What came clear, that we need to use traefik.containo.us/v1alpha1/IngressRoute
which can define matchers, but there are 3 main questions:
- Is it possible to use IngressRoute along with Ingress to achieve what we need? (Seems like Ingress takes all the traffic and IngressRoute doesn't even work)
- Is it even possible to route based on header which is set in middleware?
- If 1 and 2nd are NOs, how can we achieve such routing using traefik without introducing new subdomains?