<p>Lets say I have one master(192.168.1.1) and one worker(192.168.1.2) nodes in my cluster. And if I create a service of NodePort 30001, then will it work with master IP(192.168.1.1:30001) or worker IP(192.168.1.2:30001)?</p>

Vinay Sorout
<p>The service type <code>NodePort</code> opens the port on <strong>all</strong> the nodes of the cluster and the pods associated with the <code>NodePort</code> service can be accessible using the <code>IP:port</code> combination where <code>IP</code> represents the nodes' external IP and <code>port</code> represents the port exposed on the node for the <code>NodePort</code> service.</p>
<p>Quoting the <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer">docs</a>:</p>
<blockquote>
<p>If you set the type field to NodePort, the Kubernetes control plane
allocates a port from a range specified by --service-node-port-range
flag (default: 30000-32767). Each node proxies that port (the same
port number on every Node) into your Service. Your Service reports the
allocated port in its .spec.ports[*].nodePort field.</p>
</blockquote>
<blockquote>
<p>Note that this Service is visible as NodeIP:spec.ports[<em>].nodePort
and .spec.clusterIP:spec.ports[</em>].port. (If the --nodeport-addresses
flag in kube-proxy is set, would be filtered NodeIP(s).)</p>
</blockquote>
<p>The <a href="https://hackernoon.com/introducing-nodeport-service-in-kubernetes-ear0360s" rel="nofollow noreferrer">following post</a> gives an example where the application is reachable from the master nodes <code>IP:port</code> combination as well for the <code>NodePort</code> service.</p>
<p>Also, the post at <a href="https://docs.openshift.com/container-platform/3.6/dev_guide/expose_service/expose_internal_ip_nodeport.html#getting-traffic-into-cluster-nodeport" rel="nofollow noreferrer">openshift</a> clearly states that ports are opened for all the nodes:</p>
<blockquote>
<p>Use NodePorts to expose the service nodePort on all nodes in the
cluster.</p>
</blockquote>
