<p>I'm running my application EKS cluster, few days back we encounter the issues, let say we have application pod is running with one replicas count in different AWS node lets call vm name as like below.</p>
<pre><code>ams-99547bd55-9fp6r               1/1     Running   0          7m31s   10.255.114.81    ip-10-255-12-11.eu-central-1.compute.internal   
mongodb-58746b7584-z82nd          1/1     Running   0          21h   10.255.113.10   ip-10-255-12-11.eu-central-1.compute.internal
</code></pre>
<p>Here the my running serivces</p>
<pre><code>NAME                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
ams-service         NodePort    172.20.81.165    &lt;none&gt;        3030:30010/TCP               18m
mongodb-service     NodePort    172.20.158.81    &lt;none&gt;        27017:30003/TCP              15d
</code></pre>
<p>I have setting.conf.yaml file running as config map where i have application related configuration</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: ama-settings
  labels:
    conf: ams-settings
data:
  config : |
 &quot;git&quot;: {
      &quot;prefixUrl&quot;: &quot;ssh://git@10.255.12.11:30001/app-server/repos/ams/&quot;,
      &quot;author&quot;: {
      &quot;name&quot;: &quot;app poc&quot;,
      &quot;mail&quot;: &quot;app@domain.com&quot;
    },

      &quot;mongodb&quot;: {
      &quot;host&quot;: &quot;10.255.12.11&quot;,
      &quot;port&quot;: &quot;30003&quot;,
      &quot;database&quot;: &quot;ams&quot;,
      &quot;ssl&quot;: false,
     }
</code></pre>
<p>This is working as we expected, but in case if existing node ip where my pod is running, some of the reason when i'm deleting my running pod and trying to re-deploy that time my pod is placed in some other AWS node basically EC2 vm.</p>
<p>During this time my application is not working then I need edit my setting.conf.yaml file to update with new AWS node IP where my pod is running.</p>
<p>Here the question how to use the service name instead of AWS node IP, because we don't want change the ip address frequently in case if any existing VM is goes down.</p>

<p>ideally, instead of using the AWS IP you should be using the <code>0.0.0.0/0</code> <a href="https://discuss.kubernetes.io/t/security-implications-of-binding-server-to-127-0-0-1-vs-0-0-0-0-vs-pod-ip/13880" rel="nofollow noreferrer">Refrence doc</a></p>
<p>example in Node</p>
<pre><code>const cors = require(&quot;cors&quot;);
app.use(cors());

const port = process.env.PORT || 8000;
app.listen(port,&quot;0.0.0.0&quot; ,() =&gt; {
  console.log(`Server is running on port ${port}`);
});
</code></pre>
<p>however, if you want to add the service name :</p>
<p>you can use the full certified name, but I am not sure it will work on as host <code>0.0.0.0</code> would be better option</p>
<pre><code>&lt;service.name&gt;.&lt;namespace name&gt;.svc.cluster.local
</code></pre>
<p>example</p>
<pre><code>ams-service.default.svc.cluster.local
</code></pre>
