在将镜像类型从container-vm迁移到GKE群集的节点的cos之后,似乎不再可能为Pod挂载NFS卷。

该问题似乎丢失了NFS客户端库,因为在我尝试过的所有COS版本上,命令行的安装命令均失败(cos-stable-58-9334-62-0,cos-beta-59-9460-20-0,cos -dev-60-9540-0-0)。

sudo mount -t nfs mynfsserver:/myshare /mnt

失败于
mount: wrong fs type, bad option, bad superblock on mynfsserver:/myshare,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)

但这与此处列出的受支持的卷类型矛盾:
https://cloud.google.com/container-engine/docs/node-image-migration#storage_driver_support

将NFS卷挂载到Pod的池中只能使用图像类型container-vm,而不能使用cos

使用cos,我得到以下消息与kubectl describe pod:
MountVolume.SetUp failed for volume "kubernetes.io/nfs/b6e6cf44-41e7-11e7-8b00-42010a840079-nfs-mandant1" (spec.Name: "nfs-mandant1") pod "b6e6cf44-41e7-11e7-8b00-42010a840079" (UID: "b6e6cf44-41e7-11e7-8b00-42010a840079") with: mount failed: exit status 1
Mounting command: /home/kubernetes/containerized_mounter/mounter
Mounting arguments: singlefs-1-vm:/data/mandant1 /var/lib/kubelet/pods/b6e6cf44-41e7-11e7-8b00-42010a840079/volumes/kubernetes.io~nfs/nfs-mandant1 nfs []
Output: Mount failed: Mount failed: exit status 32
Mounting command: chroot
Mounting arguments: [/home/kubernetes/containerized_mounter/rootfs mount -t nfs singlefs-1-vm:/data/mandant1 /var/lib/kubelet/pods/b6e6cf44-41e7-11e7-8b00-42010a840079/volumes/kubernetes.io~nfs/nfs-mandant1]
Output: mount.nfs: Failed to resolve server singlefs-1-vm: Temporary failure in name resolution

最佳答案

Martin,您是手动设置挂载(自己执行挂载),还是让kubernetes代表Pod引用NFS卷来代表它?

前者将不起作用。以后会的。您已经发现COS并未附带NFS客户端库,因此GKE通过设置具有所需二进制文件的chroot(位于/ home / kubernetes / containerized_mounter / rootfs)并在其中调用mount来解决此问题。

关于kubernetes - 使用Container OS(COS)在Google Container Engine中挂载NFS卷,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44163040/

10-15 22:49