NodePort service query

Hello,

if in my clsuter have I 10 nodes and my deployment have 20 pods (e.g. all nginx serving on port 80) those are spread all over nodes. If I create a nodeport service, my application will be accessible on all 10 nodes.

I am not using any external loadbalancer or the k8s load balancer service.

So in this case if I need to give URL to any user, do I need to give for 10 nodes or do I need to create any other k8s object in order to give user only one URL that can serve request to all 10 nodes?

Thanks
Ashish

Hello, @06ashishrawat
I think it’s not a good practice to provide a IP address of your Nodes.

In the case of nodeport service, whatever node port you defined between range of 30000-32767. You can use with the your public ip addr.

hello @Tej-Singh-Rana even if we go with public IP, if we are not using any loadbalancer, do we need to provide 10 public IP and port to end user? Or is there any k8s object we can create with one URL that can redirect request to any of 10 nodes like a loadbalancer?

No, You don’t require. Nodeport service will take care of it.

OK, so we can give public IP of any one node with port to user right?

Yeah, It should be work. Did you face any issues?

no, I didn’t face any issue, I was just curioous to know if we are not using any loadbalancer then what IP we need to give if deployment spreads across the nodes. But now I got it, we can just give public IP of any node and that should work. Thanks a lot again for the claification.