<p>My cluster has its own domain name <code>k8s.my-domain.com</code>.</p>
<p>Originally when I deploy Dgraph, I met issue that their pods cannot talk to each other by <code>dgraph-service.dgraph-namespace.svc.cluster.local</code>.</p>
<p>If they talk to each other by</p>
<ul>
<li><code>dgraph-service.dgraph-namespace</code></li>
<li><code>dgraph-service.dgraph-namespace.svc.k8s.my-domain.com</code></li>
</ul>
<p>it will work.</p>
<p>I fixed by removing <code>.svc.cluster.local</code> part from Dgraph yaml and created the pull request at <a href="https://github.com/dgraph-io/dgraph/pull/7976" rel="nofollow noreferrer">https://github.com/dgraph-io/dgraph/pull/7976</a>.</p>
<p>Today, when I deploy Yugabyte, I met the same issue again. I created a ticket at <a href="https://github.com/yugabyte/yugabyte-operator/issues/38" rel="nofollow noreferrer">https://github.com/yugabyte/yugabyte-operator/issues/38</a> and hopefully Yugabyte team can fix it.</p>
<p>However, I am not sure if this approach is good now. I hope I can do something on my side.</p>
<p>Is there a way to redirect from <code>.svc.cluster.local</code> to <code>.svc.k8s.my-domain.com</code>?<br />
Maybe in CoreDNS so that I don't need to change original Dgraph or Yugabyte YAML file? Thanks!</p>
<hr />
<p><strong>UPDATE 1:</strong></p>
<p>Based on @CodeWizard suggestion, and because I got a warning from my IDE:</p>
<p><a href="https://i.stack.imgur.com/KQz7a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KQz7a.png" alt="enter image description here" /></a></p>
<p>So I tried both versions:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: external-service
spec:
  type: ExternalName
  externalName: k8s.my-domain.com
</code></pre>
<p>and</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: external-service
spec:
  type: ExternalName
  externalName: cluster.local
</code></pre>
<p>After applying this yaml file.</p>
<p>However, I still got same error deploying Yugabyte to my cluster.</p>

Hongbo Miao
<p>You can use <code>ExternalName</code> in your service.</p>
<pre><code>kind: &quot;Service&quot;
apiVersion: &quot;v1&quot;
metadata:
  name: &quot;external-mysql-service&quot;
spec:
  type: ExternalName
  externalName: example.domain.name
selector: {} # The selector field to leave blank.
</code></pre>
<h3>Using an External Domain Name</h3>
<ul>
<li><p>Using external domain names makes it easier to manage an external service because you do not have to worry about the external service’s IP addresses changing.</p>
</li>
<li><p>You can use an ExternalName service to direct traffic to an external service.</p>
</li>
<li><p>Using an external domain name service tells the system that the DNS name in the <code>externalName</code> field (example.domain.name in the previous example) is the location of the resource that backs the service.</p>
</li>
<li><p>When a DNS request is made against the Kubernetes DNS server, it returns the <code>externalName</code> in a CNAME record telling the client to look up the returned name to get the IP address.</p>
</li>
</ul>
