<p>I've a Service <code>my-service</code> of type ClusterIP in namespace <code>A</code> which can load balance to a few pods. I want to create another Service of type ExternalName in namespace <code>B</code> that points to <code>my-service</code> in namespace <code>A</code>.</p>

<p>I create the following YAML:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
  namespace: B
spec:
  type: ExternalName
  externalName: my-service.A
</code></pre>

<p>and if I exec into a pod running in namespace <code>B</code> and do:</p>

<pre><code># ping my-service
ping: my-service: Name or service not known
</code></pre>

<p>But if I change the <code>externalName</code> in the above YAML to below:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: my-service
  namespace: B
spec:
  type: ExternalName
  externalName: my-service.A.svc.cluster.local   &lt;--- full FQDN here
</code></pre>

<p>things work as expected. Also, if I ping <code>my-service</code> directly from a pod in namespace <code>B</code> it is being resolved:</p>

<pre><code># ping my-service.A
PING my-service.A.svc.cluster.local (10.0.80.133) 56(84) bytes of data.
</code></pre>

<p>Why <code>my-service.A</code> is not resolved to <code>my-service.A.svc.cluster.local</code>  in ExternalName Service?</p>

<p>My K8s version is <code>1.14.8</code> and uses CoreDNS.</p>

Shubham
<p>Based on <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="nofollow noreferrer">kubernetes documentation</a> and <a href="https://docs.okd.io/latest/dev_guide/integrating_external_services.html" rel="nofollow noreferrer">okd</a> that's how it's supposed to work</p>
<blockquote>
<p>Kubernetes DNS schedules a DNS Pod and Service on the cluster, and configures the kubelets to tell individual containers to use the DNS Service’s IP to resolve DNS names.</p>
<p>What things get DNS names?</p>
<p>Every Service defined in the cluster (including the DNS server itself) is assigned a DNS name. By default, a client Pod’s DNS search list will include the Pod’s <strong>own namespace and the cluster’s default domain</strong>.</p>
</blockquote>
<hr />
<blockquote>
<p>Services are assigned a DNS A or AAAA record, depending on the IP family of the service, for a name of the form <strong>my-svc.my-namespace.svc.cluster-domain.example</strong>. This resolves to the cluster IP of the Service.</p>
</blockquote>
<hr />
<p>There are logs from kubedns when you want to use my-service.A</p>
<pre><code>I0306 09:44:32.424126       1 logs.go:41] skydns: incomplete CNAME chain from &quot;my-service.dis.&quot;: rcode 3 is not equal to success
</code></pre>
<p>That's why you need whole path for the service, which in your situation is</p>
<pre><code>my-service.A.svc.cluster.local
</code></pre>
<p><strong>Because</strong></p>
<blockquote>
<p>Using an external domain name service tells the system that the DNS name in the externalName field (example.domain.name in the previous <a href="https://docs.okd.io/latest/dev_guide/integrating_external_services.html#mysql-define-service-using-fqdn" rel="nofollow noreferrer">example</a>) is the location of the resource that backs the service. When a DNS request is made against the Kubernetes DNS server, it returns the externalName in a CNAME record telling the client to look up the returned name to get the IP address.</p>
</blockquote>
<hr />
<p>I hope this answer your question. Let me know if you have any more questions.</p>
