<p>The issue of ClusterIP, pod IP, nodePort, and targetPort are still a little confusing to me.</p>
<p>I want to set up a small test case to better evaluate use cases, but I am having a bit of trouble. At the moment, I am working with kubernetes for docker on mac.</p>
<p>What I'd like:</p>
<ul>
<li>A pod with an application on it that listens on a port (say, 8080).</li>
<li>Pod is running on the docker-desktop node that comes with Kubernetes on Docker</li>
<li>A way to send requests from my local machine to the docker-desktop node that the pod can receive on its 8080 port, and a way to get back information the pod provides in response to the request</li>
</ul>
<p>I am pretty sure I need something like a Service to act as the middleware between the pod and me, but I am not sure how to set something like this up.</p>
<p>Something like the kubernetes-dashboard api, where I can access the pod with:</p>
<pre><code>http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/pod?namespace=default
</code></pre>
<p>Here, know <code>kubernetes-dashboard</code> is replaced by the namespace for my pods, and <code>https</code> is replaced with whatever port name I have configured in a Service, but I am not sure about the rest.</p>

asuprem
<p>You should define a Service with <code>NodePort</code> type to access the service from the host machine.</p>
<p>Follow the reference --&gt; <a href="https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/</a></p>
