According to https://kubernetes.io/docs/api-reference/v1.8/#serviceport-v1-core , a ServicePort's port (integer) is "The port that will be exposed by this service.", but given that it doesn't specify the port on which a backend pod will listen (those are targetPort and can even be names to be defined by each backend pod) and it doesn't really specify the port to which a frontend pod should connect (those are nodePort or auto-assigned), I'm confused as to what it does specify.
Are load balancers (ingresses?) required to expose the port as identified in a service, or can they map it as well?
The examples at https://kubernetes.io/docs/concepts/services-networking/service/ don't always include names for the ports even though the spec says that "All ports within a ServiceSpec must have unique names." -- this leads me to assume that a stringified port is also the default name. Is that right?
The docs for ServiceSpec mention that port is the "patch merge key" for its ports array. Are this and the previous observation about port being the default name just forensic evidence that port existed first but we wish we'd started with name? :)
The numeric port of a Service's ServicePort (in its spec) is used in the following places:
spec.clusterIP:spec.ports[*].port (unless clusterIP is set to "None")spec.loadBalancerIP:spec.ports[*].port (if you specify type: LoadBalancer)targetPort of that ServicePort