Csi-driver-nfs Name or Service not known

I’m trying using the csi-driver-nfs.
It seems Controller and Node are successfully installed.

But I’m facing an issue Name or Service not known when try using volume…

I have listed the IP address of the NFS server in the volume.hcl and have confirmed that it mounts fine(v3 and v4) on the Nomad node.

node log

I0722 12:49:06.559263       1 utils.go:87] GRPC request: {"target_path":"/csi/per-alloc/21750709-c4a7-9c3b-ffd3-36656f86a8fa/nfs-500gb/rw-file-system-multi-node-multi-writer","volume_capability":{"AccessType":{"Mount":{}},"access_mode":{"mode":5}},"volume_id":"nfs-500gb"}
I0722 12:49:06.559447       1 nodeserver.go:77] NodePublishVolume: volumeID(nfs-500gb) source(:) targetPath(/csi/per-alloc/21750709-c4a7-9c3b-ffd3-36656f86a8fa/nfs-500gb/rw-file-system-multi-node-multi-writer) mountflags([])
I0722 12:49:06.559457       1 mount_linux.go:175] Mounting cmd (mount) with arguments (-t nfs : /csi/per-alloc/21750709-c4a7-9c3b-ffd3-36656f86a8fa/nfs-500gb/rw-file-system-multi-node-multi-writer)
E0722 12:49:06.563291       1 mount_linux.go:179] Mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t nfs : /csi/per-alloc/21750709-c4a7-9c3b-ffd3-36656f86a8fa/nfs-500gb/rw-file-system-multi-node-multi-writer
Output: mount.nfs: Failed to resolve server : Name or service not known

volume

$ nomad volume status nfs-500gb
ID                   = nfs-500gb
Name                 = nfs-500gb
External ID          = nfs-500gb
Plugin ID            = nfs-500gb
Provider             = nfs.csi.k8s.io
Version              = 3.0.0
Schedulable          = true
Controllers Healthy  = 1
Controllers Expected = 1
Nodes Healthy        = 3
Nodes Expected       = 3
Access Mode          = <none>
Attachment Mode      = <none>
Mount Options        = <none>
Namespace            = default

Allocations
No allocations placed

volume.hcl

id              = "nfs-500gb"
name            = "nfs-500gb"
type            = "csi"
external_id     = "nfs-500gb"
plugin_id       = "nfs-500gb"

capability {
  access_mode     = "single-node-writer"
  attachment_mode = "file-system"
}

parameters {
  server  = "192.168.20.111"
  share   = "/mnt/data"
}

job(using volume)

volume "nfs-500gb" {
  type      = "csi"
  source    = "nfs-500gb"
  attachment_mode = "file-system"
  access_mode = "multi-node-multi-writer"
  read_only = false
}

job event

failed to setup alloc: pre-run hook "csi_hook" failed: node plugin returned an internal error, check the plugin allocation logs for more information: rpc error: code = Internal desc = mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs : /csi/per-alloc/c7104663-0916-dab6-dc27-ab5039468cad/nfs-500gb/rw-file-system-multi-node-multi-writer Output: mount.nfs: Failed to resolve server : Name or service not known

nomad: 1.1.2
csi-driver-nfs: master(2021/07/22)

Hi @rluisr :wave:

There’s something odd with this error message:

I think the server address is missing. It should be something like

Failed to resolve server <server address>: Name or service not known

So it seems like the server address is empty?

Could you share the job files you used to deploy the CSI plugin and node?

Thank you for your reply @lgfa29 !

I don’t know why the server address is missing…

parameters {
  server  = "192.168.20.111"
  share   = "/mnt/data"
}

Is this wrong?

Plugin job file

job "plugin-nfs-controller" {
  datacenters = ["dc"]

  group "controller" {
    task "plugin" {
      driver = "docker"

      config {
        image = "mcr.microsoft.com/k8s/csi/nfs-csi:latest"
        args = [
          "-v=5",
          "--nodeid=${attr.unique.hostname}",
          "--endpoint=unix://csi/csi.sock"
        ]
      }

      csi_plugin {
        id        = "nfs-500gb"
        type      = "controller"
        mount_dir = "/csi"
      }

      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

node job file

job "plugin-nfs-node" {
  datacenters = ["dc"]

  type = "system"

  group "nodes" {
    task "plugin" {
      driver = "docker"

      config {
        image = "mcr.microsoft.com/k8s/csi/nfs-csi:latest"
        args = [
          "-v=5",
          "--nodeid=${attr.unique.hostname}",
          "--endpoint=unix://csi/csi.sock"
        ]
        privileged = true
      }

      csi_plugin {
        id        = "nfs-500gb"
        type      = "node"
        mount_dir = "/csi"
      }

      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

I’ve tried what have been done here and for those who need the answer this come from volume definition, we have

but parameters is not given to nodes for creating, but context does on registering, so it should be:

id              = "nfs-500gb"
name            = "nfs-500gb"
type            = "csi"
external_id     = "nfs-500gb"
plugin_id       = "nfs-500gb"

capability {
  access_mode     = "single-node-writer"
  attachment_mode = "file-system"
}

context {
  server  = "192.168.20.111"
  share   = "/mnt/data"
}

use this one

https://codeberg.org/in0rdr/nomad-csi-driver-nfs-example is 404 :frowning:

Can’t remember if this url is what I used, but here are my nomad templates for NFS via CSI:

plugin-nfs-nodes.nomad.txt (820 Bytes)
plugin-nfs-controller.nomad.txt (849 Bytes)
nfs-volume.tf.txt (983 Bytes)