- Create login credentials using
htpasswd
htpasswd -nBb admin password > auth
- Create Kubernetes Secret
kubectl create secret generic admin-secret --from-file=auth
Kubernetes will create base64 encoded string from the given file. That's why we don't need to encoded manually in the first step.
- Review Midlleware Basic Auth and Deploy it
- check Kubernetes Secret
kubectl get secrets admin-secret -o jsonpath='{.data.auth}'|base64 -d
- check Traefik Middleware
kubectl get middlewares.traefik.containo.us