<p>In Docker a client container can refer to a server container by different names by using link aliasing:</p>

<pre><code>--link server-container:my_preferred_server
</code></pre>

<p>A second client can use its own choice of names</p>

<pre><code>-- link server-container:server
</code></pre>

<p>Can I achieve this in K8s preferably by adding different records in K8s's DNS?</p>

<p><strong>Note</strong> the solution we are using now is having the client containers not use a hardcoded name for the server container, but use the value of an env variable SERVER_HOSTNAME='server-container' and link without aliasing:</p>

<pre><code>--link server_container
</code></pre>

<p><strong>Edit:</strong> To answer to some of the questions got in the replies:<br>
* there is more than one client container, otherwise aliasing would have no purpose. Each client knows the server by a different name<br>
* the client and the server are not in the same pod  </p>

<p>I just had the same need and I was able to add an external Service, which points to the FQDN of the other service within the cluster:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: &quot;my-alias&quot;
spec:
  type: ExternalName
  externalName: &quot;other-service.my-namespace.svc.cluster.local&quot;

</code></pre>
<p>Now, I can access <code>other-service</code> as <code>my-alias</code> from within the cluster and namespace.</p>
