How to mount glusterfs volume using nfs in a kubernetes cluster?

2/17/2017

I have set up a glusterfs cluster, providing volumes for pods in kubernetes. There is no problems when mounting volume in the glusterfs way:

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

My question is, can I use the gluster volume in nfs way? Such like

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

The pod is 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
-- Haoyuan Ge
glusterfs
kubernetes
nfs

2 Answers

9/16/2017

The Gluster plugin in kubernetes works on FUSE, so the mount will be happening using FUSE client when you specify "gluster" in pod spec. However if you want to use it as a NFS share , you could try "nfs" spec in pod spec, but you have to make sure the "gluster nfs" service is running in Gluster Cluster.

-- Humble
Source: StackOverflow

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

For now you can only specify one server so it's not ideal.

-- Janos Lenart
Source: StackOverflow