title: Configuring nginx to use ingress authentication by default on GKE?
body: <p>I've been trying to set up ingress authentication for an nginx server running on GKE, per <a href="https://kubernetes.github.io/ingress-nginx/examples/auth/basic/" rel="nofollow noreferrer">these instructions</a>. I want to always require auth by default instead of just "foo.bar.com", so the ingress config in my manifest looks like this instead:</p>
  
  <pre><code>---
  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: ingress-with-auth
    annotations:
      nginx.ingress.kubernetes.io/auth-type: basic
      nginx.ingress.kubernetes.io/auth-secret: basic-auth
      nginx.ingress.kubernetes.io/auth-type: 'Authentication Required - foo'
  spec:
    rules:
    - http:
        paths:
        - path: /
          backend:
            serviceName: http-svc
            servicePort: 80
  ---
  </code></pre>
  
  <p>When I use <code>kubectl create -f</code> to deploy, everything spins up properly and the ingress IP displays the default nginx page as expected, but it doesn't ask for auth credentials at all. Why not?</p>