Update documentation for nomad with exemple to create volume
This commit is contained in:
parent
9a9ea36e7b
commit
7c6266e9a1
104
docs/nomad.md
104
docs/nomad.md
|
|
@ -19,51 +19,51 @@ job "storage-controller" {
|
||||||
group "controller" {
|
group "controller" {
|
||||||
network {
|
network {
|
||||||
mode = "bridge"
|
mode = "bridge"
|
||||||
|
|
||||||
port "grpc" {
|
|
||||||
static = 9000
|
|
||||||
to = 9000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task "controller" {
|
task "controller" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "democraticcsi/democratic-csi:latest"
|
image = "democraticcsi/democratic-csi:v1.7.6"
|
||||||
ports = ["grpc"]
|
ports = ["grpc"]
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--csi-version=1.2.0",
|
"--csi-version=1.5.0",
|
||||||
"--csi-name=org.democratic-csi.nfs",
|
"--csi-name=org.democratic-csi.iscsi",
|
||||||
"--driver-config-file=${NOMAD_TASK_DIR}/driver-config-file.yaml",
|
"--driver-config-file=${NOMAD_TASK_DIR}/driver-config-file.yaml",
|
||||||
"--log-level=debug",
|
"--log-level=debug",
|
||||||
"--csi-mode=controller",
|
"--csi-mode=controller",
|
||||||
"--server-socket=/csi-data/csi.sock",
|
"--server-socket=/csi-data/csi.sock",
|
||||||
"--server-address=0.0.0.0",
|
|
||||||
"--server-port=9000",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
privileged = true
|
privileged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
csi_plugin {
|
csi_plugin {
|
||||||
id = "truenas"
|
# must match --csi-name arg
|
||||||
|
id = "org.democratic-csi.iscsi"
|
||||||
type = "controller"
|
type = "controller"
|
||||||
mount_dir = "/csi-data"
|
mount_dir = "/csi"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
||||||
|
|
||||||
data = <<EOH
|
data = <<EOH
|
||||||
config
|
# Please fill this configuration
|
||||||
|
# driver: freenas-iscsi
|
||||||
|
# instance_id:
|
||||||
|
# httpConnection:
|
||||||
|
# protocol: https
|
||||||
|
# ...
|
||||||
|
#
|
||||||
EOH
|
EOH
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 30
|
cpu = 300
|
||||||
memory = 50
|
memory = 192
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,11 +82,11 @@ job "storage-node" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
config {
|
config {
|
||||||
image = "democraticcsi/democratic-csi:latest"
|
image = "democraticcsi/democratic-csi:v1.7.6"
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--csi-version=1.2.0",
|
"--csi-version=1.5.0",
|
||||||
"--csi-name=org.democratic-csi.nfs",
|
"--csi-name=org.democratic-csi.iscsi",
|
||||||
"--driver-config-file=${NOMAD_TASK_DIR}/driver-config-file.yaml",
|
"--driver-config-file=${NOMAD_TASK_DIR}/driver-config-file.yaml",
|
||||||
"--log-level=debug",
|
"--log-level=debug",
|
||||||
"--csi-mode=node",
|
"--csi-mode=node",
|
||||||
|
|
@ -97,22 +97,41 @@ job "storage-node" {
|
||||||
}
|
}
|
||||||
|
|
||||||
csi_plugin {
|
csi_plugin {
|
||||||
id = "truenas"
|
# must match --csi-name arg
|
||||||
type = "node"
|
id = "org.democratic-csi.iscsi"
|
||||||
mount_dir = "/csi-data"
|
type = "controller"
|
||||||
|
mount_dir = "/csi"
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
destination = "${NOMAD_TASK_DIR}/driver-config-file.yaml"
|
||||||
|
|
||||||
data = <<EOH
|
data = <<EOH
|
||||||
config
|
# Please fill this configuration
|
||||||
|
# driver: freenas-iscsi
|
||||||
|
# instance_id:
|
||||||
|
# httpConnection:
|
||||||
|
# protocol: https
|
||||||
|
# ...
|
||||||
|
#
|
||||||
EOH
|
EOH
|
||||||
}
|
}
|
||||||
|
mount {
|
||||||
|
type = "bind"
|
||||||
|
target = "/host"
|
||||||
|
source = "/"
|
||||||
|
readonly = false
|
||||||
|
}
|
||||||
|
mount {
|
||||||
|
type = "bind"
|
||||||
|
target = "/run/udev"
|
||||||
|
source = "/run/udev"
|
||||||
|
readonly = true
|
||||||
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
cpu = 30
|
cpu = 300
|
||||||
memory = 50
|
memory = 192
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,6 +141,43 @@ EOH
|
||||||
|
|
||||||
## Creating and registering the volumes
|
## Creating and registering the volumes
|
||||||
|
|
||||||
|
### New way
|
||||||
|
|
||||||
|
To create the volume, use the nomad cli
|
||||||
|
|
||||||
|
First create the following volume.hcl file
|
||||||
|
```hcl
|
||||||
|
|
||||||
|
id = "iscsi-volume-name"
|
||||||
|
name = "iscsi-volume-name"
|
||||||
|
type = "csi"
|
||||||
|
plugin_id = "org.democratic-csi.iscsi"
|
||||||
|
capacity_max = "2G"
|
||||||
|
capacity_min = "1G"
|
||||||
|
|
||||||
|
capability {
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then apply from a server node:
|
||||||
|
|
||||||
|
```
|
||||||
|
nomad volume create volume.hcl
|
||||||
|
```
|
||||||
|
|
||||||
|
Or from gitlab CICD
|
||||||
|
|
||||||
|
```
|
||||||
|
create-csi-volume:
|
||||||
|
stage: deploy
|
||||||
|
image: hendrikmaus/nomad-cli
|
||||||
|
script:
|
||||||
|
- nomad volume create volume.hcl
|
||||||
|
```
|
||||||
|
|
||||||
|
### Old way
|
||||||
To create the volumes, we are going to use the [csc](https://github.com/rexray/gocsi/tree/master/csc) utility. It can be installed via `go`.
|
To create the volumes, we are going to use the [csc](https://github.com/rexray/gocsi/tree/master/csc) utility. It can be installed via `go`.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue