Hi.
I'm trying to apply a middleware in global to my fresh install of traefik ingress. I use the traefik chart to deploy traefik.
time="2022-06-30T14:31:16Z" level=error msg="middleware \"headers-default@kubernetescrd\" does not exist" entryPointName=websecure routerName=traefik-kubernetes-dashboard-ingress-578701c9f38d0d3a2640@kubernetescrd
I have created the middleware
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: headers-default
namespace: traefik
spec:
headers:
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
stsIncludeSubdomains: true
stsPreload: true
stsSeconds: 15552000
customFrameOptionsValue: SAMEORIGIN
In the chart:
...
...
providers:
kubernetesCRD:
enabled: true
allowCrossNamespace: true
allowExternalNameServices: false
# ingressClass: traefik-internal
# labelSelector: environment=production,method=traefik
namespaces: []
# - "default"
...
...
additionalArguments:
- "--providers.kubernetesingress.ingressclass=traefik"
- "--api.insecure=true"
- "--serversTransport.insecureSkipVerify=true"
- "--entrypoints.websecure.http.middlewares=headers-default@kubernetescrd"
...
~# kubectl -n traefik get middlewares.traefik.containo.us headers-default -o yaml
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"traefik.containo.us/v1alpha1","kind":"Middleware","metadata":{"annotations":{},"name":"headers-default","namespace":"traefik"},"spec":{"headers":{"browserXssFilter":true,"contentTypeNosniff":true,"customFrameOptionsValue":"SAMEORIGIN","forceSTSHeader":true,"stsIncludeSubdomains":true,"stsPreload":true,"stsSeconds":15552000}}}
creationTimestamp: "2022-06-30T12:42:48Z"
generation: 1
name: headers-default
namespace: traefik
resourceVersion: "2341673"
uid: 0338c872-5360-4077-8bdf-a82235718a9e
spec:
headers:
browserXssFilter: true
contentTypeNosniff: true
customFrameOptionsValue: SAMEORIGIN
forceSTSHeader: true
stsIncludeSubdomains: true
stsPreload: true
stsSeconds: 15552000
Traefik says he can't find the middleware headers-default@kubernetescrd.
Any idea please ? Thanks in advance for your help.