<p>I'm trying to setup basic auth for my test ingress rule and I couldn't figure out why it doesn't work. I can still access the site without a password prompt.</p>
<p>Versions:
EKS 1.16<br />
Helm chart nginx-ingress-0.5.2<br />
Nginx version 1.7.2(also tried with 1.7.0 and latest)</p>
<p>basic-auth secret content:</p>
<pre><code>kubectl get secret basic-auth -o yaml
apiVersion: v1
data:
  auth: Zm9vOiRhcHIxJHZ4RzVoc1VQJE1KZmpNcEQ2WHdPV1RaaTFDQUdlYTEK
kind: Secret
metadata:
  creationTimestamp: &quot;2020-07-02T04:46:58Z&quot;
  name: basic-auth
  namespace: default
  resourceVersion: &quot;8252&quot;
  selfLink: /api/v1/namespaces/default/secrets/basic-auth
  uid: e3b8a6d3-009b-4a4c-ad8b-b460381933d8
type: Opaque
</code></pre>
<p>Ingress rule:</p>
<pre><code>Ingress rule:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-world-ing
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    # type of authentication
    nginx.ingress.kubernetes.io/auth-type: basic
    # name of the secret that contains the user/password definitions
    nginx.ingress.kubernetes.io/auth-secret: basic-auth
    # message to display with an appropriate context why the authentication is required
    nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - foo'
spec:
  rules:
  - host: test.*****.com
    http:
      paths:
      - backend:
          serviceName: docker-hello-world-svc
          servicePort: 8088  
</code></pre>
<p>Also I haven't found basic-auth section within nginx controller configuration file for hello-world-ing service:</p>
<pre><code>kubectl -n nginx-ingress exec -it dev-nginx-ingress-6d5f459bf5-s4qqg -- cat /etc/nginx/conf.d/default-hello-world-ing.conf  
***
    location / {
        proxy_http_version 1.1;
        proxy_connect_timeout 60s;
        proxy_read_timeout 60s;
        proxy_send_timeout 60s;
        client_max_body_size 1m;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering on;
        proxy_pass http://default-hello-world-ing-***-docker-hello-world-svc-8088;
    }  
*** 
</code></pre>
<p>I haven't found anything suspicious in controller logs.</p>

Oles Rid
<p>Basic auth works fine with another helm repo stable/nginx-ingress instead of nginx-stable/nginx-ingress.</p>
<p>the <a href="https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-helm/" rel="nofollow noreferrer">nginx-stable</a> repository is for the commercial Nginx/NginxPlus that uses different configurations while the official Helm <a href="https://github.com/helm/charts/tree/master/stable/nginx-ingress" rel="nofollow noreferrer">stable/nginx-ingress</a> uses the open source nginx ingress.</p>
