Kubernetes 101 : NodePort, clusterIP and LoadBalancer services
The fixed port makes the node accessible to outside requests.
When we create a nodePort service, a clusterIP service that will receive the request from this nodePort is automatically created by kubernetes.
We can display our nodePort service using the below command:
This schema opens the same port "31500" on all the worker nodes, so the client will have access to all the worker nodes through the nodePort.
The loadBalancer:
To avoid opening ports on all worker nodes for outside requests, we create a loadBalancer service that lives in the cloud (AWS, Azure, ...) and have access to kubernetes nodes only though a specific port defined in its configuration file.
When we create a loadBalancer, kubernetes creates a nodePort and a clusterIP service to receive the loadbalancer's requests.
Below is the Yaml configuration file of the loadBalancer:
Remark:
The nodePort service is a clusterIP service that is accessible from outside of the node.
Comments