NodePort resource - is it one ip for all nodeports in the cluster and only the port changes?

Viewed 17

How does a NodePort get it's IP address? and if I create 100 nodePorts in my cluster, do I have 100 different ips or it's the same ip address and only the ports change ? who decide about the ip the nodePort is given ?

1 Answers

According to docs:

Kubernetes control plane allocates a port from a range specified by --service-node-port-range flag (default: 30000-32767). Each node proxies that port (the same port number on every Node) into your Service.

So in short, k8s will open port on each node and connections to this port are then forwarded to the service’s cluster IP. So 100 nodeports will have 100 different ClusterIPs and ports.

Related