<p>I have a volume with a secret called config-volume. I want to have that file in the /home/code/config folder, which is where the rest of the configuration files are. For that, I mount it as this:</p>

<pre><code>volumeMounts:
  - name: config-volumes
  - mountPath: /home/code/config
</code></pre>

<p>The issue is that, after deploying, in the /home/code/config I only have the secret file and the rest of them are gone</p>

<p>So the /home/code/config is an existing folder (not empty), I suspect that the volumeMount overwrites the folder.</p>

<p>Is there a way that this can be done without overwriting everything?</p>

<p>You can do the following, taken from <a href="https://github.com/kubernetes/kubernetes/issues/44815#issuecomment-297077509" rel="noreferrer">this GitHub issue</a> </p>

<pre><code>containers:
- volumeMounts:
  - name: config-volumes
    mountPath: /home/code/config
    subPath: config
volumes:
- name: config-volumes
  configMap:
    name: my-config
</code></pre>

<p>Suggested that your <code>ConfigMap</code>is called <em>my-config</em> and that you have a key <em>config</em> in it.</p>
