Preserve ip address k8s

From UVOO Tech Wiki
Jump to navigation Jump to search

https://stackoverflow.com/questions/57170956/bare-metal-k8s-how-to-preserve-source-ip-of-client-and-direct-traffic-to-nginx

https://kubernetes.io/docs/concepts/services-networking/service/

If a Service's .spec.externalTrafficPolicy is set to Cluster, the client's IP address is not propagated to the end Pods.

By setting .spec.externalTrafficPolicy to Local, the client IP addresses is propagated to the end Pods, but this could result in uneven distribution of traffic. Nodes without any Pods for a particular LoadBalancer Service will fail the NLB Target Group's health check on the auto-assigned .spec.healthCheckNodePort and not receive any traffic.