github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/job-specification/csi_plugin.mdx (about) 1 --- 2 layout: docs 3 page_title: csi_plugin Stanza - Job Specification 4 sidebar_title: csi_plugin <sup>Beta</sup> 5 description: >- 6 The "csi_plugin" stanza allows the task to specify it provides a 7 Container Storage Interface plugin to the cluster. 8 --- 9 10 # `csi_plugin` Stanza 11 12 <Placement groups={['job', 'group', 'task', 'volume']} /> 13 14 The "csi_plugin" stanza allows the task to specify it provides a 15 Container Storage Interface plugin to the cluster. Nomad will 16 automatically register the plugin so that it can be used by other jobs 17 to claim [volumes][csi_volumes]. 18 19 ```hcl 20 csi_plugin { 21 id = "csi-hostpath" 22 type = "monolith" 23 mount_dir = "/csi" 24 } 25 ``` 26 27 ## `csi_plugin` Parameters 28 29 - `id` `(string: <required>)` - This is the ID for the plugin. Some 30 plugins will require both controller and node plugin types (see 31 below); you need to use the same ID for both so that Nomad knows the 32 belong to the same plugin. 33 34 - `type` `(string: <required>)` - One of `node`, `controller`, or 35 `monolith`. Each plugin supports one or more types. Each Nomad 36 client node where you want to mount a volume will need a `node` 37 plugin instance. Some plugins will also require one or more 38 `controller` plugin instances to communicate with the storage 39 provider's APIs. Some plugins can serve as both `controller` and 40 `node` at the same time, and these are called `monolith` 41 plugins. Refer to your CSI plugin's documentation. 42 43 - `mount_dir` `(string: <required>)` - The directory path inside the 44 container where the plugin will expect a Unix domain socket for 45 bidirectional communication with Nomad. 46 47 48 ~> **Note:** Plugins running as `node` or `monolith` require root 49 privileges (or `CAP_SYS_ADMIN` on Linux) to mount volumes on the 50 host. With the Docker task driver, you can use the `privileged = true` 51 configuration, but no other default task drivers currently have this 52 option. 53 54 ~> **Note:** During node drains, jobs that claim volumes should be 55 moved before the `node` or `monolith` plugin for those 56 volumes. Because [`system`][system] jobs are moved last during node drains, you 57 should run `node` or `monolith` plugins as `system` jobs. 58 59 ## `csi_plugin` Examples 60 61 ```hcl 62 job "plugin-efs" { 63 datacenters = ["dc1"] 64 65 # you can run node plugins as service jobs as well, but running 66 # as a system job ensures all nodes in the DC have a copy. 67 type = "system" 68 69 group "nodes" { 70 task "plugin" { 71 driver = "docker" 72 73 config { 74 image = "amazon/aws-efs-csi-driver:latest" 75 76 args = [ 77 "node", 78 "--endpoint=unix://csi/csi.sock", 79 "--logtostderr", 80 "--v=5", 81 ] 82 83 # all CSI node plugins will need to run as privileged tasks 84 # so they can mount volumes to the host. controller plugins 85 # do not need to be privileged. 86 privileged = true 87 } 88 89 csi_plugin { 90 id = "aws-efs0" 91 type = "node" 92 mount_dir = "/csi" # this path /csi matches the --endpoint 93 # argument for the container 94 } 95 } 96 } 97 } 98 ``` 99 100 [csi]: https://github.com/container-storage-interface/spec 101 [csi_volumes]: /docs/job-specification/volume 102 [system]: /docs/schedulers/#system