Que signifie, pour un Service de type NodePort, et ont à la fois le port et targetPort spécifié?

Je suis en train de devenir de plus en plus familiers avec Kubernetes de jour en jour, mais je suis encore à un niveau de base. Je suis également pas un réseau guy.

Je suis à regarder l'extrait suivant d'une définition de Service, et je ne peux faire la photo de droite dans mon esprit de ce qui est déclaré:

spec:
  type: NodePort
  ports:
  - port: 27018
    targetPort: 27017
    protocol: TCP

Référencement de la ServicePort documentation, qui se lit en partie:

nodePort     The port on each node on which this service is exposed when type=NodePort or LoadBalancer. Usually
integer      assigned by the system. If specified, it will be allocated to the service if unused or else creation of the
             service will fail. Default is to auto-allocate a port if the ServiceType of this Service requires one. More info: 
             http://kubernetes.io/docs/user-guide/services#type--nodeport

port         The port that will be exposed by this service.
integer

targetPort   Number or name of the port to access on the pods targeted by the service. Number must be in the range 1
IntOrString  to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the
             target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map).
             This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field.
             More info: http://kubernetes.io/docs/user-guide/services#defining-a-service

Ma compréhension est que le port d'un client à l'extérieur du cluster "voir" sera attribuée dynamiquement un dans la gamme de 30000-32767, tel que défini dans la documentation. Ce sera, à l'aide de la magie noire que je n'ai pas encore comprendre, le débit de la targetPort sur un nœud donné (27017 dans ce cas).

Alors, quelle est la port utilisé pour ici?

InformationsquelleAutor Laird Nelson | 2017-01-31