Kubernetes service does not have endpoint

12/14/2020

I have a kubernetes service and defined as:

apiVersion: v1
kind: Service
metadata:
  name: my-exporter
  labels:
    type: prometheus-monitorable
spec:
  type: ClusterIP
  selector:
    app: myapp
    project: myproject
  ports:
    - name: prometheus-exporter
      protocol: TCP
      port: 5555
      targetPort: 5555

When I execute kubectl get endpoints I see endpoints is none.

I thought that service label does not match but when I run kubectl get pods --show-labels I can see the pod has label myapp. So what is wrong and my service does not have any endpoint ?

-- user1474111
kubectl
kubernetes
kubernetes-service

0 Answers