<p>I'm having hard time configuring mountPath as a relative path.
Let's say I'm running the deployment from <code>/user/app</code> folder and I want to create secret file under <code>/user/app/secret/secret-volume</code> as follows:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: secret-test-pod
spec:
  containers:
    - name: test-container
      image: nginx
      volumeMounts:
          # name must match the volume name below
          - name: secret-volume
            mountPath: secret/secret-volume
  # The secret data is exposed to Containers in the Pod through a Volume.
  volumes:
    - name: secret-volume
      secret:
        secretName: test-secret
</code></pre>

<p>For some reason the file <code>secret-volume</code> is created in the root directory <code>/secret/secret-volume</code>.</p>

<p>It's because you have <code>mountPath: secret/secret-volume</code> change it to <code>mountPath: /user/app/secret/secret-volume</code></p>

<p><a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">Check documentation here</a>.</p>
