open-nomad/demo/csi/hostpath
Seth Hoenig 65f7abf2f4 cli: update default redis and use nomad service discovery
Closes #12927
Closes #12958

This PR updates the version of redis used in our examples from 3.2 to 7.
The old version is very not supported anymore, and we should be setting
a good example by using a supported version.

The long-form example job is now fixed so that the service stanza uses
nomad as the service discovery provider, and so now the job runs without
a requirement of having Consul running and configured.
2022-05-17 10:24:19 -05:00
..
hostpath.hcl hclfmt hostpath.hcl 2021-04-09 12:15:49 -04:00
plugin.nomad CSI: set plugin CSI_ENDPOINT env var only if unset by user (#12257) 2022-03-21 11:48:47 -04:00
README.md docs: note demos/csi is unsupported 2021-09-28 11:11:19 -07:00
redis.nomad cli: update default redis and use nomad service discovery 2022-05-17 10:24:19 -05:00
run.sh scripts: fix interpreter for bash (#12549) 2022-04-12 10:08:21 -04:00

Hostpath CSI Plugin

Author: @hashicorp/nomad-eng

This directory includes a demo using the CSI host path driver to create local "host path" volumes that can be mounted via the Nomad CSI implementation.

What Is This For?

The hostpath plugin is for demonstration and development purposes only. It shouldn't be used for production. If you want to get a quick idea of how CSI works on Nomad in a Vagrant environment, this demo is a good option.

Requirements

  • A running Nomad cluster with docker.privileged.enabled = true. The Nomad developer Vagrantfile in this repo is suitable.

Running the run.sh script in this directory will output the Nomad command used to run the demo, as well as their outputs:

$ nomad job run ./plugin.nomad
==> Monitoring evaluation "7ac3cc8d"
    Evaluation triggered by job "csi-plugin"
    Allocation "bbd34b72" created: node "917b009b", group "csi"
==> Monitoring evaluation "7ac3cc8d"
    Allocation "bbd34b72" status changed: "pending" -> "running" (Tasks are running)
    Evaluation status changed: "pending" -> "complete"
==> Evaluation "7ac3cc8d" finished with status "complete"
Nodes Healthy        = 1

$ nomad plugin status hostpath
ID                   = hostpath-plugin0
Provider             = csi-hostpath
Version              = v1.2.0-0-g83590990
Controllers Healthy  = 1
Controllers Expected = 1
Nodes Healthy        = 1
Nodes Expected       = 1

Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created  Modified
bbd34b72  917b009b  csi         0        run      running  3s ago   2s ago

$ cat hostpath.hcl | sed | nomad volume create -
Created external volume 7185cd16-993f-11eb-a052-0242ac110002 with ID test-volume[0]

$ cat hostpath.hcl | sed | nomad volume create -
Created external volume 718bd6b4-993f-11eb-a052-0242ac110002 with ID test-volume[1]

$ nomad job run ./redis.nomad
==> Monitoring evaluation "3178513e"
    Evaluation triggered by job "example"
    Evaluation within deployment: "ffb161f4"
    Allocation "139caa78" created: node "917b009b", group "cache"
    Allocation "5e1b57f5" created: node "917b009b", group "cache"
    Evaluation status changed: "pending" -> "complete"
==> Evaluation "3178513e" finished with status "complete"

$ nomad volume status
Container Storage Interface
ID              Name            Plugin ID         Schedulable  Access Mode
test-volume[0]  test-volume[0]  hostpath-plugin0  true         single-node-reader-only
test-volume[1]  test-volume[1]  hostpath-plugin0  true         single-node-reader-only