<p>I have two Ubuntu VMs created using Oracle Virtual Box on my Windows 11 laptop. I setup a k8s cluster using kubeadm with these two Ubuntu VMs, one of them is a master node and an another one is a worker node. Both the nodes are running with Ubuntu 20.04.3 LTS and docker://20.10.7. I deployed my spring boot app into the k8s cluster and exposed a node port service for my spring boot app with port 30000, but I am not really sure on how to access my node port service on the internet outside my cluster. Could you please help me with this issue?</p>
<p><a href="https://i.stack.imgur.com/YezZg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YezZg.png" alt="kubectl get nodes -o wide" /></a>
<a href="https://i.stack.imgur.com/Pg6mG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pg6mG.png" alt="kubectl get svc -o wide" /></a></p>
<p>Following are the IP address of my nodes in k8s cluster - master [192.168.254.94] and worker [192.168.254.95]. I tried with the following urls but none of them worked</p>
<p><a href="http://192.168.254.94:30000/swagger-ui.html" rel="nofollow noreferrer">http://192.168.254.94:30000/swagger-ui.html</a>
<a href="http://192.168.254.95:30000/swagger-ui.html" rel="nofollow noreferrer">http://192.168.254.95:30000/swagger-ui.html</a></p>
<p>These above urls throwing message which says refused to connect</p>
<p><a href="http://192.168.9.13:30000/swagger-ui.html" rel="nofollow noreferrer">http://192.168.9.13:30000/swagger-ui.html</a>
<a href="http://192.168.9.14:30000/swagger-ui.html" rel="nofollow noreferrer">http://192.168.9.14:30000/swagger-ui.html</a></p>
<p>These above urls says that the site cannot be reached</p>
<p>Below is the content of my application.yaml which I used for deploying the spring boot app and its corresponding service</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
   name: dealer-engine
spec:
   replicas: 1
   selector:
      matchLabels:
         app: dealer-engine
   template:
      metadata:
        labels:
           app: dealer-engine
      spec:
         containers:
            - name: dealer-engine
              image: moviepopcorn/dealer_engine:0.0.1
              ports:
                 - containerPort: 9090
              env:
                 - name: MONGO_URL
                   value: mongodb://mongo-service:27017/mazda
              imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
   name: dealer-engine
spec:
   type: NodePort
   selector:
      app: dealer-engine
   ports:
      - port: 9091
        targetPort: 9090
        nodePort: 30000
   externalIPs:
    - 10.0.0.12
</code></pre>
<p>I am a beginner in k8s so please help me on how I can access my node port service outside my k8s cluster.</p>

Srinivasan Ramu
<p>I created a new simple Springboot application which returns &quot;Hello world!!!&quot; back to the user when the following endpoint &quot;/helloWorld&quot; is invoked. I deployed this spring boot app into my k8s cluster using the below yaml configuration</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
   name: hello-world
spec:
   replicas: 1
   selector:
      matchLabels:
         app: hello-world
   template:
      metadata:
        labels:
           app: hello-world
      spec:
         containers:
            - name: hello-world
              image: moviepopcorn/hello_world:0.0.1
              ports:
                 - containerPort: 9091
              imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
   name: hello-world
spec:
   type: NodePort
   selector:
      app: hello-world
   ports:
      - port: 9091
        targetPort: 9091
        nodePort: 30001
</code></pre>
<p>After successful deployment, I am able to access the helloWorld endpoint using the following url &lt;K8S_MASTER_NODE_IP&gt;:&lt;NODE_PORT (30001)&gt;.</p>
<p>Thank you all for your answers and inputs. Very much appreciated.</p>
