title: How to whitelist only one path in kubernetes nginx ingress controller
body: <p>Using the Nginx Ingress Controller, we would like to expose different paths of a Kubernetes service, with different security requirements.</p>
  
  <ol>
  <li><p><code>/</code> is open to the public</p></li>
  <li><p><code>/white-list</code> only allows connections from a specific IP Address</p></li>
  <li><p><code>/need-key</code> requires an API key</p></li>
  </ol>
  
  <p>I'm running in AWS EKS. Kubernetes version is as follows:<code>v1.12.6-eks-d69f1b</code>.</p>
  
  <p>If we use Annotations, they apply to the entire service. Ideally I would like to apply an Annotation only to a path. </p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: ingress-myServiceA
    annotations:
      # use the shared ingress-nginx
      kubernetes.io/ingress.class: "nginx"
  spec:
    rules:
    - host: myServiceA.foo.org
      http:
        paths:
        - path: /
          backend:
            serviceName: myServiceA
            servicePort: 80
        - path: /white-list
          backend:
            serviceName: myServiceA
            servicePort: 80
            **NEED SOMETHING HERE TO WHITELIST**
        - path: /need-key
          backend:
            serviceName: myServiceA
            servicePort: 80
            **NEED SOMETHING HERE TO USE API-KEY**
  </code></pre>
  
  <p>The results I've been having end up applying to all the paths.
  I can live without API-Key as I can code that out, but ideally, I'd rather have it managed outside of the container.</p>
  
  <p>Has anyone accomplished this with NGINX Ingress controller?</p>