I am follow this steps to add basic auth to treafik 2.1.6,first create kuberntes(v1.15.2) secret:
openssl rand -base64 32
htpasswd -bc auth dabai-admin hbzwvEbfRGSN4MAiycCVM30stfGjzR6dZPDh9bS5te4=
kubectl create secret generic treafik-secret-name --from-file=auth -n kube-system
create middleware:
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: basic-auth
spec:
basicAuth:
secret: treafik-secret-name
tweak traefik config and add middleware we create:
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik-dashboard-route
annotations:
kubernetes.io/ingress.class: traefik
ingress.kubernetes.io/auth-type: basic
ingress.kubernetes.io/auth-secret: traefik-secret-name
spec:
entryPoints:
- web
routes:
- match: Host(`traefik.example.com`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
kind: Rule
services:
- name: traefik
port: 8080
middlewares:
- name: basic-auth
finally when I access the domain traefik.example.com
,it give me this tips:404 page not found
.something is misssing with traefik basic auth? what should I do to make it right?The expect action is show the login popup form, enter password correct could login success.