-
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
remote ip address not preserved in logs #3431
Comments
We are seeing the same behavior on GKE with nginx-ingress. $the_real_ip = kube-proxy IP --> Incorrect. |
That means the service |
Got it working. Started working after recreating the pods. Not sure if related or just delay in log streams. |
@celamb4 did you make any config changes before you recreated the pods? |
Closing. The ingress controller does not create any cloud resource (i.e. the service type=LoadBalancer) Please open an issue in the main Kubernetes repository |
Just in case the GCP load balancer doesn't support proxy protocol (setting this will break nginx) |
@mjhuber you could try to change the ingress-nginx service (like adding an annotation) to trigger a sync of the service Also, check in the gcp console you only see one instance of the nodes as healthy (this means externalTrafficPolicy: Local it's working correctly) |
I annotated the service and the load balancers are setup correctly, only pointing to the nodes containing ingress controllers. I will watch the logs and see if any more incorrect IPs come through. |
Okay, so on one cluster where we are seeing this issue the annotating of the service helped, and seems to have re-synced the service correctly. However, the issue on the other cluster seems different. Here's a log snippet:
The curious part is that the EDIT: Looking at more logs. All of the requests to the ingress controller seem to be coming from some variant of |
Great link thanks for notifying us |
For people landing here and using Nginx as NodePort behind gce-ingress, and trying to preserve the client's Source IP using Nginx, there's no need to use Proxy Protocol or other complex configurations, installing with this configuration will do it (use an updated Nginx): config:
enable-real-ip: "true"
use-forwarded-headers: "true"
proxy-real-ip-cidr: "130.211.0.0/22,35.191.0.0/[L7-LB_EXTERNAL_IP]/32" |
@gustavovalverde, thanks, fwiw, you're missing a config:
enable-real-ip: "true"
use-forwarded-headers: "true"
proxy-real-ip-cidr: "130.211.0.0/22,35.191.0.0/16,[L7-LB_EXTERNAL_IP]/32" |
Can someone elaborate |
What do you mean by elaborate? Note that the fragment there has a typo (see my follow-up): |
@jsoref I'd like to understand how did you came up with the string |
https://cloud.google.com/load-balancing/docs/https
|
The |
Ah, ok. Thanks for clarifying @jsoref! |
NGINX Ingress controller version: 0.20.0
Kubernetes version (use
kubectl version
): 1.10.7-gke.11What happened:
Nginx logs show a source IP of the internal kube-proxy IP address, even when the LoadBalancer is set
externalTrafficPolicy: Local
. Ex:What you expected to happen:
The source IP in the logs should show the external remote ip address of the client.
How to reproduce it (as minimally and precisely as possible):
externalTrafficPolicy: Local
.Anything else we need to know:
I'm using Kubernetes 1.10.7-gke.11 with
externalTrafficPolicy: Local
set on the LoadBalancer. Requests via HTTP and HTTPS always have a remote IP address set to the internal IP of the kube-proxy.I have tried adding
use-proxy-protocols: "true"
to the ConfigMap as others have suggested but that didn't change it.Kubernetes version: 1.10.7-gke.11
ingress-nginx Helm Chart: nginx-ingress-0.31.0
The text was updated successfully, but these errors were encountered: