1 Answers
Great question. I think the reason you use cluster IP is because that IP address is virtual, but then you can fix the port number, say 8080, or 80, or 443, so protocols like http or https work without specifying a port or having to change the port because, unless you specify it, the Node Port is assigned by Kubernetes. If you specify the Node Port (which must be in the range 30000-32767), then yes, a cluster IP:8080 and nodeIP:30001 is pretty much the same, but if you don’t specify the node port in your manifest, a port number from the range is selected for you but you don’t care what the node port is since you will use the clusterIP:8080.
One important thing is missing here. The clusterIP is just kubernetes internal which means other pods can access the service internally with well known port. If you use node port, the port is exposed on each node. So you can access the service from outside kubernetes on each node with assigned port.