i run kub cluster in my vmware with a master node and 4 workers. everything works fine except my service. i run nginx RS with 4 instance (one per worker) and create a NodePort service. i can access to my nginx on each worker ip but i want to request to my service IP and my service route the traffic to one of my workers (Ex: RoundRobin). but it can't do that. my service info:
service/nginx NodePort 10.99.101.86 <none> 80:30590/TCP 11d
Name: nginx
Namespace: default
Labels: app=nginx
Annotations: <none>
Selector: app=nginx
Type: NodePort
IP: 10.99.101.86
Port: 80-80 80/TCP
TargetPort: 80/TCP
NodePort: 80-80 30590/TCP
Endpoints: 10.40.0.16:80,10.40.0.20:80,10.40.0.21:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
Typically, type: NodePort
may not expose that port allocation outside the cluster network on its own, but using type: LoadBalancer
will allocate that port (in your case, 30590
) and allow traffic through whatever ingress you might have configured (a floating IP for your cluster master, for example, http://:30590) through a single ingress. As for how that node port distributes requests, you can look into the various patterns for externalTrafficPolicy
resources that best meets your desired distribution, however, at present the Cluster
default policy will distribute requests equally, which may be closest to the round-robin behavior you're describing.