Service association for pods without ports

In the docs on requirements for Pods and Services, it says:

Service association : A pod must belong to at least one Kubernetes service even if the pod does NOT expose any port.

I have Deployments that don’t expose any ports (kafka consumers, resque workers, shell pods, etc.). What sort of Service should I create? Does it matter if it’s ClusterIP, or should I create a headless service? (.spec.clusterIP = None)

If I create a Service that doesn’t have anything for spec.ports, I get an error from the Kubernetes API. Do I just choose some arbitrary port for the service, even if the pod doesn’t expose that port? Does it matter what name/protocol I give it?

Also, what’s the reasoning for this? It seems like a really awkward requirement that doesn’t fit with the abstractions of Kubernetes.

I think this is related to this issue: https://github.com/istio/istio/issues/7787 - basically some stuff won’t work without a k8s service, you can see more in the issue comments.
Personally I did have this issue too and setting some random http port worked for me, although I agree it’s a bit awkward.

https://discuss.istio.io/t/question-istio-requirements-pod-must-belong-to-at-least-one-service/ I’ve also had this question