Question
Load Balancer does not forward source ip
I have a service in a kubernetes cluster exposed through a load balancer. However, the load balancer is not correctly forwarding request headers to Kubernetes. For instance X-Forwarded-For contains the load balancer’s private IP address 10.X.X.X when it should have been [ClientIP],[LoadBalancerPrivateIP]. This is not due to the kubernetes routing controller, because when the service is exposed with an Ingress Controller I am getting all the headers correctly filled.
my kubernetes service definition is the following
apiVersion: v1
kind: Service
metadata:
name: myservice
labels:
app: myapp
spec:
ports:
- port: 80
targetPort: 5000
protocol: TCP
name: http
type: LoadBalancer
selector:
app: myapp
Can someone please help out on this?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×