Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes 如何在部署配置中为秘密装载路径使用相对路径_Kubernetes_Kubernetes Secrets - Fatal编程技术网

Kubernetes 如何在部署配置中为秘密装载路径使用相对路径

Kubernetes 如何在部署配置中为秘密装载路径使用相对路径,kubernetes,kubernetes-secrets,Kubernetes,Kubernetes Secrets,我很难将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: #

我很难将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/secret volume
中创建的,这是因为您有
装入路径:secret/secret volume
将其更改为
装入路径:/user/app/secret/secret volume


.

Kubernetes是如何知道
/user/app
目录的?是否在更大的pod规范的其他地方提到过?需要更正容器安装路径。