domino player
domino player

Reputation: 21

How kubernetes external ip multi-pod routing works?

I have bare metal Kubernetes cluster with haproxy ingress controller (daemon set) on external ip. Is it possible to restrict kube-proxy to route to local haproxy ingress pod?

To be more specific, I have 2 pods of haproxy ingress controller and use one external ip for them. As per my understanding, kube-proxy will be routing in round-robin to the pods. I didn't find any way to restrict this particular behaviour.

Upvotes: 2

Views: 381

Answers (1)

Dirbaio
Dirbaio

Reputation: 3140

Set externalTrafficPolicy: Local in the NodePort Service.

This will make it so that traffic going to a node X will only go to the pod in node X. If there is no pod in node X the traffic will be dropped (but this should not be an issue since you're using a DaemonSet).

Another benefit is that this preserves the true source IP that haproxy sees. Without externalTrafficPolicy, it is possible that haproxy sees the source IP of another node instead of the original one, since nodes can proxy traffic.

More info here

Upvotes: 4

Related Questions