Preserve client source IP for Kubernetes ingress?

6/18/2019

I am using this Ingress it is similar to Nginx: https://cloud.ibm.com/docs/containers?topic=containers-ingress_annotation#general

When I do:

request -> LoadBalancer Service -> client source public IP returned
request -> Ingress -> LoadBalancer Service -> some private IP returned

I would like to preserve the client source public IP. In my Service I am setting ExternalTrafficPolicy: Local, and it works when hitting the LoadBalancer directly, but I do not know what setting I require when going through the Ingress.

-- atkayla
ibm-cloud
kubernetes
kubernetes-ingress
nginx
nginx-ingress

1 Answer

6/18/2019

For preserving Ingress source IP, see these steps: https://cloud.ibm.com/docs/containers?topic=containers-ingress#preserve_source_ip

Essentially you do the same thing that you've described, except that you edit the existing alb service.

-- bhpratt
Source: StackOverflow