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 name
s 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
? :)
port
is what a LB has to expose, or is there value to be added by my question and answers to it? – Rob Starlingport
. We could do that there or here, but i think it's an unanswered sub-question. (That is, i don't care about the rep, I just want the answer and I think others might, too :) ) – Rob Starlingbackend:
section will refer to Services. The port there maybe a number but can be a string as well - which will be the port name listed in the Service. Fourth, the name is also interesting for collecting metrics with Prometheus, for example. – Janos Lenart