<p>I want to modify particular config file from kubernetes running pod at runtime.
How can I get pod name at runtime and I can modify the file from running pod and restart it to reflect the changes? I am trying this in python 3.6.</p>

<p>Suppose,
I have two running pods.
In one pod I have config.json file. In that I have </p>

<blockquote>
  <p>{
      "server_url" : "<a href="http://127.0.0.1:8080" rel="nofollow noreferrer">http://127.0.0.1:8080</a>" 
  }</p>
</blockquote>

<p>So I want to replace 127.0.0.1 to other kubernetes service's loadbalancer IP in it.  </p>

ImPurshu
<p>Generally you would do this with an initContainer and a templating tool like envsubst or confd or Consul Templates.</p>
