If i spawn a pod with
hostNetwork: true
and then attach to it
kubectl exec -it my-pod-test bash
and spawn something silly like
nc -l < HOST_IP > 5678
and netstat shows me
tcp 0 0 0.0.0.0:34592 0.0.0.0:* LISTEN 94/nc
Why is the random port (in this case) 34592 assigned? Id expect to see port 5678 in use.
Is this a "feature" of Weave, should i go for another networking addon?
More context: I am trying to follow https://www.compoundtheory.com/scaling-dedicated-game-servers-with-kubernetes-part-1-containerising-and-deploying/
You don't say what image your pod is running, but I've had this symptom when using the busybox nc
, as found in images based on alpine for instance.
As you will see in the docs, the syntax to listen on a specific port is:
nc -l -p 5678
Note that hostNetwork: true
bypasses any pod network, so this has nothing to do with Weave Net - your pod is running in the host network, just as if it was a process run directly on the host.