<p>When I tried to apply a service to pod, endpoint is always none. Could someone know any root cause? I also check if selector match to what is defined in the deployment.yaml. Belows are the deployment, service file that I used. I also attached the service describe.</p>
<p>deployment.yaml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: gethnode
  namespace: mynamespace
  labels:
    app: gethnode
    env: dev1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gethnode
      env: dev1
  template:
    metadata:
      labels:
        app: gethnode
        env: dev1
    spec:
      containers:
      - name: gethnode
        image: myserver.th/bc/gethnode:1.1
        ports:
        - containerPort: 8550
        env:
        - name: TZ
          value: Asis/Bangkok
        tty: true
        stdin: true
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 500m
            memory: 512Mi
      imagePullSecrets:
      - name: regcred-harbor
</code></pre>
<p>service.yaml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: gethnode
  namespace: mynamespace
  labels:
    app: gethnode
    env: dev1
spec:
  type: ClusterIP
  ports:
  - name: tcp
    port: 8550
    targetPort: 8550
    protocol: TCP
  selector:
    app: gethnode
    env: dev1    
</code></pre>
<p>kubectl describe svc</p>
<pre><code>Name:              gethnode
Namespace:         mynamespace
Labels:            app=gethnode
                   env=dev1
Annotations:       kubectl.kubernetes.io/last-applied-configuration:
                     {&quot;apiVersion&quot;:&quot;v1&quot;,&quot;kind&quot;:&quot;Service&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;labels&quot;:{&quot;app&quot;:&quot;gethnode&quot;,&quot;env&quot;:&quot;dev1&quot;},&quot;name&quot;:&quot;gethnode&quot;,&quot;namespace&quot;:&quot;c...
Selector:          app=gethnode,env=dev1
Type:              ClusterIP
IP:                192.97.37.19
Port:              tcp  8550/TCP
TargetPort:        8550/TCP
Endpoints:         &lt;none&gt;
Session Affinity:  None
Events:            &lt;none&gt;

</code></pre>
<p>kubectl get pods -n mynamespace --show-labels</p>
<pre><code>NAME                              READY   STATUS             RESTARTS   AGE    LABELS
console-bctest-6bff897bf4-xmch8   1/1     Running            0          6d3h   app=bctest,env=dev1,pod-template-hash=6bff897bf4
console-dev1-595c47c678-s5mzz     1/1     Running            0          20d    app=console,env=dev1,pod-template-hash=595c47c678
gethnode-7f9b7bbd77-pcbfc         1/1     Running            0          3s     app=gethnode,env=dev1,pod-template-hash=7f9b7bbd77
gotty-dev1-59dcb68f45-4mwds       0/2     ImagePullBackOff   0          20d    app=gotty,env=dev1,pod-template-hash=59dcb68f45
</code></pre>
<p>kubectl get svc gethnode -n mynamespace -o wide</p>
<pre><code>NAME       TYPE        CLUSTER-IP        EXTERNAL-IP   PORT(S)    AGE   SELECTOR
gethnode   ClusterIP   192.107.220.229   &lt;none&gt;        8550/TCP   64m   app=gethnode,env=dev1
</code></pre>

<p>Remove <code>env: dev1</code> from the selector of the service</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: gethnode
  namespace: mynamespace
  labels:
    app: gethnode
    env: dev1
spec:
  type: ClusterIP
  ports:
  - name: tcp
    port: 8550
    targetPort: 8550
    protocol: TCP
  selector:
    app: gethnode
</code></pre>
