Kong in kubernetes client ip is ingress ip

    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

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

How do I get the real ip

Here is a guide that should help you out:

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


I am using docker desktop for windows to build a kubernetes cluster, does it have anything to do with this


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ