volumeMount子路径不起作用

Nic*_*ick 5 kubernetes

我正在尝试利用请求(最近在v1.3中发布)中subPath实现的新功能。

但是,的输出mount显示忽略subPath,对于两个卷挂载都安装了相同的NFS目录:

nfs-server:/mnt/nfs/exports/apps/my-app on /home/share/foo type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.128.0.4,local_lock=none,addr=nfs-server)
nfs-server:/mnt/nfs/exports/apps/my-app on /home/share/bar/baz type nfs4 (rw,relatime,vers=4.0,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.128.0.4,local_lock=none,addr=nfs-server)
Run Code Online (Sandbox Code Playgroud)

我的部署YAML的相关内容:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: app
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: app
    spec:
      containers:
      - name: app
        image: my-org/my-app:latest
        volumeMounts:
        - mountPath: /home/share/foo
          name: nfs
          subPath: foo-resources
        - mountPath: /home/share/bar/baz
          name: nfs
          subPath: baz-resources
      volumes:
      - name: nfs
        nfs:
          path: /mnt/nfs/exports/apps/my-app
          server: nfs-server
Run Code Online (Sandbox Code Playgroud)

iam*_*eli 0

当我尝试使用kubectl版本 1.2 更新 Kubernetes 1.4 集群时,我遇到了这个问题。尝试更新您的文件kubectl,然后kubectl apply在适当的文件上运行。