<p>I am an absolute beginner to Kubernetes, and I was following this <a href="https://www.youtube.com/watch?v=s_o8dwzRlu4" rel="noreferrer">tutorial</a> to get started. I have managed writing the yaml files. However once I deploy it, I am not able to access the web app.</p>
<p>This is my webapp yaml file</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
 name: webapp-deployment
 labels:
  app: webapp
spec:
 replicas: 1
 selector:
  matchLabels:
   app: webapp
 template:
  metadata:
   labels:
    app: webapp
spec:
  containers:
  - name: webapp
    image: nanajanashia/k8s-demo-app:v1.0
    ports:
    - containerPort: 3000
    env:
    - name: USER_NAME
      valueFrom:
        secretKeyRef:
          name: mongo-secret
          key: mongo-user
    - name: USER_PWD
      valueFrom:
        secretKeyRef:
          name: mongo-secret
          key: mongo-password
    - name: DB_URL
      valueFrom:
        configMapKeyRef:
          name: mongo-config
          key: mongo-url
</code></pre>
<hr />
<p>apiVersion: v1
kind: Service
metadata:
name: webapp-servicel
spec:
type: NodePort
selector:
app: webapp
ports:
- protocol: TCP
port: 3000
targetPort: 3000
nodePort: 30200</p>
<p>When I run the command : kubectl get node</p>
<p><a href="https://i.stack.imgur.com/erHq3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/erHq3.png" alt="&gt; Blockquote" /></a></p>
<p>When I run the command: kubectl get pods, i can see the pods running
<a href="https://i.stack.imgur.com/bvS8E.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bvS8E.png" alt="enter image description here" /></a></p>
<p>kubectl get svc
<a href="https://i.stack.imgur.com/crTu0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/crTu0.png" alt="enter image description here" /></a></p>
<p>I then checked the logs for webapp, I dont see any errors
<a href="https://i.stack.imgur.com/N0B7H.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N0B7H.png" alt="enter image description here" /></a></p>
<p>I then checked the details logs by running the command: kubectl describe pod podname
<a href="https://i.stack.imgur.com/DQqFJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DQqFJ.png" alt="enter image description here" /></a></p>
<p>I dont see any obvious errors in the result above, but again I am not experienced enough to check if there is any config thats not set properly.</p>
<p>Other things I have done as troubleshooting</p>
<ol>
<li>Ran the following command for the minikube to open up the app : <code>minikube service webapp-servicel</code>, it opens up the web page, but again does not connect to the IP.</li>
<li>Uninstalled minikube, kubectl and all relevant folders, and run everything again.</li>
<li>pinged the ip address directly from command line, and cannot reach.</li>
</ol>
<p>I would appreciate if someone can help me fix this.</p>

<p>Try these 3 options</p>
<ol>
<li><p>can you do the <code>kubectl get node -o wide</code> and get the ip address of node and then open in web browser <code>NODE_IP_ADDRESS:30200</code></p>
</li>
<li><p>Alternative you can run this command <code>minikube service &lt;SERVICE_NAME&gt; --url</code> which will give you direct url to access application and access the url in web browser.</p>
</li>
<li><p><code>kubectl port-forward svc/&lt;SERVICE_NAME&gt; 3000:3000</code>
and access application on <code>localhost:3000</code></p>
</li>
</ol>
