<p>I create one pod with <code>label:appenv</code> and one service of type node port with a selector as <code>appenv</code>. But when I use <code>kubectl get ep service-name</code> it's showing "no endpoints"(means service is not connecting with that pod).
<br>Here  are my <code>pod.yaml</code> and <code>service.yaml</code><br>
<br><code>pod.yaml</code></p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: pod1
  labels:
    app: appenv
spec:
  containers:
  - name: app
    image: aathith/lbt:v1
    ports:
    - name: app-port
      containerPort: 8082
  restartPolicy: Never
</code></pre>

<p><br><code>service.yaml</code></p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: app
spec:
  selector:
    app: appenv
  type: NodePort
  ports:
  - name: http
    port: 8082
    targetPort: 8082
    nodePort: 30082
    protocol: TCP
</code></pre>

<p>output for <code>kubectl get po --show-labels</code>
<a href="https://i.stack.imgur.com/Hk04j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hk04j.png" alt="enter image description here"></a></p>

<p>output for <code>kubectl get svc</code><a href="https://i.stack.imgur.com/i6EKR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i6EKR.png" alt="enter image description here"></a></p>

<p>output for <code>kubectl get svc app</code></p>

<p><a href="https://i.stack.imgur.com/edQDL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/edQDL.png" alt="enter image description here"></a></p>

<ol>
<li>Why am I not able to connect my pod to this service? </li>
<li>How can I change the above files to connect with each other?</li>
</ol>

AATHITH RAJENDRAN
<p>Your pod is in "Completed" state - that is the problem. It is not in state "Running". Why? Because command in container was finished with 0 exit code. In normal situation container's running command should not exit unless it's a Job or Cronjob. You see what I mean?</p>
