<p>I want to inject the value of k8s 'node ip' to a config map when a pod gets created.
Any way how to do that?</p>

Rumesh Madhusanka
<p>A configmap is not bound to a host (multiple pods on different hosts can share the same configmap). But you can get details in a running pod.
You can get the host IP the following way in an environment variable. Add the following in your pods spec section:</p>
<pre><code>env:
- name: MY_NODE_IP
  valueFrom:
    fieldRef:
      fieldPath: status.hostIP
</code></pre>
<p>Details about passing other values to env vars can be found in the <a href="https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-pod-fields-as-values-for-environment-variables" rel="nofollow noreferrer">official documentation</a>.</p>
<p>Unfortunately you can't get the hostIP in a volume, as the downwardAPI doesn't have access to <code>status.hostIP</code> (<a href="https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#capabilities-of-the-downward-api" rel="nofollow noreferrer">docu</a>)</p>
