How to preserve client ip through a GCE ingress controller on kubernetes?

12/13/2017

I've an gce ingress controller pointing to a service type NodePort.

Is there a way to preserve the client's ip? I've tried this from here, but it didn't work.

service.spec.externalTrafficPolicy = Local

I found some ways to do for nginx but none for an gce ingress.

-- Steven Barragán
google-kubernetes-engine
kubernetes

1 Answer

12/21/2017

The original ip comes in the X-Forwarded-For header. If you're using rails it may come as HTTP_X_FORWARDED_FOR

https://cloud.google.com/compute/docs/load-balancing/http/

-- Steven Barragán
Source: StackOverflow