<p>I have the following yaml:</p>

<pre><code>        volumeMounts:
        - name: app-secret
          mountPath: /app
          readOnly: true
      volumes:
      - name: app-secret
        secret:
          secretName: app-secret
          items:
          - key: app-secret.json
            path: appsettings.secret.json
</code></pre>

<p>I expect the secret is mounted on <code>/app/appsettings.secret.json</code> but it isn't. I don't know where it is mounted and the container crashes and I don't have a chance to <code>kubectl exec</code> into the container to inspect where the secret is mounted. My guess is that it wipes out the content of <code>/app</code>. Any advice and insight is appreciated.</p>

<p>This works:</p>

<pre><code> volumeMounts:
        - name: app-secret
          mountPath: /app/appsettings.secret.json
          subPath: appsettings.secret.json
          readOnly: true
      volumes:
      - name: app-secret
        secret:
          secretName: app-secret
          items:
          - key: app-secret.json
            path: appsettings.secret.json
</code></pre>
