<p>I am running my <strong>minikube as docker image.</strong>
I am trying to expose my service to outside world using Nodeport.</p>
<p>This is my yaml file.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: docker-hello-world
  labels:
    app: docker-hello-world
spec:
  selector:
    matchLabels:
      app: docker-hello-world
  replicas: 3
  template:
    metadata:
      labels:
        app: docker-hello-world
    spec:
      containers:
      - name: docker-hello-world
        image: scottsbaldwin/docker-hello-world:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: docker-hello-world-svc
spec:
  selector:
    app: docker-hello-world
  ports:
    - port: 8088
      targetPort: 80
  type: NodePort
</code></pre>
<p>Searched a lot about <em><strong>nodePort that we require node ip to access the service.</strong></em>
I am able to access my service using <em><strong>minikube service docker-hello-world-svc --url</strong></em>
which gives me url to access the service <em><code>http://127.0.0.1:52526</code></em> but here port number is different then the nodePort.</p>
<p>My service is successful running  .</p>
<pre><code>NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
docker-hello-world-svc   NodePort    10.109.146.181   &lt;none&gt;        8088:30934/TCP   65m
</code></pre>
<p>i want to access my service from outside the cluster using Nodeport but my nodes does not have any external ip</p>
<pre><code>kubectl get nodes -o wide                                                                                                                                             
NAME       STATUS   ROLES           AGE    VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
minikube   Ready    control-plane   5h9m   v1.24.3   192.168.49.2   &lt;none&gt;        Ubuntu 20.04.4 LTS   5.10.104-linuxkit   docker://20.10.17
</code></pre>
<p>already read out that i need ingress controller to access service but i wanna test it using <strong>nodePort</strong> .</p>
<p><strong>Any work around so i can access my service using only <em>nodePort</em> running inside the minikube which is running as docker image</strong>?</p>
<p>Status of minikube does not show kubectl</p>
<pre><code>&gt;&gt;minikube status                                                                                                                                                                             
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
</code></pre>

Amit
<p>You don't need an external IP when using NodePort, you can use <code>minikube ip</code> to get the minikube node address, and then connect to the respective <code>nodePort</code>:</p>
<pre><code>$ kubectl svc
NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
docker-hello-world-svc   NodePort    10.108.66.235   &lt;none&gt;        8088:31550/TCP   2m15s

$ minikube ip
192.168.49.2

$ curl 192.168.49.2:31550
&lt;h1&gt;Hello webhook world from: docker-hello-world-cc79bf486-k4lm8&lt;/h1&gt;

</code></pre>
<hr />
<p>Another alternative is to use a <code>LoadBalancer</code> service, and use <code>minikube tunnel</code> to connect to it using the internal port:</p>
<pre><code>$ kubectl  svc
NAME                     TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)          AGE
docker-hello-world-svc   LoadBalancer   172.16.58.95   172.16.58.95   8088:32624/TCP   10s

$ curl 172.16.58.95:8088
&lt;h1&gt;Hello webhook world from: docker-hello-world-cc79bf486-dg5s9&lt;/h1&gt;
</code></pre>
<p>Notes:</p>
<ul>
<li>You will only get an <code>EXTERNAL-IP</code> after running <code>minikube tunnel</code> in a separate terminal (it's a foreground process)</li>
<li>I recommend that you run Minikube using a less common IP range for the services, preventing conflicts with other network routes:</li>
</ul>
<pre><code>minikube start --service-cluster-ip-range=172.16.0.0/16
</code></pre>
