<p>I have a new kubernetes cluster, I installed Traefik v1.7.6 on it and enabled Traefik dashboard which is working fine.</p>

<p>Now I want to add basic auth on the ingress service of traefik dashboard, I followed <a href="https://docs.traefik.io/user-guide/kubernetes/#basic-authentication" rel="nofollow noreferrer">docs</a> : </p>

<ul>
<li>created a secret called <code>auth-traefik</code> from htpasswd generated file in same namespace as Traefik</li>
<li><p>added following annotations to ingress dashboard:</p>

<pre><code>kubernetes.io/ingress.class: traefik
traefik.ingress.kubernetes.io/auth-secret: auth-traefik
traefik.ingress.kubernetes.io/auth-type: basic
</code></pre></li>
</ul>

<p>I can't access the dashboard anymore and got the following page: <code>502 Bad Gateway nginx/1.13.12</code></p>

<p>I restarted traefik pod and there is the following log : </p>

<pre><code>*{"level":"error","msg":"Failed to retrieve auth configuration for ingress kube-system/traefik-dashboard: failed to load auth credentials: secret \"kube-system\"/\"auth-traefik\" not found","time":"2018-12-26T23:45:59Z"}*
</code></pre>

<p>More details: Ubuntu 18.04 running on a x64 <a href="https://www.scaleway.com" rel="nofollow noreferrer">Scaleway</a> server. I tried a regular &amp; MicroK8s installation, both have the same issue (I'm going on with the MicroK8s one, for now).</p>

<p>Traefik was installed through the latest Helm package (with default values, I only enabled the dashboard)</p>

<p>Looks like you might have created the <code>auth-traefik</code> Kubernetes secret on a different namespace from <code>kube-system</code> where it's looking for it. (Looks like the <code>Ingress</code> is defined in the <code>kube-system</code> namespace).</p>

<p>You can check with:</p>

<pre><code>$ kubectl -n kube-system get secret auth-traefik -o=yaml
</code></pre>

<p>If it's not there (is it in a different namespace? monitoring? default?), then you can create it:</p>

<pre><code>$ kubectl create secret generic auth-traefik --from-file auth --namespace=kube-system
</code></pre>

<p>Or the <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/" rel="nofollow noreferrer">ServiceAccount</a> that your Traefik pod is using doesn't have <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/" rel="nofollow noreferrer">RBAC</a> access to the <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">Secrets</a> resource in the `kube-system namespace.</p>
