Search code examples
kuberneteskube-dns

Service discovery on Kubernetes


I have kubeDNS set up on a bare metal kubernetes cluster. I thought that would allow me to access services as described here (http:// for those who don't want to follow the link), but when I run

curl https://monitoring-influxdb:8083

I get the error

curl: (6) Could not resolve host: monitoring-influxdb

This is true when I run curl on a service name in any namespace. Is this an error with my kubDNS setup or are there different steps I need to take in order to achieve this? I get the expected output when I run the test at the end of this article.

For reference:

kubeDNS controller yaml files

kubeDNS service yaml file

kubelet flags

output of kubectl get svc in default and kube-system namespaces


Solution

  • As @Michael Hausenblas pointed out in the comments, curl http://monitoring-influxdb:8086 needs to be run from within a pod. Doing that provided the expected results