Headless service endpoints disappear

Cluster information:

Kubernetes version: 1.17.15-gke.800
Cloud being used: GCP
Host OS: Container-optimised OS
CNI and version: Calico 3.8.8
CRI and version: Docker

Running a headless service

apiVersion: v1
kind: Service
metadata:
  name: headless-service
  namespace: mynamespace
spec:
  clusterIP: None
  ports:
    - protocol: TCP
      port: 8001
      targetPort: 8000
---
apiVersion: v1
kind: Endpoints
metadata:
  name: headless-service
  namespace: mynamespace
subsets:
  - addresses:
      - ip: 240.0.0.1
    ports:
      - port: 8001

I notice the endpoint is initially created fine - but approx. once a day is ‘updated’ by the endpoint controller, and the ‘subsets’ are removed, which results in the service becoming inaccessible.

Have been unable to find any information about what could be causing this. Similar issues generally seem to be because of incorrectly including a selector in the service, which is not relevant here. Any information about possible causes, and particularly about how to fix this, would be greatly appreciated. Thanks!

@michael1 Hmm…that sounds like it might be a bug - would you mind opening a bug report in the kubernetes/kubernetes repo?

Please add /sig network in the issue body (it’ll add their label to the issue) and it’ll get it on their radar faster :+1: