Nginx k8s cluster ingress

11/20/2020

I have 2 kubernetes clusters on digitalocean. One cluster has nginx installed via helm:

helm install nginx bitnami/nginx

I need to "whitelist" the other cluster IP address. So basically one cluster can receive incoming calls to an endpoint from a specific cluster.<br/>

I don't know how to configure the helm values.yaml file generated. Normally with nginx we can use:

whitelist-source-range

But the helm chart i don't know how to do it.<br/> thanks

-- Youssef Harkati
digital-ocean
kubernetes
kubernetes-helm
nginx

1 Answer

11/23/2020

Whitelist-source-range is an annotation that can be added to an Ingress object, for example:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: whitelist
  annotations:
    ingress.kubernetes.io/whitelist-source-range: "1.1.1.1/24"
spec:
  rules:
  - host: whitelist.test.net
  http:
    paths:
    - path: /
    backend:
      serviceName: webserver
      servicePort: 80

You may also need to change service.externalTrafficPolicy to Local

-- kool
Source: StackOverflow