Traeffik and source client ip


#1

Hi, forgive me for my bad english.

I am discovering kubernetes on an on-premise cluster. I’m trying to create an ingress controller using traefik. The documentaiton is pretty well for deploying traefik on kubernetes as ingress controller.

I have a functional traefik that redirects all requests to an app service “hello-world-svc” that uses 3 pods. It works !! Very nice. But the logs in all pods don’t show the source client IP:
::ffff:10.233.73.73 - - [04/Nov/2018:23:02:20 +0000] "GET / HTTP/1.1" 200 659 "-" "curl/7.29.0"

My curl command (another server in the same lan):
curl -v http://kube-node1:32663/

The source client IP should be 192.168.10.7.
After some research, it seems to work using the “externalTrafficPolicy: Local”. If I put this value in the app service, and test it directly, the log is correct:
::ffff:192.168.10.7 - - [04/Nov/2018:23:10:35 +0000] "GET / HTTP/1.1" 200 659 "-" "curl/7.29.0"

But If I add this value to the ingress controller, the client IP is not forwarded at all:
::ffff:10.233.73.73 - - [04/Nov/2018:23:15:07 +0000] "GET / HTTP/1.1" 200 659 "-" "curl/7.29.0"

I don’t know why it works directly on the app service and not if the request is sent to the ingress controller. Any idea ?