Hi!
I'm struggling with a problem in middleware configuration since last month, which makes me unable to upgrade Traefik from v2.3 to v.24.
To demonstrate the problem I'm facing, I'm going to use the "whoami" application from the docs.
Currently, I'm using Traefik v2.3.7, installed through the helm chart, v9.19.0, and GKE 1.19. I've defined the following Middlewares, in the "whoami" namespace:
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: whoami
spec:
rateLimit:
average: 100
burst: 50
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-auth
spec:
basicAuth:
secret: admin-secret
The Ingress is declared as below:
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: myingress
annotations:
kubernetes.io/ingress.class: traefik-staging
traefik.ingress.kubernetes.io/router.entrypoints: web, websecure
traefik.ingress.kubernetes.io/router.tls: "true"
traefik.ingress.kubernetes.io/router.middlewares: whoami-whoami@kubernetescrd, whoami-test-auth@kubernetescrd
spec:
rules:
- host: test.whoami.superdomain.com.br
http:
paths:
- path: /bar
pathType: Exact
backend:
service:
name: whoami
port:
number: 80
- path: /foo
pathType: Exact
backend:
service:
name: whoami
port:
number: 80
The static configuration I provide is through CLI, some of them inserted by the chart. From the deployment, we can see the arguments:
...
containers:
- args:
- --global.checknewversion
- --global.sendanonymoususage
- --entryPoints.traefik.address=:9000/tcp
- --entryPoints.web.address=:8000/tcp
- --entryPoints.websecure.address=:8443/tcp
- --api.dashboard=true
- --ping=true
- --providers.kubernetescrd
- --providers.kubernetesingress
- --log.level=DEBUG
- --providers.kubernetesingress.ingressclass=traefik-staging
- --providers.kubernetescrd.ingressclass=traefik-staging
- --entryPoints.websecure.proxyProtocol.trustedIPs=<SOME_IPS>
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.web.http.redirections.entrypoint.to=:443
...
Both middlewares work fine when using Traefik v.2.3.7, as the following messages from the logs show:
2021-06-22 16:49:54.676 BRT
time="2021-06-22T19:49:54Z" level=debug msg="Creating middleware" routerName=myingress-whoami-test-whoami-superdomain-com-br-foo@kubernetes middlewareName=whoami-test-auth@kubernetescrd middlewareType=BasicAuth entryPointName=web
2021-06-22 16:49:54.676 BRT
time="2021-06-22T19:49:54Z" level=debug msg="Creating middleware" entryPointName=web routerName=myingress-whoami-test-whoami-superdomain-com-br-foo@kubernetes middlewareType=RateLimiterType middlewareName=whoami-whoami@kubernetescrd
But when switching to v.2.4.0 (or any newer v.2.4 version), they are not recognized anymore:
2021-06-22 17:02:56.477 BRT
time="2021-06-22T20:02:56Z" level=error msg="middleware \"whoami-test-auth@kubernetescrd\" does not exist" entryPointName=websecure routerName=myingress-whoami-test-whoami-superdomain-com-br-foo@kubernetes
2021-06-22 17:02:56.477 BRT
time="2021-06-22T20:02:56Z" level=error msg="middleware \"whoami-test-auth@kubernetescrd\" does not exist" entryPointName=websecure routerName=myingress-whoami-test-whoami-superdomain-com-br-bar@kubernetes
Thanks for the help and give me notice if further information is needed!