<p>I am a k8s beginner.</p>
<p>I have a k8s cluster (<strong>not</strong> minikube) in my test computer. <strong>The cluster was created by Kind.</strong> <em>(...no idea what Kind is. It was recommended by my colleague)</em>.</p>
<p>Then I created:</p>
<ul>
<li>a k8s deployment with a small test http server;</li>
<li>a k8s service (type:NodePort) associated with the deployment.</li>
</ul>
<p>I expected to visit the http server using a web browser on a <strong>different</strong> computer connected with the k8s computer via ethernet.</p>
<p>However, it's not working. The client computer can visit the http server if it is running without k8s (if I manually start it in command line), but if it is running in a k8s pod, the http server is inaccessible.</p>
<p><strong>The <code>kubectl describe nodes</code> command showed that the k8s computer has an &quot;Internal IP&quot; that is different from the &quot;real&quot; IP of that computer:</strong></p>
<pre><code>$ kubectl describe nodes
Name:               kind-control-plane
Roles:              control-plane
...
Addresses:
  InternalIP:  172.17.0.2
  Hostname:    kind-control-plane
Capacity:
...

$ ip addr
1: ...
2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:a5:14:ab brd ff:ff:ff:ff:ff:ff
    inet 10.7.71.173/20 brd 10.7.79.255 scope global eth0
    ...
</code></pre>
<p>In the above output, the 10.7.71.173 is the &quot;real&quot; IP and the 172.17.0.2 is shown as the &quot;Internal IP&quot;.</p>
<p>I can access (curl) the http server by the &quot;Internal IP&quot; but it only works on the k8s computer.</p>
<p>I Googled it for quite a while for an explanation of k8s internal IP but I only got one semi-comprehensible answer: the k8s internal ip is an NAT IP (I understand what NAT is). But I am still not quite sure what k8s internal IP is and why it has to use an internal IP.</p>
<p>More importantly, many internet posts say that the NodePort service allows the app in a pod to be accessed from outside the cluster. It is different from what I experienced.</p>
<p>So my question is:</p>
<ol>
<li>I know that an ingress or a load balancer can expose the app-in-pod to the real external world, but why can't the NodePort service do the same work?</li>
<li>What exactly is the &quot;internal IP&quot;?</li>
</ol>
<p>Any explanations or links to articles/posts are welcomed. Thank you very much.</p>

Zhou
<p>When a kubernetes cluster is created, it will establish an <strong>internal network</strong> within the cluster which <strong>enables the communication</strong> between different types of kubernetes resources like <strong>nodes</strong> , <strong>pods</strong> and <strong>services</strong>. In kubernetes cluster each node will get assigned an <strong>IP address</strong> called ‘<strong>InternalIP</strong>’ address. This address will be used by kubernetes components to communicate with each other.</p>
<p>For example if you create a service , kubernetes assigns a <strong>unique IP address</strong> to the <strong>service</strong>, which is used to access the service from within the cluster. The <strong>InternalIP</strong> address of a node where the service is <strong>running</strong> will be used to <strong>route the traffic</strong> to the service.</p>
<p>You mentioned you are not able to <code>curl</code> the <code>InternalIP</code> of the node, but did you try pinging with the port number which was exposed in the <strong>NodePort</strong> service? </p>
<p>If not, Try with <code>curl http://&lt;Internal IP&gt;:&lt;NodePort&gt;</code></p>
<p>For more detailed information about <strong>InternalIP</strong> and <strong>Nodeport</strong> service refer to this Official Documents <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/" rel="nofollow noreferrer">DOC1</a>, <a href="https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-type-nodeport" rel="nofollow noreferrer">DOC2</a>.</p>
