1

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

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

For some reason the file secret-volume is created in the root directory /secret/secret-volume.

David Maze
  • 130,717
  • 29
  • 175
  • 215
Shiran Amiel
  • 21
  • 1
  • 3

1 Answers1

1

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

Check documentation here.

Vishrant
  • 15,456
  • 11
  • 71
  • 120