I have to get the real ip from the request in my business.actually I got the 10.2.100.1
every time at my test environment. any way to do this ?

- 1,619
- 5
- 19
- 37
-
This is the same question as http://stackoverflow.com/questions/32723675/gce-k8s-accessing-referral-ip-address – Robert Bailey Sep 24 '15 at 15:41
3 Answers
This is the same question as GCE + K8S - Accessing referral IP address and How to read client IP addresses from HTTP requests behind Kubernetes services?.
The answer, copied from them, is that this isn't yet possible in the released versions of Kubernetes.
Services go through kube_proxy, which answers the client connection and proxies through to the backend (your web server). The address that you'd see would be the IP of whichever kube-proxy the connection went through.
Work is being actively done on a solution that uses iptables as the proxy, which will cause your server to see the real client IP.

- 1
- 1

- 12,633
- 2
- 38
- 55
-
-
It'll be available via settings on the kubelet in 1.1 (which'll be released in mid-late October) and by default in 1.2 (which should come ~3 months after that) – Alex Robinson Sep 25 '15 at 07:05
Try to get that service IP which service is associated with that pods.

- 2,241
- 4
- 26
- 37
-
1I mean if I deploy a web service in kubernetes cluster ,I need know about the source IP from client request in service pod . But I got the kube-proxy IP. It doesn't make any sense – sope Sep 24 '15 at 14:12
One very roundabout way right now is to set up an HTTP liveness probe and watch the IP it originates from. Just be sure to also respond to it appropriately or it'll assume your pod is down.

- 1
- 1