<p>I have installed minikube in EC2 Linux Instance.</p>
<pre><code>Minikube IP : 192.168.49.2, 
EC2 Instance IP: 10.X.X.X
</code></pre>
<p>I've deployed an application as NodePort service type where</p>
<pre><code>port: 80
targetPort: 80
nodePort: 32768
and able to access it with curl http://192.168.49.2:32768 within the cluster.
</code></pre>
<p>How should I expose this application to the outside world?<br />
If port forwarding is the option then I tried the below ways:</p>
<pre><code>kubectl port-forward --address &lt;InstanceIP&gt; svc/my-service 8888:80
</code></pre>
<p>This always gives error:</p>
<pre><code>Unable to listen on port 5000: 
Listeners failed to create with the following errors: 
[unable to create listener] error: 
unable to listen on any of the requested ports: [{8888 80}]
</code></pre>
<p>I made sure there is no service running on port 8888.</p>
<pre><code>kubectl port-forward --address &lt;InstanceIP&gt; svc/my-service 8888:32768
</code></pre>
<p>This says, error:</p>
<pre><code>Service my-service does not have a service port 32768.
</code></pre>
<p>Any help is appreciated</p>

Sri Durga
<blockquote>
<p>How should I expose this application to the outside world?</p>
</blockquote>
<p>You should use a <code>Service</code> with a <code>type: LoadBalancer</code></p>
<p><code>LoadBalancer</code> will give you an External Ip that will allow you to connect to it from outside the cluster.</p>
<p>If you only need it for testing and this is why you are using <code>minikube</code> then port forward should cover the requirements.</p>
<h3>Using <code>LoadBalancer</code> with <code>minikube</code></h3>
<p>In order to use <code>LoadBalanacer</code> with minikube you should open a new terminal and execute <code>minikube tunnel</code></p>
<pre><code># Port forward to the desired service, 
# dont forget to add the namespace if any

#
# You should forward to port 80 which is the port defined in your service
#     port : 80
#     targetPort : 80
kubectl port-forward svc/my-service 8888:80 -n &lt;namespace&gt;

# As you mentioned you tried it already and it's not working
# so follow below and try to expose your service with

kubectl expose
</code></pre>
<p>Now you should be able to connect to your service.</p>
<hr />
<p>Here is a full example which generates <code>Service</code></p>
<p><a href="https://github.com/nirgeier/KubernetesLabs/tree/master/Labs/02-Deployments-Imperative" rel="nofollow noreferrer">https://github.com/nirgeier/KubernetesLabs/tree/master/Labs/02-Deployments-Imperative</a></p>
<p>The sample generates the <code>Service</code> on the fly with</p>
<pre><code>kubectl expose deployment -n codewizard multitool --port 80 --type NodePort
</code></pre>
