<p>I have a simple Service that connects to a port from a container inside a pod.<br />
All pretty straight forward.</p>
<p>This was working too but out of nothing, the endpoint is not created for port 18080.<br />
So I began to investigate and looked at <a href="https://stackoverflow.com/questions/63556471/kubernetes-apply-service-but-endpoints-is-none">this question</a> but nothing that helped there.<br />
The container is up, no errors/events, all green.<br />
I can also call the request with the pods ip:18080 from an internal container, so the endpoint should be reachable for the service.</p>
<p>I can't see errors in:</p>
<pre><code>journalctl -u snap.microk8s.daemon-*
</code></pre>
<p>I am using microk8s v1.20.</p>
<p>Where else can I debug this situation?<br />
I am out of tools.</p>
<p>Service:</p>
<pre><code>kind: Service
apiVersion: v1
metadata:
  name: aedi-service
spec:
  selector:
    app: server
  ports:
    - name: aedi-host-ws #-port
      port: 51056
      protocol: TCP
      targetPort: host-ws-port
    - name: aedi-http
      port: 18080
      protocol: TCP
      targetPort: fcs-http
</code></pre>
<p>Deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-deployment
  labels:
    app: server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: server
  template:
    metadata:
      labels:
        app: server
        srv: os-port-mapping
        name: dns-service
    spec:
      hostname: fcs
      containers:
        - name: fcs
          image: '{{$fcsImage}}'
          imagePullPolicy: {{$pullPolicy}}
          ports:
          - containerPort: 18080
</code></pre>
<p>Service Description:</p>
<pre><code>Name:              aedi-service
Namespace:         fcs-only
Labels:            app.kubernetes.io/managed-by=Helm
Annotations:       meta.helm.sh/release-name: fcs-only
                   meta.helm.sh/release-namespace: fcs-only
Selector:          app=server
Type:              ClusterIP
IP Families:       &lt;none&gt;
IP:                10.152.183.247
IPs:               10.152.183.247
Port:              aedi-host-ws  51056/TCP
TargetPort:        host-ws-port/TCP
Endpoints:         10.1.116.70:51056
Port:              aedi-http  18080/TCP
TargetPort:        fcs-http/TCP
Endpoints:         
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>
<p>Pod Info:</p>
<pre><code>NAME                                 READY   STATUS    RESTARTS   AGE   LABELS
server-deployment-76b5789754-q48xl   6/6     Running   0          23m   app=server,name=dns-service,pod-template-hash=76b5789754,srv=os-port-mapping
</code></pre>
<p>kubectl get svc aedi-service -o wide:</p>
<pre><code>NAME           TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                        AGE   SELECTOR
aedi-service   ClusterIP   10.152.183.247   &lt;none&gt;        443/TCP,1884/TCP,51052/TCP,51051/TCP,51053/TCP,51056/TCP,18080/TCP,51055/TCP   34m   app=server
</code></pre>

madmax
<p>Your service spec refer to a port named &quot;fcs-http&quot; but it was not declared in the deployment. Try:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: server-deployment
...
        ports:
        - containerPort: 18080
          name: fcs-http  # &lt;-- add the name here
...
</code></pre>
