Add Portworx CSI Driver example

Signed-off-by: Grant Griffiths <ggriffiths@purestorage.com>
This commit is contained in:
Grant Griffiths
2021-07-23 16:51:23 -07:00
parent 44ea61ef3a
commit 827fbb45b8
3 changed files with 173 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
## Official documentation
Before getting started, full documentation for using Portworx with Nomad can be found at [docs.portworx.com/install-with-other/nomad](https://docs.portworx.com/install-with-other/nomad).
## Prerequisites
* Portworx 2.8.0 or higher is required for using the Portworx CSI Driver on Nomad
* Nomad 1.1.0 or higher is recommended for the full suite of volume operations
* A minimum of 3 nodes is required for running Portworx on Nomad
* Connection to consul cluster is required
## Configure your Nomad clients
The Portworx OCI-monitor container needs to run in privileged mode, so you need to configure your Nomad clients to allow docker containers running on privileged mode.
Add the following lines in your Nomad client configuration files and restart your clients:
plugin "docker" {
config {
allow_privileged = true
volumes {
enabled = true
}
}
}
## Getting started
To start using the Portworx CSI Driver on Nomad, complete the follow steps:
1. Run the following command in this directory:
```
nomad job run portworx-csi-plugin.hcl
```
2. Portworx will take a few minutes to startup. To check on the status, run the following command:
```
nomad job status portworx
```
3. Once Portworx is running, create a volume with the following command:
```
nomad volume create portworx-volume.hcl
```
## Portworx Openstorage CSI Driver repo:
The open source control plane for Portworx can be found at the following repository:
https://github.com/libopenstorage/openstorage/tree/master/csi

View File

@@ -0,0 +1,103 @@
job "portworx" {
type = "service"
datacenters = ["dc1"]
group "portworx" {
count = 3
constraint {
operator = "distinct_hosts"
value = "true"
}
# restart policy for failed portworx tasks
restart {
attempts = 3
delay = "30s"
interval = "5m"
mode = "fail"
}
# how to handle upgrades of portworx instances
update {
max_parallel = 1
health_check = "checks"
min_healthy_time = "10s"
healthy_deadline = "5m"
auto_revert = true
canary = 0
stagger = "30s"
}
network {
port "portworx" {
static = "9015"
}
}
task "px-node" {
driver = "docker"
kill_timeout = "120s" # allow portworx 2 min to gracefully shut down
kill_signal = "SIGTERM" # use SIGTERM to shut down the nodes
# consul service check for portworx instances
service {
name = "portworx"
check {
port = "portworx"
type = "http"
path = "/health"
interval = "10s"
timeout = "2s"
}
}
# setup environment variables for px-nodes
env {
AUTO_NODE_RECOVERY_TIMEOUT_IN_SECS = "1500"
PX_TEMPLATE_VERSION = "V4"
CSI_ENDPOINT = "unix://var/lib/osd/csi/csi.sock"
}
csi_plugin {
id = "portworx"
type = "monolith"
mount_dir = "/var/lib/osd/csi"
}
# container config
config {
image = "portworx/oci-monitor:2.8.0"
network_mode = "host"
ipc_mode = "host"
privileged = true
args = [
"-c", "px-cluster-nomadv1",
"-a",
"-k", "consul://127.0.0.1:8500",
"--endpoint", "0.0.0.0:9015"
]
volumes = [
"/var/cores:/var/cores",
"/var/run/docker.sock:/var/run/docker.sock",
"/run/containerd:/run/containerd",
"/etc/pwx:/etc/pwx",
"/opt/pwx:/opt/pwx",
"/proc:/host_proc",
"/etc/systemd/system:/etc/systemd/system",
"/var/run/log:/var/run/log",
"/var/log:/var/log",
"/var/run/dbus:/var/run/dbus"
]
}
# resource config
resources {
cpu = 1024
memory = 2048
}
}
}
}

View File

@@ -0,0 +1,16 @@
id = "px-volume-1"
name = "database"
type = "csi"
plugin_id = "portworx"
capacity_min = "1G"
capacity_max = "1G"
capability {
access_mode = "single-node-reader-only"
attachment_mode = "file-system"
}
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}