1

我很难将 mountPath 配置为相对路径。假设我正在从/user/app文件夹运行部署,并且我想在下面创建秘密文件/user/app/secret/secret-volume

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

由于某种原因,该文件secret-volume是在根目录中创建的/secret/secret-volume

4

1 回答 1

1

这是因为您已将mountPath: secret/secret-volume其更改为mountPath: /user/app/secret/secret-volume

在此处查看文档

于 2019-02-17T15:51:04.900 回答