-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting real client ip using ingress on baremetal kubernetes without loadbalancer #6163
Comments
It seems to be related to |
Additional issue is that this doesn't work with ssl-passthrough enabled (someone here had similar problem: rancher/rancher#27018). I suppose this mode disables any header processing, even adding new ones... I wonder though, if this is the case, is there a way to configure ingress to do a kind of TCP-passthrough? If ingress-nginx actually intercepts the SSL connection passing it to the backend, but can't add or process headers, would it be possible to make it work as totally opaque proxy avoding the backend even noticing that packets went through it. |
We have a similar setup and figured out the correct setting for the following setup: FW -> MetalLB -> Ingress Controller (with --ssl-passthrough) We needed to set the following flags:
I was looking at the code and it turns out the Go proxy is using the proxy_protocol to proxy requests to nginx. This is not to be mistaken with the use-proxy-protocol, because that will also instruct the Go proxy to use the proxy protocol which is not what we want. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Thanks, setting |
@kskalski is it possible to get real client IP for UDP> |
I'm using ingress-nginx configured by
microk8s enable ingress
, which roughly looks like that:that is exposed to the internet and is serving some http/https traffic routing to my services (this set-up seems to be described here as "host network" https://kubernetes.github.io/ingress-nginx/deploy/baremetal/).
Surprisingly when looking at headers of the requests arriving at my server, the IPs provided are meaningless:
Originally the ingress controller config also had
--publish-status-address=127.0.0.1
flag, which I already removed, but it didn't make much difference, the requests are still getting something like above 127.0.0.1 in headers or are reported using cni0 IP in logs.I would like to get the proper X-Forwarder-Host / X-Real-IP from originator of the request, so I can log it in my server or even use inside ingress for other features like 'nginx.ingress.kubernetes.io/whitelist-source-range' annotation (right now it is seems to be provided the address of cni0 or --publish-status-address)
Is the use of 'host network' somehow interfering with headers? Should I experiment with flags from https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/? It seems that the IP is garbled even when I use nginx.ingress.kubernetes.io/ssl-passthrough: "true" and my GRPCS backend, which is super-weird, since I though in this mode ingress-nginx won't parse/modify headers at all. Is this unrelated to the ingress-nginx and cause by other parts of microk8s kubernetes layout?
/triage support
The text was updated successfully, but these errors were encountered: