我很难将 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
。