<p>In Kubernetes, one communicates with a specific service <code>X</code> by doing http requests to <code>http://X:9999</code>. <code>X</code> here is the application name. I wonder, can one add multiple names, or alias, to which it will point to <code>http://X:9999</code>? I.e can I forward/point <code>http://Y:9999</code> to <code>http://X:9999</code>?</p>

<h2>Answer</h2>
<p>Yes you can have multiple hostnames point to the same Pod(s).</p>
<p>You can achieve this by creating multiple Services with the same label selectors.</p>
<h2>Background</h2>
<p>A service creates endpoints to Pod IPs based on label selectors.</p>
<p>Services will match their selectors against Pod labels.</p>
<p>If multiple Services (with different names) have the same label selectors, they will create multiple endpoints to the same Pods.</p>
<h2>Example</h2>
<p>First service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx1
  namespace: nginx
spec:
  selector:
    app: nginx
...
</code></pre>
<p>Second service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: nginx2
  namespace: nginx
spec:
  selector:
    app: nginx
...
</code></pre>
<p>Each Service will create an endpoint pointing to any Pods with the label <code>app: nginx</code>.</p>
<p>So you could hit the same Pods using <code>nginx2:&lt;port&gt;</code> and <code>nginx1:&lt;port&gt;</code>.</p>
