<p>I have the following setup:</p>
<p>An <strong>azure kubernetes cluster</strong> with some nodes where my application (consisting of multiple pods) is running.
I'm looking for a good way to make a <strong>project-specific configuration file</strong> (a few hundred lines) <strong>available for two of the deployed containers</strong> and their replicas.</p>
<p>The configuration file is different between my projects but the containers are not.</p>
<p>I'm looking for something like a read-only file mount in the containers, but haven't found an good way. I played around with persistent volume claims but there seems to be no automatic file placement possibility apart from copying (including uri and secret managing).</p>
<p>Best thing would be to have a possiblility where <strong>kubectl makes use of a yaml file</strong> to access a specific folder on my developer machine to push my configuration file into the cluster.</p>
<ul>
<li><p><strong>ConfigMaps are not a proper way to do it</strong> (because data has to be inside the yaml and my file is big and changing)</p>
</li>
<li><p>For <strong>volumes there seems to be no automatic way to place files inside them at creation time</strong>.</p>
</li>
</ul>
<p>Can anybody guide me to a good solution that matches my situation?</p>

<p>You can use a configmap for this, but the configmap includes your config file. You can create a configmap with the content of your config file via the following:</p>
<pre><code>kubectl create configmap my-config --from-file=my-config.ini=/path/to/your/config.ini
</code></pre>
<p>and the bind it as a volume in your pod:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: mypod
    ...
    volumeMounts:
    - name: config
      mountPath: &quot;/config&quot;
      readOnly: true
  volumes:
  - name: config
    configMap:
      name: my-config #the name of your configmap
</code></pre>
<p>Afterwards your config is available in your pod under <code>/config/my-config.ini</code></p>
