# Can I use NodePort-type service to access local pod?

**URL:** <https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030>\
**Category:** General Discussions\
**Tags:** network\
**Created:** [April 2, 2025, 2:36am UTC](https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030 "2025-04-02T02:36:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lengcangche-gituhub](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/lengcangche-gituhub/32/16809_2.png) [@lengcangche-gituhub](https://discuss.kubernetes.io/u/lengcangche-gituhub)\
**Post date:** [April 2, 2025, 2:36am UTC](https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030/1 "2025-04-02T02:36:58Z")

</div>

If 2 pods of a NodePort-type service are scheduled on node A and node B, when an external client accesses the service using node A’s IP and the service’s port number, will the KubeProxy forward  
the client’s request to the pod on node B? Or will the KubeProxy always forward the client’s request to the pod node A?

---

<div class="post-metadata">

**Author:** ![PerformantData](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/performantdata/32/15662_2.png) [@PerformantData](https://discuss.kubernetes.io/u/PerformantData)\
**Post date:** [April 2, 2025, 6:24pm UTC](https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030/2 "2025-04-02T18:24:27Z")

</div>

Does [Service | Kubernetes](https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport) not explain it enough?

---

<div class="post-metadata">

**Author:** ![lengcangche-gituhub](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/lengcangche-gituhub/32/16809_2.png) [@lengcangche-gituhub](https://discuss.kubernetes.io/u/lengcangche-gituhub)\
**Post date:** [April 3, 2025, 12:23am UTC](https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030/3 "2025-04-03T00:23:11Z")

</div>

According to the documentation, the request will be forwarded by the KubeProxy by some load balancing srategy, right?

---

<div class="post-metadata">

**Author:** ![PerformantData](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/performantdata/32/15662_2.png) [@PerformantData](https://discuss.kubernetes.io/u/PerformantData)\
**Post date:** [April 3, 2025, 3:58am UTC](https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030/4 "2025-04-03T03:58:00Z")

</div>

> the request will be forwarded by the KubeProxy by some load balancing srategy

`kube-proxy` typically sets up kernel-level rules to do that, rather than playing any active role in redirecting the traffic itself. It’s just faster that way.

> Each node proxies that port […] For a node port Service, Kubernetes additionally allocates a port […] Every node in the cluster configures itself to listen on that assigned port and to forward traffic to one of the ready endpoints associated with that Service.

I think that’s all referring to the effect, not the actual implementation. Because the latter depends on the [proxy mode](https://kubernetes.io/docs/reference/networking/virtual-ips/#proxy-modes) that you choose.

To answer the original question, you might be thinking of [traffic policies](https://kubernetes.io/docs/reference/networking/virtual-ips/#traffic-policies).

---

<div class="post-metadata">

**Author:** ![lengcangche-gituhub](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/lengcangche-gituhub/32/16809_2.png) [@lengcangche-gituhub](https://discuss.kubernetes.io/u/lengcangche-gituhub)\
**Post date:** [April 3, 2025, 8:54am UTC](https://discuss.kubernetes.io/t/can-i-use-nodeport-type-service-to-access-local-pod/32030/5 "2025-04-03T08:54:51Z")

</div>

Thank you for you hint
