<p>I'm trying to get a GKE ingress to require basic auth like this <a href="https://github.com/kubernetes/contrib/blob/45bdc249bc27bdf427498b42859e1a98d634bff0/ingress/controllers/nginx/examples/auth/README.md" rel="noreferrer">example from github.</a></p>

<p>The ingress works fine. It routes to the service. But the authentication isn't working. Allows all traffic right through. Has GKE not rolled this feature out yet? Something obviously wrong in my specs?</p>

<p>Here's the ingress:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: super-ingress
  annotations:
    ingress.kubernetes.io/auth-type: basic
    ingress.kubernetes.io/auth-secret: basic-auth
    ingress.kubernetes.io/auth-realm: "Authentication Required"
spec:
  rules:
  - host: zzz.host.com
    http:
      paths:
      - backend:
          serviceName: super-service
          servicePort: 9000
        path: /*
</code></pre>

<p>And the <code>basic-auth</code> secret:</p>

<pre><code>$ kubectl get secret/basic-auth -o yaml

apiVersion: v1
data:
  auth: XXXXXXXXXXXXXXXXXXX
kind: Secret
metadata:
  creationTimestamp: 2016-10-03T21:21:52Z
  name: basic-auth
  namespace: default
  resourceVersion: "XXXXX"
  selfLink: /api/v1/namespaces/default/secrets/basic-auth
  uid: XXXXXXXXXXX
type: Opaque
</code></pre>

<p>Any insights are greatly appreciated!</p>

<p>The example you linked to is for nginx ingress controller. GKE uses <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/gce" rel="noreferrer">GLBC</a>, which doesn't support auth.</p>

<p>You can <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx#deployment" rel="noreferrer">deploy</a> an nginx ingress controller in your gke cluster. Note that you need to <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx#running-multiple-ingress-controllers" rel="noreferrer">annotate</a> your ingress to avoid the GLBC claiming the ingress. Then you can expose the nginx controller directly, or create a glbc ingress to redirect traffic to the nginx ingress (see this <a href="https://gist.github.com/bprashanth/8975c55789d201c7d8a7575f5c2a4565" rel="noreferrer">snippet</a> written by bprashanh).</p>
