Hello @sns
When you declare a service as NodePort exposes the Service on each Node’s IP at the NodePort (a fixed port for that Service, in the default range of 30000-32767). You can then access the Service from outside the cluster by requesting **<NodeIp>:<NodePort>.
**
For example you have the following service definition:
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app.kubernetes.io/name: MyApp
ports:
# By default and for convenience, the
- port: 80
targetPort: 80
# Optional field
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
nodePort:30007
---
This Service is visible as <NodeIP>:spec.ports[*].nodePort
You can find more information in the official k8s doc: [https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
Hope this helps.
Please "Accept as Answer" if it helped and Upvote, so that it can help others in the community looking for help on similar topics.
Thank you!