Search code examples
kubernetesgoogle-cloud-platformgoogle-kubernetes-engine

Limiting access by IP in kubernetes on GCP's GKE


I am running kubernetes (k8s) on top of Google Cloud Patform's Container Engine (GKE) and Load Balancers (GLB). I'd like to limit the access at a k8s ingress to an IP whitelist.

Is this something I can do in k8s or GLB directly, or will I need to run things via a proxy which does it for me?


Solution

  • The way to whitelist source IP's in nginx-ingress is using below annotation.

    ingress.kubernetes.io/whitelist-source-range

    But unfortunately, Google Cloud Load Balancer does not have support for it, AFAIK.

    If you're using nginx ingress controller you can use it.

    The value of the annotation can be comma separated CIDR ranges.

    More on whitelist annotations.

    Issue tracker for progress on Google Cloud Load Balancer support for whitelisting source IP's.