January 2019
Intermediate to advanced
484 pages
11h 48m
English
If the Service is set as NodePort, Kubernetes will allocate a port within a certain range on each node. Any traffic going to the nodes on that port will be routed to the Service port. The port number may be user-specified. If not, Kubernetes will randomly choose a port between 30,000 and 32,767 that doesn't cause any collision. On the other hand, if it's specified, the user should be responsible for managing the collision by themselves. NodePort includes a ClusterIP feature. Kubernetes assigns an internal IP to the Service.
In the following example, we'll see how we can create a NodePort Service and use it:
// write a nodeport type service# cat 3-2-3_nodeport.yamlkind: ServiceapiVersion: v1metadata: name: nginx-nodeportspec: type: ...
Read now
Unlock full access