Kubernetes NodePort Service
Kubernetes NodePort Service is an service which is used for to expose the nodes which are available in the cluster to the outside of the cluster. It will also expose the applications which are running in the node it also allows the traffic from the outside to reach the application with the help of NodePort.
Example Of NodePort Service
Following is the sample YAML file for the kubernetes NodePort Service.
apiVersion: v1
kind: Service
metadata:
name: <Name Of the Service>
spec:
type: NodePort
ports:
- port: 80 # Port exposed within the cluster
targetPort: 8080 # Port on the pods
nodePort: 30000 # Port accessible externally on each node
selector:
app: example-app # Select pods with this label
Kubernetes – NodePort Service
NodePort service in Kubernetes is a service that is used to expose the application to the internet from where the end-users can access it. If you create a NodePort Service Kubernetes will assign the port within the range of (30000-32767). The application can be accessed by end-users using the node’s IP address.