<p>Dear all I have deployed a sample service such as this:</p>

<pre><code> kubectl get svc
NAME          TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes    ClusterIP   10.233.0.1     &lt;none&gt;        443/TCP          1d
mynodejsapp   NodePort    10.233.2.225   &lt;none&gt;        3000:31209/TCP   43s
</code></pre>

<p>may I ask how do I access the app mynodejsapp on the cluster ip?</p>

<p>When I did a get nodes -o wide this is what I have seen as below,</p>

<pre><code>$ kubectl get nodes -o wide
NAME                    STATUS    ROLES     AGE       VERSION            EXTERNAL-IP   OS-IMAGE                  KERNEL-VERSION                   CONTAINER-RUNTIME
controlplane-node-001   Ready     master    2d        v1.9.1+2.1.8.el7   &lt;none&gt;        Oracle Linux Server 7.2   4.1.12-112.14.13.el7uek.x86_64   docker://17.3.1
controlplane-node-002   Ready     master    2d        v1.9.1+2.1.8.el7   &lt;none&gt;        Oracle Linux Server 7.2   4.1.12-112.14.13.el7uek.x86_64   docker://17.3.1
controlplane-node-003   Ready     master    2d        v1.9.1+2.1.8.el7   &lt;none&gt;        Oracle Linux Server 7.2   4.1.12-112.14.13.el7uek.x86_64   docker://17.3.1
default-node-001        Ready     node      2d        v1.9.1+2.1.8.el7   &lt;none&gt;        Oracle Linux Server 7.2   4.1.12-112.14.13.el7uek.x86_64   docker://17.3.1
default-node-002        Ready     node      2d        v1.9.1+2.1.8.el7   &lt;none&gt;        Oracle Linux Server 7.2   4.1.12-112.14.13.el7uek.x86_64   docker://17.3.1
</code></pre>

<p>Any help. Thanks.</p>

Adam
<blockquote>
  <p>may i ask how do I access the app mynodejsapp on the cluster ip?</p>
</blockquote>

<p>Now, for direct answer to your question in regards to your service overview:</p>

<ul>
<li>To access <code>mynodejsapp</code> service from <strong>outside</strong> of the cluster you need to target IP of any of the <code>nodes</code> on port <code>31209</code> (and <code>kube-proxy</code> will route it to <code>mynodejsapp</code> service for you) </li>
<li>To access <code>mynodejsapp</code> service from <strong>within</strong> the cluster, meaning from another pod running on that same cluster you need to target clusterIP <code>10.233.2.225:3000</code> (or alternatively with running <code>kube-dns</code> you can use service name directly <code>mynodejsapp:3000</code>) </li>
</ul>

<p>As detailed in <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/" rel="nofollow noreferrer">the official documentation</a> clusterIP is tied to service, and in turn it is resolved through kube-dns from service name to clusterIP. In a nutshell you can use clusterIP only from within pods running on said cluster (same as service).</p>

<p>As for exposing services externally through NodePort you can find more info also in <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/" rel="nofollow noreferrer">the official documentation</a></p>
