Hostname problem with statefulset pods

Hi all, i’m having a problem with the hostnames in kuberenres, when i run a statefulset with three replicas, and a headless service, then when i go into one of the pods, let’s say pod-0, then i can do a curl on http://pod-0, but i can’t curl the other pods, except if i use the full hostname like http://pod-1.service.namespace.svc.cluster.local. This is a problem for me, because the prometheus exporter i’m using, is looking at a zookeeper, which has my solr pod hostnames as short names like solr-0, solr-1 and solr-2, so it can’t get the metrics.

It’s kind of the same problem, that is written about here, but i hope someone in here can help me further.

I fixed the issue by using the full hostname, which i first thought wasn’t possible. But i think this is still an issue ?

See DNS for Services and Pods | Kubernetes.

Might work to add something along lines of:

      - service.namespace.svc.cluster.local

As the default search domain will be default.svc.cluster.local which would result in a lookup for pod-1.default.svc.cluster.local.