github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/commands/volume/register.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Commands: volume register'
     4  sidebar_title: register
     5  description: |
     6    Register volumes with CSI plugins.
     7  ---
     8  
     9  # Command: volume register
    10  
    11  The `volume register` command registers external storage volumes with
    12  Nomad's [Container Storage Interface (CSI)][csi] support. The volume
    13  must exist on the remote storage provider before it can be registered
    14  and used by a task.
    15  
    16  ## Usage
    17  
    18  ```plaintext
    19  nomad volume register [options] [file]
    20  ```
    21  
    22  The `volume register` command requires a single argument, specifying
    23  the path to a file containing a valid [volume
    24  specification][volume_specification]. This file will be read and the
    25  job will be submitted to Nomad for scheduling. If the supplied path is
    26  "-", the job file is read from STDIN. Otherwise it is read from the
    27  file at the supplied path.
    28  
    29  When ACLs are enabled, this command requires a token with the
    30  `csi-write-volume` capability for the volume's namespace.
    31  
    32  ## General Options
    33  
    34  @include 'general_options.mdx'
    35  
    36  ## Volume Specification
    37  
    38  The file may be provided as either HCL or JSON. An example HCL configuration:
    39  
    40  ```hcl
    41  id = "ebs_prod_db1"
    42  name = "database"
    43  type = "csi"
    44  external_id = "vol-23452345"
    45  plugin_id = "ebs-prod"
    46  access_mode = "single-node-writer"
    47  attachment_mode = "file-system"
    48  mount_options {
    49     fs_type = "ext4"
    50     mount_flags = ["ro"]
    51  }
    52  secrets {
    53     example_secret = "xyzzy"
    54  }
    55  parameters {
    56      skuname = "Premium_LRS"
    57  }
    58  context {
    59      endpoint = "http://192.168.1.101:9425"
    60  }
    61  ```
    62  
    63  ## Volume Specification Parameters
    64  
    65  - `id` `(string: <required>)` - The unique ID of the volume. This will
    66    be how [`volume`][csi_volume] stanzas in a jobspec refer to the volume.
    67  
    68  - `name` `(string: <required>)` - The display name of the volume.
    69  
    70  - `type` `(string: <required>)` - The type of volume. Currently only
    71    `"csi"` is supported.
    72  
    73  - `external_id` `(string: <required>)` - The ID of the physical volume
    74    from the storage provider. For example, the volume ID of an AWS EBS
    75    volume or Digital Ocean volume.
    76  
    77  - `plugin_id` `(string: <required>)` - The ID of the [CSI
    78    plugin][csi_plugin] that manages this volume.
    79  
    80  - `access_mode` `(string: <required>)` - Defines whether a volume
    81    should be available concurrently. Can be one of
    82    `"single-node-reader-only"`, `"single-node-writer"`,
    83    `"multi-node-reader-only"`, `"multi-node-single-writer"`, or
    84    `"multi-node-multi-writer"`. Most CSI plugins support only
    85    single-node modes. Consult the documentation of the storage provider
    86    and CSI plugin.
    87  
    88  - `attachment_mode` `(string: <required>)` - The storage API that will be used
    89    by the volume. Most storage providers will support `"file-system"`, to mount
    90    volumes using the CSI filesystem API. Some storage providers will support
    91    `"block-device"`, which will mount the volume with the CSI block device API
    92    within the container.
    93  
    94  - `mount_options` - Options for mounting `file-system` volumes that don't
    95    already have a pre-formatted file system. Consult the documentation for your
    96    storage provider and CSI plugin as to whether these options are required or
    97    necessary.
    98  
    99    - `fs_type`: file system type (ex. `"ext4"`)
   100    - `mount_flags`: the flags passed to `mount` (ex. `"ro,noatime"`)
   101  
   102  - `secrets` <code>(map<string|string>:nil)</code> - An optional
   103    key-value map of strings used as credentials for publishing and
   104    unpublishing volumes.
   105  
   106  - `parameters` <code>(map<string|string>:nil)</code> - An optional
   107    key-value map of strings passed directly to the CSI plugin to
   108    configure the volume. The details of these parameters are specific
   109    to each storage provider, so please see the specific plugin
   110    documentation for more information.
   111  
   112  - `context` <code>(map<string|string>:nil)</code> - An optional
   113    key-value map of strings passed directly to the CSI plugin to
   114    validate the volume. The details of these parameters are specific to
   115    each storage provider, so please see the specific plugin
   116    documentation for more information.
   117  
   118  [volume_specification]: #volume-specification
   119  [csi]: https://github.com/container-storage-interface/spec
   120  [csi_plugin]: /docs/job-specification/csi_plugin
   121  [csi_volumes]: /docs/job-specification/volume