# How traffic is routed to POD by node port

**URL:** <https://discuss.kubernetes.io/t/how-traffic-is-routed-to-pod-by-node-port/12890>\
**Category:** General Discussions\
**Created:** [September 21, 2020, 4:25am UTC](https://discuss.kubernetes.io/t/how-traffic-is-routed-to-pod-by-node-port/12890 "2020-09-21T04:25:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsingh](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dsingh](https://discuss.kubernetes.io/u/dsingh)\
**Post date:** [September 21, 2020, 4:25am UTC](https://discuss.kubernetes.io/t/how-traffic-is-routed-to-pod-by-node-port/12890/1 "2020-09-21T04:25:54Z")

</div>

-1

I have following question related to traffic routing to POD when i use node port to send traffic to POD.

1. I send traffic to a node-ip:node-port and no POD is running on that node
2. I send traffic to a node-ip:node-port and one POD running on that node. will that POD receive the traffic always ?
3. I send traffic to a node-ip:node-port and more than one POD running on that node. how the traffic distributed between the PODs running on the same node ?

What rules kubernetes follow to route the traffic to POD in the above scenarios ?

---

<div class="post-metadata">

**Author:** ![thockin](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/thockin/32/2457_2.png) [@thockin](https://discuss.kubernetes.io/u/thockin)\
**Post date:** [September 21, 2020, 4:02pm UTC](https://discuss.kubernetes.io/t/how-traffic-is-routed-to-pod-by-node-port/12890/2 "2020-09-21T16:02:35Z")

</div>

> I have following question related to traffic routing to POD when i use node port to send traffic to POD.
> 
> 1. I send traffic to a node-ip:node-port and no POD is running on that node

If the service DOES NOT specify `externalTrafficPolicy: Local`, then something (iptables, ebpf) on the node will pick a pod on a different node.  
If the service DOES specify `externalTrafficPolicy: Local`, then traffic will be dropped

> 1. I send traffic to a node-ip:node-port and one POD running on that node. will that POD receive the traffic always ?

If the service DOES NOT specify `externalTrafficPolicy: Local`, then something (iptables, ebpf) on the node will pick a pod, maybe on this node, maybe not.  
If the service DOES specify `externalTrafficPolicy: Local`, then traffic will always be routed to a pod on this node

> 1. I send traffic to a node-ip:node-port and more than one POD running on that node. how the traffic distributed between the PODs running on the same node ?

If the service DOES NOT specify `externalTrafficPolicy: Local`, then something (iptables, ebpf) on the node will pick a pod, maybe on this node, maybe not.  
If the service DOES specify `externalTrafficPolicy: Local`, then traffic will always be routed to a pod on this node, randomly

When picking a pod from a set of eligible pods, the algorithm is random (equal-probability).
