mirror of
https://github.com/kemko/nomad.git
synced 2026-01-09 03:45:41 +03:00
The documentation for CSI and DHV has a list of the available access modes, but doesn't explain what they mean in terms of what jobs can request, the scheduler behavior, or the CSI plugin behavior. Expand on the information available in the CSI specification and provide a description of DHV's behavior as well. Ref: https://github.com/container-storage-interface/spec/blob/master/spec.md#createvolume
106 lines
4.0 KiB
Plaintext
106 lines
4.0 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: Nomad volume specification capability block
|
|
description: |-
|
|
Configure Container Storage Interface (CSI) and dynamic host storage volume capability in the `capability`block of the Nomad volume specification. Set single node or multiple node access and file system or block device attachment mode.
|
|
---
|
|
|
|
# Nomad volume specification capability block
|
|
|
|
<Placement
|
|
groups={[
|
|
['volume', 'capability'],
|
|
]}
|
|
/>
|
|
|
|
The `capability` block allows validating that a volume meets the requested
|
|
capabilities.
|
|
|
|
```hcl
|
|
id = "ebs_prod_db1"
|
|
namespace = "default"
|
|
name = "database"
|
|
type = "csi"
|
|
plugin_id = "ebs-prod"
|
|
capacity_max = "200G"
|
|
capacity_min = "100G"
|
|
|
|
capability {
|
|
access_mode = "single-node-reader-only"
|
|
attachment_mode = "file-system"
|
|
}
|
|
```
|
|
|
|
You must provide at least one `capability` block, and you must provide a block
|
|
for each capability you intend to use in a job's [`volume`] block.
|
|
|
|
## Parameters
|
|
|
|
- `access_mode` `(string)` - Defines whether a volume should be available
|
|
concurrently. The `access_mode` and `attachment_mode` from the volume request
|
|
must exactly match one of the volume's `capability` blocks.
|
|
|
|
- For CSI volumes the `access_mode` is required. Can be one of the following:
|
|
|
|
- `"single-node-reader-only"`: Jobs can only request the volume with
|
|
read-only access, and only one node can mount the volume at a time.
|
|
- `"single-node-writer"`: Jobs can request the volume with read/write or
|
|
read-only access, and only one node can mount the volume at a time.
|
|
- `"multi-node-reader-only"`: Jobs can only request the volume with
|
|
read-only access, but multiple nodes can mount the volume simultaneously.
|
|
- `"multi-node-single-writer"`: Jobs can request the volume with read/write
|
|
or read-only access, but the scheduler only allows one allocation to have
|
|
read/write access. Multiple nodes can mount the volume simultaneously.
|
|
- `"multi-node-multi-writer"`: Jobs can request the volume with read/write
|
|
or read-only access, and the scheduler allows multiple allocations to have
|
|
read/write access. Multiple nodes can mount the volume simultaneously.
|
|
|
|
Most CSI plugins support only single-node modes. Consult the documentation
|
|
of the storage provider and CSI plugin.
|
|
|
|
- For dynamic host volumes the `access_mode` is optional. Can be one of the following:
|
|
|
|
- `"single-node-writer"`: Jobs can only request the volume with read/write access.
|
|
- `"single-node-reader-only"`: Jobs can only request the volume with read-only access.
|
|
- `"single-node-single-writer"`: Jobs can request either read/write or
|
|
read-only access, but the scheduler only allows one allocation to have
|
|
read/write access.
|
|
- `"single-node-multi-writer"`: Jobs can request either read/write or
|
|
read-only access, and the scheduler allows multiple allocations to have
|
|
read/write access.
|
|
|
|
In the job specification, the default is `single-node-writer` unless
|
|
`read_only = true`, which translates to `single-node-reader-only`.
|
|
|
|
- `attachment_mode` `(string)` - The storage API used by the volume. One of
|
|
`"file-system"` or `"block-device"`. The `access_mode` and `attachment_mode`
|
|
from the volume request must exactly match one of the volume's `capability`
|
|
blocks.
|
|
|
|
- For CSI volumes the `attachment_mode` field is required. Most storage
|
|
providers support `"file-system"`, to mount volumes using the CSI
|
|
filesystem API. Some storage providers support `"block-device"`, which
|
|
mounts the volume with the CSI block device API within the container.
|
|
|
|
- For dynamic host volumes the `attachment_mode` field is optional and
|
|
defaults to `"file-system"`.
|
|
|
|
## Example
|
|
|
|
This examples shows a volume that must satisfy multiple capability
|
|
requirements.
|
|
|
|
```hcl
|
|
capability {
|
|
access_mode = "single-node-reader-only"
|
|
attachment_mode = "file-system"
|
|
}
|
|
|
|
capability {
|
|
access_mode = "single-node-writer"
|
|
attachment_mode = "file-system"
|
|
}
|
|
```
|
|
|
|
[`volume`]: /nomad/docs/job-specification/volume
|