Requirement: In application pod level, need to see all client ip's.
I tried with type=LoadBalancer and externalTrafficPolicy: Local in local, But it is not working for me.
I've tried with alb ingress and nginx ingress, both also not working.
So, i disabled SNAT also, still my pods not getting client IP.
In load balancer level i can see client IP's.
Every time my pod logs showing source ip, Client Request comes to load balancer then forward to nodeport and forward to pod. Due to this process my pods was getting node ip's only.
I want to see all client ip's in pod logs.
Hi @sarath9985 if you haven't already, you need to enable Proxy Protocol on your Network Load Balancer and nginx-ingress.
https://kubernetes.github.io/ingress-nginx/deploy/#aws
https://medium.com/kokster/how-to-setup-nginx-ingress-controller-on-aws-clusters-7bd244278509.
If you are using an ALB can get the original IP from the HTTP headers (as pass it on if required).
https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html
Hi @whereisaaron thanks for your response. enabled proxy protocol is working for which pod receive the request that pod only print the client ips. Rest of the pods not printing same logs.
my requirement is need to print client ips on every pod logs.
Enabled host network true and open host port.
This should works, if you have multiple pods, every pod should print client ips.
Issue solved
Hey, @whereisaaron just to tell you your comment was really helpful. Also, it works with NLBs. Thanks.
Most helpful comment
Hi @sarath9985 if you haven't already, you need to enable Proxy Protocol on your Network Load Balancer and nginx-ingress.
https://kubernetes.github.io/ingress-nginx/deploy/#aws
https://medium.com/kokster/how-to-setup-nginx-ingress-controller-on-aws-clusters-7bd244278509.
If you are using an ALB can get the original IP from the HTTP headers (as pass it on if required).
https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html