<p>I have kubeDNS set up on a bare metal kubernetes cluster.  I thought that would allow me to access services as described <a href="https://fabric8.io/guide/services.html#service-discovery-via-dns" rel="nofollow noreferrer">here</a> (http:// for those who don't want to follow the link), but when I run</p>

<pre><code>curl https://monitoring-influxdb:8083
</code></pre>

<p>I get the error </p>

<blockquote>
  <p>curl: (6) Could not resolve host: monitoring-influxdb</p>
</blockquote>

<p>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 <a href="http://jamiehannaford.com/setting-up-dns-discovery-in-kubernetes/" rel="nofollow noreferrer">this article</a>.</p>

<p>For reference:</p>

<p><a href="https://pastebin.com/GJrpvSZw" rel="nofollow noreferrer">kubeDNS controller yaml files</a></p>

<p><a href="https://pastebin.com/YXHsaZW9" rel="nofollow noreferrer">kubeDNS service yaml file</a></p>

<p><a href="https://pastebin.com/vYmMgVF7" rel="nofollow noreferrer">kubelet flags</a></p>

<p><a href="https://pastebin.com/acrFcq4i" rel="nofollow noreferrer">output of kubectl get svc in default and kube-system namespaces</a></p>

<p>The service discovery that you're trying to is documented at <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-serv" rel="noreferrer">https://kubernetes.io/docs/concepts/services-networking/dns-pod-serv</a>‌​ice, and is for communications <em>within</em> one pod talking to an existing service, not from nodes (or the master) to speak to Kubernetes services.</p>

<p>You will want to leverage the DNS for the service in form of <code>&lt;servicename&gt;.&lt;namespace&gt;</code> or <code>&lt;servicename&gt;.&lt;namespace&gt;.svc.cluster.local</code>. To see this in operation, kick up an interactive pod with busybox (or use an existing pod of your own) with something like:</p>

<ul>
<li><code>kubectl run -i --tty alpine-interactive --image=alpine --restart=Never</code></li>
</ul>

<p>and within that shell that is provided there, make an nslookup command. From your example, I'm guessing you're trying to access influxDB from <a href="https://github.com/kubernetes/heapster/tree/master/deploy/kube-config/influxdb" rel="noreferrer">https://github.com/kubernetes/heapster/tree/master/deploy/kube-config/influxdb</a>, then it will be installed into the <code>kube-system</code> namespace, and the service name you'd use from another Pod internally to the cluster would be:</p>

<ul>
<li><code>monitoring-influxdb.kube-system.svc.cluster.local</code></li>
</ul>

<p>For example:</p>

<pre><code>kubectl run -i --tty alpine --image=alpine --restart=Never
If you don't see a command prompt, try pressing enter.
/ # nslookup monitoring-influxdb.kube-system.svc.cluster.local
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      monitoring-influxdb.kube-system.svc.cluster.local
Address 1: 10.102.27.233 monitoring-influxdb.kube-system.svc.cluster.local
</code></pre>
