1 Answers
Hi Mariusz.
I’ve had a quick look, and I think you might have hit on something where I can be a bit more clear. So I’ve made a note to add some clarification to the video/demo.
Here’s how it currently stands with some clarifications…
At 5:24 we show that port 30001
is the NodePort
value. This is in the YAML file at .spec.ports.nodePort
and is the port that the Service can be reached on via every node in the cluster.
At the same point (5:24-ish) we explain that the .spec.ports.port=8080
is the port to forward on to on the back-end. What I’ve not made clear enough is that the port to use on the back-end is actually .spec.ports.targetPort
, but if we don’t specify a value for that, then it defaults to whatever is in .spec.ports.port
. I’ve put this on my list of clarifications to make.
But let me add some quick clarification here using a YAML snippet:
kind: Service
...
spec:
ports:
- port: 8888 << Front-end port for the Service (ClusterIP). Basically the port the Service listens on within the cluster.
targetPort: 8080 << Back-end port to send traffic to Pods on. Defaults to `.spec.ports.port` if not present
nodePort: 30001 << Cluster-wide port that you can hit on any cluster node and reach the Service
Hope that helps. I’ll update the videos some time this week as soon as I get a chance to record.