# Kong in kubernetes client ip is ingress ip

**URL:** <https://discuss.konghq.com/t/kong-in-kubernetes-client-ip-is-ingress-ip/7101>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [September 10, 2020, 10:15am UTC](https://discuss.konghq.com/t/kong-in-kubernetes-client-ip-is-ingress-ip/7101 "2020-09-10T10:15:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggstrong](https://avatars.discourse-cdn.com/v4/letter/g/3ec8ea/32.png) [@ggstrong](https://discuss.konghq.com/u/ggstrong)\
**Post date:** [September 10, 2020, 10:15am UTC](https://discuss.konghq.com/t/kong-in-kubernetes-client-ip-is-ingress-ip/7101/1 "2020-09-10T10:15:01Z")

</div>

```
    apiVersion: v1

    kind: Service

    metadata:

      annotations:

        service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp

        service.beta.kubernetes.io/aws-load-balancer-type: nlb

      name: kong-proxy

      namespace: kong

    spec:

      externalTrafficPolicy: Local

      ports:

      - name: proxy

        port: 8000

        protocol: TCP

        targetPort: 8000

      - name: proxy-ssl

        port: 443

        protocol: TCP

        targetPort: 8443

      - name: kong-admin

        port: 8001

        protocol: TCP

        targetPort: 8001

      - name: kong-admin-ssl

        port: 8444

        protocol: TCP

        targetPort: 8444

      selector:

        app: ingress-kong

      type: NodePort

```

ENV:

![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/f/f745134cb91d81a3a0cd2744982801445c4533e6.png)

No matter which client I access from, in the end my client IP is the IP of the ingress, not the real IP. The picture is my visit from my local machine, but the ip is not 127.0.0.1

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/d/d178ac7dee2b90bc1278f6510ed8e7692d219dbd.jpeg)  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/0/0cf94d912e45594a8be1f40a4457d9462ad78ae7.png)

How do I get the real ip

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [September 11, 2020, 11:47pm UTC](https://discuss.konghq.com/t/kong-in-kubernetes-client-ip-is-ingress-ip/7101/2 "2020-09-11T23:47:15Z")

</div>

Here is a guide that should help you out:

> <https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/guides/preserve-client-ip.md>

---

<div class="post-metadata">

**Author:** ![ggstrong](https://avatars.discourse-cdn.com/v4/letter/g/3ec8ea/32.png) [@ggstrong](https://discuss.konghq.com/u/ggstrong)\
**Post date:** [September 12, 2020, 3:50am UTC](https://discuss.konghq.com/t/kong-in-kubernetes-client-ip-is-ingress-ip/7101/3 "2020-09-12T03:50:56Z")

</div>

Thank you very much, but my cluster is local, the NodePort type used by kong-proxy, env I also have configured KONG\_TRUSTED\_IPS, KONG\_PROXY\_LISTEN, KONG\_REAL\_IP\_HEADER, but that has no effect, it is worth noting that I have tried to use nginx outside the cluster to forward the request Give kong, and configure these in nginx in this way, so that I can get the real IP, the following is the nginx configuration

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/6/65857318f80f87153bf78855edc39f4c9c1ecada.png)  
I am using docker desktop for windows to build a kubernetes cluster, does it have anything to do with this
