I have a StatefulSet Kubernetes deployment with 2 worker nodes. I was able to bring the containers up on those 2 nodes using a headless service hence the nodes have hostname as
The problem is that I am not able to ping abc-0 from abc-1 and in the opposite direction using the hostname. If I use IP addresses then everything works fine.
There were issues related the DNS resolution with Alpine Linux at some point(https://github.com/gliderlabs/docker-alpine/issues/8#issuecomment-172594887) but seems it was fixed in Alpine Linux 3.4.
What would be the good way to verify that the problem I am facing is not because of the Linux but instead some misconfiguration in Kube-DNS or something?
I assume you mean ping abc-0
, did you try ping abc-0.abc
? The resolv.conf is not enriched with all the statefull service entries search domains, just the namespace one, so when you try to access by only abc-0
it actually resolves to abc-0.default.svc.cluster.local
The problem was that the service I was running didn't get endpoints assigned to it. I am using v1.7.3 so resolved the problem by adding 'selector' on the headless service. Also, looks like this is no longer a problem in v1.8.3.