How to read client IP addresses from HTTP requests behind Kubernetes services?

前端 未结 7 1114
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-03 01:03

my web application is running as a Kubernetes pod behind an nginx reverse proxy for SSL. Both the proxy and my application use Kubernetes services for load balancing (as des

7条回答
  •  Happy的楠姐
    2020-12-03 02:04

    Right now, no.

    Services use kube_proxy to distribute traffic to their backends. Kube-proxy uses iptables to route the service IP to a local port where it is listening, and then opens up a new connection to one of the backends. The internal IP you are seeing is the IP:port of kube-proxy running on one of your nodes.

    An iptables only kube-proxy is in the works. That would preserve the original source IP.

提交回复
热议问题