<p>I have a Dockerfile that starts a java process with this command <code>CMD java -jar application.jar serve /path-to-file/setting.yaml </code></p>
<p>Now, I want to make the <code>settings.yaml</code> to be configMap, so, I can manage it in kubernetes instead of building a new docker image every time I have updated a setting.</p>
<p>My question is: is possible to achieve this now that I won't be passing setting.yaml in the Dockerfile but a kubernetes yaml as a confiMap?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>  containers:
  - name: java-container
    image: javaimage:1.0
    command: [""]
    args: ["pass the file here"]</code></pre>
</div>
</div>
</p>
<p>is it possible to pass the file in a kubernetes deployment as configMap on <code>args[&quot;&quot;]</code></p>

Muzi Jack
<p>First, you would create a ConfigMap:</p>
<pre><code>cat &lt;&lt;EOF &gt;file.yaml
[...]
EOF
kubectl create -n my-namespace configmap my-app-config --from-file=settings.yaml=file.yaml
</code></pre>
<p>Then, based on the path of the configuration file loaded in the <code>CMD</code> of your container image, you would mount that ConfigMap to the proper location:</p>
<pre><code>containers:
- name: app
  [ ... ]
  volumeMounts:
  - name: config-volume
    path: /path-to-file/settings.yaml
    subPath: settings.yaml
[ ... ]
volumes:
- name: config-volume
  configMap:
    name: my-app-config
</code></pre>
