<p>I installed minikube on my mac and created deployment and a service for my nodejs app. I tested that everything is working by getting the URL of my service using the following command:</p>
<pre><code>minikube service my-nodejs-app --url
</code></pre>
<p>and then I run this URL in the browser and got results. The problem is when i tried to access the same URL from another machine inside the same network it didn't worked.</p>
<p>my <code>service.yml</code> file is:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-nodejs-app
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 1337 
    protocol: TCP
    name: app-server
  selector:
    app:  my-nodejs-app  
</code></pre>
<p>I tried to use port forwarding to forward my pod port to my localhost and it works only on the same machine who host the cluster and when I try to access from another machine on the same network (via the IP address of the machine where the cluster deployed) I still get page not found.</p>

<p>You can use <code>"port forward a service"</code>. Assuming:</p>

<ul>
<li>Your local machine IP: <code>166.6.6.6</code> (which hold minikube) </li>
<li>Your minikube IP: <code>192.168.99.100</code> (check the real IP with command <code>$minikube ip</code>) </li>
<li>The nodePort of your service 'my-nodejs-app': <code>31000</code> (check the real
nodePort with command: <code>$kubectl get service</code>)</li>
</ul>

<p>In order to access your service from remote, you can forward a port (like 31000, recommend the same port with nodePort) to your service through the following command in your local machine:</p>

<blockquote>
  <p>ssh -i ~/.minikube/machines/minikube/id_rsa docker@$(minikube ip) -L \*:31000:0.0.0.0:31000</p>
</blockquote>

<p>Then you can access your service through URL: <code>http://166.6.6.6:31000</code>, which will be forwarded to your service URL <code>http://192.168.99.100:31000</code></p>

<p>Thx: <a href="https://github.com/kubernetes/minikube/issues/877" rel="noreferrer">https://github.com/kubernetes/minikube/issues/877</a></p>
