on GKE I created some pods and a headless service. The headless service has a selector and I am expecting the endpoint to get the IP of the Pod that matches the selector.
However the endpoint remains empty
$ kubectl get pods -lservice=front-end
NAME READY STATUS RESTARTS AGE
front-end-1567472915-tei91 1/1 Running 0 12m
$ kubectl get svc -lapp=sockshop
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
front-end None <none> 11m
$ kubectl get endpoints -lapp=sockshop
NAME ENDPOINTS AGE
front-end <none> 11m
$ more svc.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: sockshop
name: front-end
spec:
clusterIP: None
ports: null
selector:
service: front-end
I would expect an endpoint to get the IP of the Pod so that the DNS registration works.
svc.yamlto include a selector that applies directly to the pods. E.g., if your pods have labelsapp: sockshop, you should use that as a selector.