I am using a Nginx Ingress Controller in a Kubernetes Cluster. I've got an application within the cluster, which was available over the internet. Now I'm using the Ingress Controller to access the application, with the intent of showing some custom errors.
If i access the application (which is not written by myself, therefore I can't change things there), it receives the IP address of the nginx-ingress-controller-pod
. The logs of the nginx-ingress-controller-pod
indicate that the remote address is a different one.
I've already tried things like use-proxy-protocol
, then I would be able to use $remote_addr
and get the right IP. But as I mentioned I am not able to change my application, so I have to "trick" the ingress controller to use the $remote_addr
as his own.
How can i configure the ingress, so the application will get the request from the remote IP and not from the nginx-ingress-controller-pod
IP? Is there a way to do this?
Edit: I'm using a bare metal kubernetes installation with kubernetes v1.19.2 and the nginx chart ingress-nginx-3.29.0
.
192.168.13.0
and my application got a clientip of192.168.90.2
, which is the ip of the ingress-controller-pod. The application then forwards this ip to another pod/service, which rejects it, because its not192.168.13.0
. I hope i could make the problem understandable.