<p>So i'm deploying my application stack on kubernetes sing helm charts and now i need to add some dependant server ip's and hostnames inside my pods /etc/hosts file so need help on this scenario</p>

<p>A helm templated solution to the original question. I tested this with helm 3.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
spec:
  template:
    spec:
    {{- with .Values.hostAliases }}
      hostAliases:
{{ toYaml . | indent 8 }}
    {{- end }}
</code></pre>
<p>For values such as:</p>
<pre><code>hostAliases:
  - ip: &quot;10.0.0.1&quot;
    hostnames:
    - &quot;host.domain.com&quot;
</code></pre>
<p>If the hostAliases is omitted or commented out in the values, the hostAliases section is omitted when the template is rendered.</p>
