<p>I tried to send request 192.168.49.2:31083, but it did not work. I'm using Kubernetes with Docker.</p>
<pre class="lang-none prettyprint-override"><code>kubectl expose deployment k8s-web-hello --port=3000 --type=NodePort

kubectl get service
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
k8s-web-hello   NodePort    10.109.32.222   &lt;none&gt;        3000:31083/TCP   9m54s
kubernetes      ClusterIP   10.96.0.1       &lt;none&gt;        443/TCP          7d

minikube ip
192.168.49.2
</code></pre>
<p>How do I fix it?</p>
<p>Edited:</p>
<pre><code>minikube service k8s-web-hello

|-----------|---------------|-------------|---------------------------|
| NAMESPACE |     NAME      | TARGET PORT |            URL            |
|-----------|---------------|-------------|---------------------------|
| default   | k8s-web-hello |    3000     | http://192.168.49.2:31083 |
|-----------|---------------|-------------|---------------------------|
🏃  Starting tunnel for service k8s-web-hello.
|-----------|---------------|-------------|------------------------|
| NAMESPACE |     NAME      | TARGET PORT |          URL           |
|-----------|---------------|-------------|------------------------|
| default   | k8s-web-hello |             | http://127.0.0.1:45767 |
|-----------|---------------|-------------|------------------------|
🎉  Opening service default/k8s-web-hello in default browser...
❗  Because you are using a Docker driver on linux, the terminal needs to be open to run it.
Opening in existing browser session.
</code></pre>
<p>I do not understand why i can not access via first URL with IP address of the Minikube virtual machine but the second URL with local IP can ?</p>

Đoàn Đức Bảo
<p>Refer to this <a href="https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport" rel="nofollow noreferrer">official Doc</a> and as per this you need to use “type: NodePort” in yaml  that specifies a NodePort value and you need to do curl with this nodeport value only.</p>
<p>Below is the sample example :</p>
<blockquote>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: NodePort
  selector:
    app.kubernetes.io/name: MyApp
  ports:
      # By default and for convenience, the `targetPort` is set to the same value as the `port` field.
    - port: 80
      targetPort: 80
      # Optional field
      # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
      nodePort: 30007
</code></pre>
</blockquote>
<p>Note that As you are using minikube IP you need to <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/#:%7E:text=minikube%20tunnel%20runs%20as%20a,on%20the%20host%20operating%20system" rel="nofollow noreferrer">tunnel</a>  into Minikube for access.</p>
<p>Can I know how you are sending the request either by Curl or browsing with HTTP? Can you share your yaml also so that it could be easy to answer.</p>
