<p>When a pod is being scheduled, I dynamically (and transparently) mount some shared libraries folder into the client containers through Kubernetes DevicePlugins. Now, in the container I want to append/extend these dynamically mounted shared libraries to LD_LIBRARY_PATH environmental variables.</p>

<p>Inside the container: This can be achieved by running command on the bash 
"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/new/directory"</p>

<p>From the Host: I can add the export command to the pod.yaml file under pod.spec.command and args. </p>

<p>But, I wanted to do it transparently without the client/admin specifying it in the yaml file using Kubernetes DevicePlugins or Extended-Schedulers</p>

<p>I am looking method/hack by which I can append/extend the LD_LIBRARY_PATH inside the container only using Kubernetes source code.</p>

<p>Thanks.</p>

<p>You can just bake into your Dockerfile and create an image that you use in Kubernetes for that. No need to hack the Kubernetes source code.</p>

<p>In your Dockerfile in some line:</p>

<pre><code>ENV LD_LIBRARY_PATH /extra/path:$LD_LIBRARY_PATH
</code></pre>

<p>Then:</p>

<pre><code>docker build -t &lt;your-image-tag&gt; .
docker push &lt;your-image-tag&gt;
</code></pre>

<p>Then, update your pod or deployment definition and deploy to Kubernetes.</p>

<p>Hope it helps.</p>
