Accessing client IP of HTTP request from GKE

0 votes

I am trying to run a gunicorn+flask service in a docker container with GCE. I have already set up the cluster following the tutorial at http://kubernetes.io/docs/hellonode/

The REMOTE_ADDR environmental variable has an internal address in the Kubernetes cluster. HTTP_X_FORWARDED_FOR but it's missing from the request headers. Is it possible to configure the service to retain the external client ip in the requests?

Nov 6, 2018 in Kubernetes by Damon Salvatore
• 5,390 points
73 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

i assume you set up your service by setting the service's type to LoadBalancer? It's an unfortunate limitation of the way incoming network-load-balanced packets are routed through Kubernetes right now that the client IP gets lost.

Instead of using the service's LoadBalancer type, you could set up an Ingress object to integrate your service with a Google Cloud HTTP(s) Load Balancer, which will add the X-Forwarded-For header to incoming requests.

answered Nov 6, 2018 by DareDev
• 6,670 points

Related Questions In Kubernetes

0 votes
1 answer

Pods IP address from inside a container in the pod

Make sure that your pod yaml file ...READ MORE

answered Aug 29, 2018 in Kubernetes by Kalgi
• 36,220 points
40 views
0 votes
1 answer

Accessing private Docker Hub repository from Kubernetes on Vagrant

In order to pull private dockerhub hosted ...READ MORE

answered Sep 18, 2018 in Kubernetes by DareDev
• 6,670 points
125 views
0 votes
1 answer

How can I access a service installed on Kubernetes from anywhere?

I have followed the link which you have ...READ MORE

answered Jul 23, 2018 in Kubernetes by Atul
• 10,220 points
76 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 36,220 points
37 views
0 votes
1 answer
0 votes
1 answer

Getting the pod's ip address for the container inside of it

You can make sure that the replication ...READ MORE

answered Aug 24, 2018 in Kubernetes by DareDev
• 6,670 points
31 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.