From 849e2bb78202b997b58eeb91dc8e5aa0fa3a2018 Mon Sep 17 00:00:00 2001 From: Etienne Menguy Date: Sat, 3 Jul 2021 20:58:07 +0200 Subject: [PATCH 1/5] Initial commit to add rbd and nomad integration documentation Signed-off-by: Etienne Menguy --- .organizationmap | 2 +- doc/rbd/rbd-nomad.rst | 431 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 432 insertions(+), 1 deletion(-) create mode 100644 doc/rbd/rbd-nomad.rst diff --git a/.organizationmap b/.organizationmap index 0169f117d032d..590f38f5de4fa 100644 --- a/.organizationmap +++ b/.organizationmap @@ -141,6 +141,7 @@ Corvisa LLC Walter Huf Credit Mutuel Arkea Eric Mourgaya Croit Fabian Bonk Croit Paul Emmerich +Croit Etienne Menguy CypressXt Networking Clément Hampaï Datatom Wang Yong Day By Day Gerben Meijer @@ -486,7 +487,6 @@ OpenSUSE Richard Brown Opower Derrick Schneider Oracle Nikita Gerasimov OVH Bartłomiej Święcki -OVH Etienne Menguy OVH Paweł Sadowski OVH Piotr Dałek Pacific Northwest National Laboratory Brown, David M JR diff --git a/doc/rbd/rbd-nomad.rst b/doc/rbd/rbd-nomad.rst new file mode 100644 index 0000000000000..a5cf4e245cf37 --- /dev/null +++ b/doc/rbd/rbd-nomad.rst @@ -0,0 +1,431 @@ +============================== + Block Devices and Nomad +============================== + +Like Kubernetes, Nomad can use Ceph Block Device thanks to `ceph-csi`_, +which allow to dinamacially provision RBD images or import existing one. + +Every nomad version can use `ceph-csi`_, however we'll here describe the +latest version available at writing time, Nomad v1.1.2 . + +To use Ceph Block Devices with Nomad, you must install +and configure ``ceph-csi`` within your Nomad environment. The following +diagram depicts the Nomad/Ceph technology stack. + +.. ditaa:: + +-------------------------+-------------------------+ + | Container | ceph--csi | + | | node | + | ^ | ^ | + | | | | | + +----------+--------------+-------------------------+ + | | | | + | v | | + | Nomad | | + | | | + +---------------------------------------------------+ + | ceph--csi | + | controller | + +--------+------------------------------------------+ + | | + | configures maps | + +---------------+ +----------------+ + | | + v v + +------------------------+ +------------------------+ + | | | rbd--nbd | + | Kernel Modules | +------------------------+ + | | | librbd | + +------------------------+-+------------------------+ + | RADOS Protocol | + +------------------------+-+------------------------+ + | OSDs | | Monitors | + +------------------------+ +------------------------+ + +.. note:: + Nomad has many task drivers, but we'll only use a Docker container in this example. + +.. important:: + ``ceph-csi`` uses the RBD kernel modules by default which may not support all + Ceph `CRUSH tunables`_ or `RBD image features`_. + +Create a Pool +============= + +By default, Ceph block devices use the ``rbd`` pool. Create a pool for +Nopmad persistent storage. Ensure your Ceph cluster is running, then create +the pool. :: + + $ ceph osd pool create nomad + +See `Create a Pool`_ for details on specifying the number of placement groups +for your pools, and `Placement Groups`_ for details on the number of placement +groups you should set for your pools. + +A newly created pool must be initialized prior to use. Use the ``rbd`` tool +to initialize the pool:: + + $ rbd pool init nomad + +Configure ceph-csi +================== + +Setup Ceph Client Authentication +-------------------------------- + +Create a new user for nomad and `ceph-csi`. Execute the following and +record the generated key:: + + $ ceph auth get-or-create client.nomad mon 'profile rbd' osd 'profile rbd pool=nomad' mgr 'profile rbd pool=nomad' + [client.nomad] + key = AQAlh9Rgg2vrDxAARy25T7KHabs6iskSHpAEAQ== + + +Configure Nomad +--------------- + +By default Nomad doesn't allow containers to use privileged mode. +Edit the nomad configuration file by adding this configuration block to `/etc/nomad.d/nomad.hcl`:: + + plugin "docker" { + config { + allow_privileged = true + } + } + + +Nomad must have `rbd` module loaded, check if it's the case.:: + + $ lsmod |grep rbd + rbd 94208 2 + libceph 364544 1 rbd + +If it's not the case, load it.:: + + $ modprobe rbd + +And restart Nomad. + + + +Create ceph-csi controller and plugin nodes +=========================================== + +The `ceph-csi`_ plugin requieres two components: + +- **Controller plugin**: Communicates with the provider's API. +- **Node plugin**: execute tasks on the client. + +.. note:: + We'll set the ceph-csi's version in those files see `ceph-csi release`_ for other versions. + +Configure controller plugin +--------------------------- + +The controller plugin requires Cpeh monitor addresses of for the Ceph cluster. +Collect both the Ceph cluster unique `fsid` and the monitor addresses:: + + $ ceph mon dump + <...> + fsid b9127830-b0cc-4e34-aa47-9d1a2e9949a8 + <...> + 0: [v2:192.168.1.1:3300/0,v1:192.168.1.1:6789/0] mon.a + 1: [v2:192.168.1.2:3300/0,v1:192.168.1.2:6789/0] mon.b + 2: [v2:192.168.1.3:3300/0,v1:192.168.1.3:6789/0] mon.c + +Generate a `ceph-csi-plugin-controller.nomad` file similar to the example below, substituting +the `fsid` for "clusterID", and the monitor addresses for "monitors":: + + + job "ceph-csi-plugin-controller" { + datacenters = ["dc1"] + group "controller" { + network { + port "metrics" {} + } + task "ceph-controller" { + template { + data = < Date: Sat, 3 Jul 2021 22:36:14 +0200 Subject: [PATCH 2/5] Adding rbd-nomad to the index Signed-off-by: Etienne Menguy --- doc/rbd/rbd-integrations.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/rbd/rbd-integrations.rst b/doc/rbd/rbd-integrations.rst index 50d788d53973b..f55604a6fcf7c 100644 --- a/doc/rbd/rbd-integrations.rst +++ b/doc/rbd/rbd-integrations.rst @@ -9,6 +9,7 @@ QEMU libvirt Kubernetes + Nomad OpenStack CloudStack LIO iSCSI Gateway From 0a2a461a0c5c5d8ffb51e578b782fe8bb66da7b2 Mon Sep 17 00:00:00 2001 From: Etienne Menguy Date: Wed, 7 Jul 2021 10:13:22 +0200 Subject: [PATCH 3/5] Fixing typo Signed-off-by: Etienne Menguy --- doc/rbd/rbd-nomad.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rbd/rbd-nomad.rst b/doc/rbd/rbd-nomad.rst index a5cf4e245cf37..1c799d79282d4 100644 --- a/doc/rbd/rbd-nomad.rst +++ b/doc/rbd/rbd-nomad.rst @@ -3,7 +3,7 @@ ============================== Like Kubernetes, Nomad can use Ceph Block Device thanks to `ceph-csi`_, -which allow to dinamacially provision RBD images or import existing one. +which allow to dynamically provision RBD images or import existing one. Every nomad version can use `ceph-csi`_, however we'll here describe the latest version available at writing time, Nomad v1.1.2 . From a335ee96ab4ee621e7e4d47d65ddf9c27c4a5521 Mon Sep 17 00:00:00 2001 From: Etienne Menguy Date: Wed, 7 Jul 2021 10:14:12 +0200 Subject: [PATCH 4/5] Adding missing sudo Signed-off-by: Etienne Menguy --- doc/rbd/rbd-nomad.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rbd/rbd-nomad.rst b/doc/rbd/rbd-nomad.rst index 1c799d79282d4..7e8d0c1535382 100644 --- a/doc/rbd/rbd-nomad.rst +++ b/doc/rbd/rbd-nomad.rst @@ -102,7 +102,7 @@ Nomad must have `rbd` module loaded, check if it's the case.:: If it's not the case, load it.:: - $ modprobe rbd + $ sudo modprobe rbd And restart Nomad. From c20a37698d89343c358fd7d733a9ed1c61a44f74 Mon Sep 17 00:00:00 2001 From: Etienne Menguy Date: Wed, 7 Jul 2021 10:26:21 +0200 Subject: [PATCH 5/5] Improving syntax Signed-off-by: Etienne Menguy --- doc/rbd/rbd-nomad.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/rbd/rbd-nomad.rst b/doc/rbd/rbd-nomad.rst index 7e8d0c1535382..427b2c6fa1146 100644 --- a/doc/rbd/rbd-nomad.rst +++ b/doc/rbd/rbd-nomad.rst @@ -1,6 +1,6 @@ -============================== +========================= Block Devices and Nomad -============================== +========================= Like Kubernetes, Nomad can use Ceph Block Device thanks to `ceph-csi`_, which allow to dynamically provision RBD images or import existing one.