<p>I have config my ingress support SSL:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "service"
  annotations:
    nginx.ingress.kubernetes.io/whitelist-source-range: "x.x.x.x/xx"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  tls:
  - hosts:
    - "example.com"
    secretName: example.name
  rules:
  - host: "example.com"
    http:
      paths:
      - path: /
        backend:
          serviceName: service
          servicePort: 80
</code></pre>

<p>In my config above, only IP in whitelist can access the domain for both HTTP &amp; HTTPS. But I would like to config all IP addresses can access <code>https://example.com</code> (HTTPS) and some IP addresses in whitelist can access without SSL - <code>http://example.com</code>.</p>

<p>I have resolved my issue by add more config to nginx location (listen both http and https) by use <code>nginx.ingress.kubernetes.io/configuration-snippet</code> annotation.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "service"
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    # The configs to allow all IPs access via https and allow some IPs in
    # security whitelist access via http
    nginx.ingress.kubernetes.io/configuration-snippet: |

      if ($https) {
        set $allow_ip true;
      }

      if ($remote_addr ~ (x.x.x.x|y.y.y.y) {
        set $allow_ip true;
      }

      if ($allow_ip != true) {
        return 403;
      }
spec:
  tls:
  - hosts:
    - "example.com"
    secretName: example.name
  rules:
  - host: "example.com"
    http:
      paths:
      - path: /
        backend:
          serviceName: service
          servicePort: 80
</code></pre>
