---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: dashboard-auth
spec:
  basicAuth:
    secret: dashboard-secret
---
apiVersion: v1
kind: Secret
metadata:
  name: dashboard-secret
data:
  # Here the encoded user:password is traefik:traefika
  # htpasswd -nb traefik traefik | base64
  # dHJhZWZpazokYXByMSRnT3QvenIvaSQzZTJjQ080LzhvODVySzBlV3lPZ2suCgo=
  users: |
    dHJhZWZpazokYXByMSRnT3QvenIvaSQzZTJjQ080LzhvODVySzBlV3lPZ2suCgo=
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: dashboard
spec:
  entryPoints:
    - websecure
  routes:
   - match: Host (`kube-master.informatik.fh-nuernberg.de`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
     kind: Rule
     middlewares:
        - name: dashboard-auth
     services:
        - name: api@internal
          kind: TraefikService
  tls: 
    secretName: kube-master-tls-cert
