Hello @harunaya,
Thanks for your interest in Traefik!
First, your secret does not have the required users
key as described in the following documentation (check out the content of the Kubernetes tab). Your secret should be something like:
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: dashboard-auth
spec:
basicAuth:
secret: dashboard-secret
---
apiVersion: v1
kind: Secret
metadata:
name: dashboard-secret
namespace: default
data:
# Here the encoded user:password is traefik:traefik
users: |
dHJhZWZpazokYXByMSQuVEhDTjUuNCRhSDdtR1dPMGxDUXU0Qi80Tkw0MGQxCg==
Then you will have to create an IngressRoute
to expose and secure the dashboard through Traefik. The router rule
must be adapted to fit your needs as explained here.
Note: it's not needed to mount the dashboard-secret
in the Traefik pod.
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: dashboard
spec:
entryPoints:
- websecure
routes:
- match: Host(`traefik.local`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
kind: Rule
middlewares:
- name: dashboard-auth
services:
- name: api@internal
kind: TraefikService
Finally, you will be able to access your dashboard at: https://traefik.local/dashboard/
Hope this helps!