如何在kubernetes集群中使用nfs挂载glusterfs卷?

时间:2017-02-17 09:51:42

标签: kubernetes nfs glusterfs

我已经建立了一个glusterfs集群,为kubernetes中的pod提供卷。以glusterfs方式安装音量时没有问题:

        "volumes": [
        {
            "name": "vol1",
            "glusterfs": {
                "endpoints": "glusterfs-cluster",
                "path": "a-gluster-vol"
            }
        }
    ]

我的问题是,我可以用nfs方式使用gluster卷吗?如此

 "nfs": {
                "server": "someaddress",
                "path": "/a-gluster-vol"
            }

广告连播是failedMount

50s     18s     7   {kubelet kube-node-21}          Warning     FailedMount MountVolume.SetUp failed for volume "kubernetes.io/nfs/818e0668-f7df-11e6-9f69-52540092af07-vol1" (spec.Name: "vol1") pod "818e0668-f7df-11e6-9f69-52540092af07" (UID: "818e0668-f7df-11e6-9f69-52540092af07") with: mount failed: exit status 32
Mounting command: mount
Mounting arguments: 192.168.16.180:/nfs /var/lib/kubelet/pods/818e0668-f7df-11e6-9f69-52540092af07/volumes/kubernetes.io~nfs/vol1 nfs []
Output: mount.nfs: requested NFS version or transport protocol is not supported

2 个答案:

答案 0 :(得分:1)

"volumes": [{
  "name": "vol1",
  "nfs": {
    "server": "glusterfs-server-ip",
    "path": "/a-gluster-vol"
  }
}]

现在你只能指定一台服务器,因此它并不理想。

答案 1 :(得分:0)

kubernetes中的Gluster插件适用于FUSE,因此当您在pod规范中指定“gluster”时,将使用FUSE客户端进行挂载。但是,如果要将其用作NFS共享,可以在pod规范中尝试“nfs”规范,但必须确保“Gluster nfs”服务在Gluster Cluster中运行。