<p>I want to access nginx on pod using localhost:8080 as uri, not minikube ip  </p>

<pre><code>  apiVersion: v1
    kind: Service
    metadata:
      name: nginx-service
    spec:
      selector:
        app: webserver
      ports:
        - port: 80
          targetPort: 80
</code></pre>

<p><a href="https://i.stack.imgur.com/7nl7O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7nl7O.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/uXHmw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uXHmw.png" alt="enter image description here"></a></p>

Igor Smirnov
<p>I guess this is for development/debug purpose.<br>
So if you can't use port-forward option as @arghya-sadhu suggested, then you'll just have to map your domain to your ip.</p>

<p>I can see that's what you're trying to do in your nginx deployment with those lines :</p>

<pre><code>spec:
  hostAliases:
  - ip: 192.168.99.101
    hostnames:
    - localhost
</code></pre>

<p>However, this will not affect your host. In order to map localhost to the minikube ip, you'll have to edit your <code>/etc/hosts</code> file. Below is the line you need to add :  </p>

<pre><code>192.168.99.101    localhost
#127.0.0.1    localhost &lt;-- this line needs to be commented
</code></pre>

<p>Be sure to comment the existing line with localhost</p>
