kubernetes ingress-nginx source ip

Hello!
I have followed the Kubernetes guides ingress-nginx and I am trying to get the nginx log to show the real source ip of the request in ingress-nginx

I tried setting the annotation

nginx.ingress.kubernetes.io/enable-real-ip: "true"

But still getting some weird ip address, (not mine) in the log.

x.x.x.x - - [31/Oct/2021:15:34:32 +0000] "GET / HTTP/2.0" 200 2529 "-" "curl/7.68.0" 33 0.009 [****] [] 10.2.0.20:8080 2529 0.008 200

x.x.x.x was not my ip address

Is there a way to get the real ip address of the user?

1 Reply

Linode Staff

After doing some digging around, I found this thread where a user reported a similar issue with a possible solution.

https://stackoverflow.com/questions/56656103/preserve-client-source-ip-for-kubernetes-ingress

The thread also includes a URL to the steps for preserving Ingress source IP. Hopefully this helps.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct