Skip to content

Adding whitelist ingress

Setup whitelist protection

Your can protect an ingress endpoint by using the nginx.ingress.kubernetes.io/whitelist-source-range annotation in the ingress object. You can use CIDR ip ranges or single with /32. Ips are comma (,) seperated. Example:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    # only allow 87.233.232.233  and range 87.233.199.0/24
    nginx.ingress.kubernetes.io/whitelist-source-range: 87.233.232.233/32,87.233.199.0/24
  name: myIngress
  namespace: myIngress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - pathType: Prefix
        path: /
        backend:
          service:
            name: myservice
            port:
              number: 80