Advanced Traefik 2.0 with Kubernetes - Fabrice Aneche
Following my earlier post about Traefik 2 and Kubernetes, here are some advanced configuration examples and a full yaml example at the end of this post:
Protecting a route with a password Create an htpasswd file named users for a user admin
htpasswd -c users admin Use kubectl to create the secret (easier for multi lines file).
kubectl create secret generic admin-authsecret --from-file=users Create a middleware for authentication:
apiVersion: traefik.containo.us/v1alpha1 kind: Middleware metadata: name: admin-auth spec: basicAuth: secret: admin-authsecret Then apply this admin-auth middleware to each IngressRoute you want to protect.
blog.nobugware.com