atkayla
atkayla

Reputation: 8849

Preserve client source IP for Kubernetes ingress?

I am using this Ingress it is similar to Nginx: https://cloud.ibm.com/docs/containers?topic=containers-ingress_annotation#general

When I do:

request -> LoadBalancer Service -> client source public IP returned
request -> Ingress -> LoadBalancer Service -> some private IP returned

I would like to preserve the client source public IP. In my Service I am setting ExternalTrafficPolicy: Local, and it works when hitting the LoadBalancer directly, but I do not know what setting I require when going through the Ingress.

Upvotes: 3

Views: 3159

Answers (1)

bhpratt
bhpratt

Reputation: 384

For preserving Ingress source IP, see these steps: https://cloud.ibm.com/docs/containers?topic=containers-comm-ingress-annotations#preserve_source_ip_classic

Essentially you do the same thing that you've described, except that you edit the existing alb service.


steps:

  • kubectl edit svc <ALB_ID> -n kube-system
  • Under spec, change the value of externalTrafficPolicy from Cluster to Local.

Upvotes: 4

Related Questions