Do Kubernetes pods use the ports of the host system under the hood?

Hi. The question might be silly, but I’m curious about it.

When I open a connection from pod to a pod on another node, does the host node get a port opened under the hood? Is there a difference if the two pods are hosted by the same node? Or does it depend on the actual implementation of k8s network model?

If I got it correctly, Services, Load Balancing, and Networking | Kubernetes implies that the network ports are not shared between different pods unless host ports are used.

Your last statement is correct: “network ports are not shared between different pods unless host ports are used”

That makes sense. Are there any articles on how it’s achieved under the hood? From my limited understanding of Linux, Linux has something which allows one to have multiple isolated networks, each with its own set of ports using network_namespaces(7) - Linux manual page. Is this something relevant?

You got it. That’s how.