Junior — Middle
What is the main function and purpose of the NodePort service in Kubernetes?
sobes.tech AI
Answer from AI
A service like NodePort in Kubernetes is designed to make Pods accessible from outside the cluster through a fixed port on each node.
Main functions of NodePort:
- Open a specific port on all cluster nodes.
- Forward traffic arriving at this port to the corresponding service inside the cluster.
This allows accessing the application running in the cluster using the IP address of any node and the specified NodePort.
For example, if NodePort is set to 30080, requests to http://<NodeIP>:30080 will be forwarded to the service inside the cluster.