Get client source IP with Kubernetes Load Balancer service

November 4, 2018 2.8k views
Kubernetes Load Balancing

Hello,

I deployed Traefik to my Kubernetes cluster to act as an Ingress controller. On other clouds (e.g., Azure), you can set 'External Traffic Policy' to 'Local' in order to preserve the client source IP (https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip).

Does Digital Ocean plan on supporting this feature?

1 comment
7 Answers

Ditto; I'm toying with the idea of some non-HTTP apps that require client IP address information. Something like PROXY protocol would work in at least one case, but it would be simpler to have direct IP-level access to the client address.

I desperately need this as I'm basically ready to launch but can't without getting the client IP from the load balancer.

We definitely need to have an option to set externaTrafficPolicy to local in order to fail the health check on all Droplets that don't match the service selector. This will fix this issue. I hope DO implements this soon.

Any update on this? We are also trying to get the client ip address.

Same issue here. It's really a bummer not being supported by DO

Also same issue here.

Follow https://github.com/digitalocean/digitalocean-cloud-controller-manager/issues/144

My workaround is to set up haproxy (or nginx) on a droplet (external to the kubernetes cluster) which adds the source IP to the X-Forwarded-For header and places the kubernetes load balancer in the backend.

haproxy: option forwardfor

nginx: proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Then your web app can get the source IP from the X-Forwarded-For header.

Of course, this is a last resort :(

Have another answer? Share your knowledge.