Kubernetes Node Port Service

4/13/2019

I have a kubernetes cluster on bare metal with NodePort Service and 2 HAProxies balances traffic to these nodes. when I send a request to one of these nodes, it balances traffic to other nodes in cluster. is it possible to change this behavior? I don't want to re-balance traffic.

Update: we can use externalTrafficPolicy: Local

spec:
  selector:
    app: nginx
  type: NodePort
  externalTrafficPolicy: Local
-- Milux
kubernetes

1 Answer

4/13/2019

Nodeport traffic will be intercepted by kube-proxy and then it will redirect the traffic to the node which contains the Pod in a random manner. It's advisable to use Loadbalancer service instead of nodePort. This applies if you are using userspace and iptables modes

You may use IPVS to change the behavior

-- Ansil
Source: StackOverflow