Access external client IP from behind Google Compute Engine network load balancer
<p>I am running a Ruby on Rails app (using Passenger in Nginx mode) on Google Container Engine. These pods are sitting behind a GCE network load balancer. My question is how to access the external <code>Client IP</code> from inside the Rails app.</p>

<p>The Github issue <a href="https://github.com/kubernetes/kubernetes/issues/3760" rel="nofollow">here</a> seems to present a solution, but I ran the suggested:</p>

<pre><code>for node in $(kubectl get nodes -o name | cut -f2 -d/); do
  kubectl annotate node $node \
    net.beta.kubernetes.io/proxy-mode=iptables;
  gcloud compute ssh --zone=us-central1-b $node \
    --command="sudo /etc/init.d/kube-proxy restart";
done
</code></pre>

<p>but I am still getting a <code>REMOTE_ADDR</code> header of <code>10.140.0.1</code>.</p>

<p>On ideas on how I could get access to the real <code>Client IP</code> (for geolocation purposes)?</p>

<p>Edit: To be more clear, I am aware of the ways of accessing the client IP from inside Rails, however all of these solutions are getting me the internal Kubernetes IP, I believe the GCE network load balancer is not configured (or perhaps unable) to send the real client IP.</p>