The NodePort service
Now that we are aware of the theory behind the concept of services in Kubernetes, we will start by discovering the first type, which is NodePort
.
NodePort
is a Kubernetes service type designed to make Pods reachable from a port available on the host machine, the worker node. In this section, we're going to discover this type of port and be fully focused on NodePort
services!
Why do you need NodePort services?
We're now going to discover exactly where the NodePort
services sit and what they do in your Kubernetes cluster.
The first thing to understand is that NodePort
services allow us to access a Pod running on a worker node, on a port of the worker node itself. After you expose Pods using the worker node, you'll be able to reach the Pods if you know the IP address of your worker node and the port of the NodePort
service in this format:
<WORKER_NODE_IP_ADDRESS>:<PORT_DECLARED_IN_NODE_PORT_SVC>.
Let's illustrate...