Get the client IP address from a Kuberneter cluster

I am trying to get the IP address of the client in an app in the cluster. I only get the IP of the NodeBalancer, so I've been trying to set up headers correctly.

I have enabled use-forwarded-headers: "true" in the ingress controller configmap
That seemed to change the IP I get from the local cluster IP to the Linode server IP, but still not the actual client IP.

Then, it seems (from instructions I've found here:, that you also need to add an annotation to the ingress controller service: v2

I've installed the ingress controller with HELM, and I just can't seem to figure out how to set this annotation. I tried using the methods in the article above:
kubectl edit service name-of-my-index-controller-service

That just resulted in an http error (503 I think). This command opened the definition in an editor, and I edited the file, then did a kubectl apply -f file-name

I'm no expert in working with HELM or Kubernetes, so ANY help, pointers and hints are welcome. This issue is driving me nuts :)

2 Replies

Linode Staff

This guide from Kong Docs has some information that I think might be helpful in your situation here.

I also found these guides that have useful information as well. (This link in particular)

i got same problem as @MrTom did you find any solution? or else i have to leave linode. I tried every solution available in the internet but still i just get ip address of linode instance. not the actual client ip.

my setup is :
public_user -> linode_loadbalancer -> ingress-nginx-controller(managed by helm chart) -> ingress -> my-service ->deployments [on the same namespace I have also configure config map (managed by ingress)]

I have update ingress annotations with :
configuration-snippet: |
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

and I also have updated the config map with :
allow-snippet-annotations: 'true'
compute-full-forwarded-for: 'true'
enable-real-ip: 'true'
use-forwarded-headers: 'true'

also i change the service >> specs to :
externalTrafficPolicy: Local

none of them work can any one help me how to preserve client ip address


Please enter an answer

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] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct