2 .. _orchestrator-cli-module:
8 This module provides a command line interface (CLI) to orchestrator
9 modules (ceph-mgr modules which interface with external orchestration services).
11 As the orchestrator CLI unifies different external orchestrators, a common nomenclature
12 for the orchestrator module is needed.
14 +--------------------------------------+---------------------------------------+
15 | *host* | hostname (not DNS name) of the |
16 | | physical host. Not the podname, |
17 | | container name, or hostname inside |
19 +--------------------------------------+---------------------------------------+
20 | *service type* | The type of the service. e.g., nfs, |
21 | | mds, osd, mon, rgw, mgr, iscsi |
22 +--------------------------------------+---------------------------------------+
23 | *service* | A logical service, Typically |
24 | | comprised of multiple service |
25 | | instances on multiple hosts for HA |
27 | | * ``fs_name`` for mds type |
28 | | * ``rgw_zone`` for rgw type |
29 | | * ``ganesha_cluster_id`` for nfs type |
30 +--------------------------------------+---------------------------------------+
31 | *daemon* | A single instance of a service. |
32 | | Usually a daemon, but maybe not |
33 | | (e.g., might be a kernel service |
34 | | like LIO or knfsd or whatever) |
36 | | This identifier should |
37 | | uniquely identify the instance |
38 +--------------------------------------+---------------------------------------+
40 The relation between the names is the following:
42 * A *service* has a specific *service type*
43 * A *daemon* is a physical instance of a *service type*
48 Orchestrator modules may only implement a subset of the commands listed below.
49 Also, the implementation of the commands may differ between modules.
58 Show current orchestrator mode and high-level status (whether the orchestrator
59 plugin is available and operational)
64 List hosts associated with the cluster::
68 Add and remove hosts::
70 ceph orch host add <hostname> [<addr>] [<labels>...]
71 ceph orch host rm <hostname>
73 For cephadm, see also :ref:`cephadm-fqdn`.
78 Many hosts can be added at once using
79 ``ceph orch apply -i`` by submitting a multi-document YAML file::
99 This can be combined with service specifications (below) to create a cluster spec file to deploy a whole cluster in one command. see ``cephadm bootstrap --apply-spec`` also to do this during bootstrap. Cluster SSH Keys must be copied to hosts prior to adding them.
107 Print a list of discovered devices, grouped by host and optionally
108 filtered to a particular host:
112 ceph orch device ls [--host=...] [--refresh]
116 HOST PATH TYPE SIZE DEVICE AVAIL REJECT REASONS
117 master /dev/vda hdd 42.0G False locked
118 node1 /dev/vda hdd 42.0G False locked
119 node1 /dev/vdb hdd 8192M 387836 False locked, LVM detected, Insufficient space (<5GB) on vgs
120 node1 /dev/vdc hdd 8192M 450575 False locked, LVM detected, Insufficient space (<5GB) on vgs
121 node3 /dev/vda hdd 42.0G False locked
122 node3 /dev/vdb hdd 8192M 395145 False LVM detected, locked, Insufficient space (<5GB) on vgs
123 node3 /dev/vdc hdd 8192M 165562 False LVM detected, locked, Insufficient space (<5GB) on vgs
124 node2 /dev/vda hdd 42.0G False locked
125 node2 /dev/vdb hdd 8192M 672147 False LVM detected, Insufficient space (<5GB) on vgs, locked
126 node2 /dev/vdc hdd 8192M 228094 False LVM detected, Insufficient space (<5GB) on vgs, locked
131 Erase Devices (Zap Devices)
132 ---------------------------
134 Erase (zap) a device so that it can be reused. ``zap`` calls ``ceph-volume zap`` on the remote host.
138 orch device zap <hostname> <path>
142 ceph orch device zap my_hostname /dev/sdx
145 Cephadm orchestrator will automatically deploy drives that match the DriveGroup in your OSDSpec if the unmanaged flag is unset.
146 For example, if you use the ``all-available-devices`` option when creating OSDs, when you ``zap`` a device the cephadm orchestrator will automatically create a new OSD in the device .
147 To disable this behavior, see :ref:`orchestrator-cli-create-osds`.
149 .. _orchestrator-cli-create-osds:
154 Create OSDs on a set of devices on a single host::
156 ceph orch daemon add osd <host>:device1,device2
158 Another way of doing it is using ``apply`` interface::
160 ceph orch apply osd -i <json_file/yaml_file> [--dry-run]
162 where the ``json_file/yaml_file`` is a DriveGroup specification.
163 For a more in-depth guide to DriveGroups please refer to :ref:`drivegroups`
165 ``dry-run`` will cause the orchestrator to present a preview of what will happen
166 without actually creating the OSDs.
170 # ceph orch apply osd --all-available-devices --dry-run
171 NAME HOST DATA DB WAL
172 all-available-devices node1 /dev/vdb - -
173 all-available-devices node2 /dev/vdc - -
174 all-available-devices node3 /dev/vdd - -
176 When the parameter ``all-available-devices`` or a DriveGroup specification is used, a cephadm service is created.
177 This service guarantees that all available devices or devices included in the DriveGroup will be used for OSDs.
178 Note that the effect of ``--all-available-devices`` is persistent; that is, drives which are added to the system
179 or become available (say, by zapping) after the command is complete will be automatically found and added to the cluster.
181 That is, after using::
183 ceph orch apply osd --all-available-devices
185 * If you add new disks to the cluster they will automatically be used to create new OSDs.
186 * A new OSD will be created automatically if you remove an OSD and clean the LVM physical volume.
188 If you want to avoid this behavior (disable automatic creation of OSD on available devices), use the ``unmanaged`` parameter::
190 ceph orch apply osd --all-available-devices --unmanaged=true
196 ceph orch osd rm <osd_id(s)> [--replace] [--force]
198 Evacuates PGs from an OSD and removes it from the cluster.
203 Scheduled OSD(s) for removal
206 OSDs that are not safe-to-destroy will be rejected.
208 You can query the state of the operation with::
210 # ceph orch osd rm status
211 OSD_ID HOST STATE PG_COUNT REPLACE FORCE STARTED_AT
212 2 cephadm-dev done, waiting for purge 0 True False 2020-07-17 13:01:43.147684
213 3 cephadm-dev draining 17 False True 2020-07-17 13:01:45.162158
214 4 cephadm-dev started 42 False True 2020-07-17 13:01:45.162158
217 When no PGs are left on the OSD, it will be decommissioned and removed from the cluster.
220 After removing an OSD, if you wipe the LVM physical volume in the device used by the removed OSD, a new OSD will be created.
221 Read information about the ``unmanaged`` parameter in :ref:`orchestrator-cli-create-osds`.
226 You can stop the queued OSD removal operation with
230 ceph orch osd rm stop <svc_id(s)>
234 # ceph orch osd rm stop 4
235 Stopped OSD(s) removal
237 This will reset the initial state of the OSD and take it off the removal queue.
244 orch osd rm <svc_id(s)> --replace [--force]
248 # ceph orch osd rm 4 --replace
249 Scheduled OSD(s) for replacement
252 This follows the same procedure as the "Remove OSD" part with the exception that the OSD is not permanently removed
253 from the CRUSH hierarchy, but is assigned a 'destroyed' flag.
255 **Preserving the OSD ID**
257 The previously-set 'destroyed' flag is used to determine OSD ids that will be reused in the next OSD deployment.
259 If you use OSDSpecs for OSD deployment, your newly added disks will be assigned the OSD ids of their replaced
260 counterparts, assuming the new disks still match the OSDSpecs.
262 For assistance in this process you can use the '--dry-run' feature.
264 Tip: The name of your OSDSpec can be retrieved from **ceph orch ls**
266 Alternatively, you can use your OSDSpec file::
268 ceph orch apply osd -i <osd_spec_file> --dry-run
269 NAME HOST DATA DB WAL
270 <name_of_osd_spec> node1 /dev/vdb - -
273 If this matches your anticipated behavior, just omit the --dry-run flag to execute the deployment.
277 Turn On Device Lights
278 ^^^^^^^^^^^^^^^^^^^^^
281 ceph orch device ident-on <dev_id>
282 ceph orch device ident-on <dev_name> <host>
283 ceph orch device fault-on <dev_id>
284 ceph orch device fault-on <dev_name> <host>
286 ceph orch device ident-off <dev_id> [--force=true]
287 ceph orch device ident-off <dev_id> <host> [--force=true]
288 ceph orch device fault-off <dev_id> [--force=true]
289 ceph orch device fault-off <dev_id> <host> [--force=true]
291 where ``dev_id`` is the device id as listed in ``osd metadata``,
292 ``dev_name`` is the name of the device on the system and ``host`` is the host as
293 returned by ``orchestrator host ls``
295 ceph orch osd ident-on {primary,journal,db,wal,all} <osd-id>
296 ceph orch osd ident-off {primary,journal,db,wal,all} <osd-id>
297 ceph orch osd fault-on {primary,journal,db,wal,all} <osd-id>
298 ceph orch osd fault-off {primary,journal,db,wal,all} <osd-id>
300 where ``journal`` is the filestore journal device, ``wal`` is the bluestore
301 write ahead log device, and ``all`` stands for all devices associated with the OSD
304 Monitor and manager management
305 ==============================
307 Creates or removes MONs or MGRs from the cluster. Orchestrator may return an
308 error if it doesn't know how to do this transition.
310 Update the number of monitor hosts::
312 ceph orch apply mon --placement=<placement> [--dry-run]
314 Where ``placement`` is a :ref:`orchestrator-cli-placement-spec`.
316 Each host can optionally specify a network for the monitor to listen on.
318 Update the number of manager hosts::
320 ceph orch apply mgr --placement=<placement> [--dry-run]
322 Where ``placement`` is a :ref:`orchestrator-cli-placement-spec`.
327 The host lists are the new full list of mon/mgr hosts
331 specifying hosts is optional for some orchestrator modules
332 and mandatory for others (e.g. Ansible).
338 Print a list of services known to the orchestrator. The list can be limited to
339 services on a particular host with the optional --host parameter and/or
340 services of a particular type via optional --type parameter
341 (mon, osd, mgr, mds, rgw):
345 ceph orch ls [--service_type type] [--service_name name] [--export] [--format f] [--refresh]
347 Discover the status of a particular service or daemons::
349 ceph orch ls --service_type type --service_name <name> [--refresh]
351 Export the service specs known to the orchestrator as yaml in format
352 that is compatible to ``ceph orch apply -i``::
354 ceph orch ls --export
360 Print a list of all daemons known to the orchestrator::
362 ceph orch ps [--hostname host] [--daemon_type type] [--service_name name] [--daemon_id id] [--format f] [--refresh]
364 Query the status of a particular service instance (mon, osd, mds, rgw). For OSDs
365 the id is the numeric OSD ID, for MDS services it is the file system name::
367 ceph orch ps --daemon_type osd --daemon_id 0
370 .. _orchestrator-cli-cephfs:
375 In order to set up a :term:`CephFS`, execute::
377 ceph fs volume create <fs_name> <placement spec>
379 where ``name`` is the name of the CephFS and ``placement`` is a
380 :ref:`orchestrator-cli-placement-spec`.
382 This command will create the required Ceph pools, create the new
383 CephFS, and deploy mds servers.
386 .. _orchestrator-cli-stateless-services:
388 Stateless services (MDS/RGW/NFS/rbd-mirror/iSCSI)
389 =================================================
391 (Please note: The orchestrator will not configure the services. Please look into the corresponding
392 documentation for service configuration details.)
394 The ``name`` parameter is an identifier of the group of instances:
396 * a CephFS file system for a group of MDS daemons,
397 * a zone name for a group of RGWs
399 Creating/growing/shrinking/removing services::
401 ceph orch apply mds <fs_name> [--placement=<placement>] [--dry-run]
402 ceph orch apply rgw <realm> <zone> [--subcluster=<subcluster>] [--port=<port>] [--ssl] [--placement=<placement>] [--dry-run]
403 ceph orch apply nfs <name> <pool> [--namespace=<namespace>] [--placement=<placement>] [--dry-run]
404 ceph orch rm <service_name> [--force]
406 where ``placement`` is a :ref:`orchestrator-cli-placement-spec`.
408 e.g., ``ceph orch apply mds myfs --placement="3 host1 host2 host3"``
412 ceph orch <start|stop|restart|redeploy|reconfig> <service_name>
414 Deploying custom containers
415 ===========================
417 The orchestrator enables custom containers to be deployed using a YAML file.
418 A corresponding :ref:`orchestrator-cli-service-spec` must look like:
422 service_type: container
426 image: docker.io/library/foo:latest
427 entrypoint: /usr/bin/foo
444 - ['type=bind', 'source=lib/modules', 'destination=/lib/modules', 'ro=true']
453 where the properties of a service specification are:
456 A unique name of the service.
458 The name of the Docker image.
460 The UID to use when creating directories and files in the host system.
462 The GID to use when creating directories and files in the host system.
464 Overwrite the default ENTRYPOINT of the image.
466 A list of additional Podman/Docker command line arguments.
468 A list of TCP ports to open in the host firewall.
470 A list of environment variables.
472 When you use a bind mount, a file or directory on the host machine
473 is mounted into the container. Relative `source=...` paths will be
474 located below `/var/lib/ceph/<cluster-fsid>/<daemon-name>`.
476 When you use a volume mount, a new directory is created within
477 Docker’s storage directory on the host machine, and Docker manages
478 that directory’s contents. Relative source paths will be located below
479 `/var/lib/ceph/<cluster-fsid>/<daemon-name>`.
481 A list of directories that are created below
482 `/var/lib/ceph/<cluster-fsid>/<daemon-name>`.
484 A dictionary, where the key is the relative path of the file and the
485 value the file content. The content must be double quoted when using
486 a string. Use '\\n' for line breaks in that case. Otherwise define
487 multi-line content as list of strings. The given files will be created
488 below the directory `/var/lib/ceph/<cluster-fsid>/<daemon-name>`.
489 The absolute path of the directory where the file will be created must
490 exist. Use the `dirs` property to create them if necessary.
492 .. _orchestrator-cli-service-spec:
494 Service Specification
495 =====================
497 A *Service Specification* is a data structure represented as YAML
498 to specify the deployment of services. For example:
503 service_id: realm.zone
512 where the properties of a service specification are:
515 The type of the service. Needs to be either a Ceph
516 service (``mon``, ``crash``, ``mds``, ``mgr``, ``osd`` or
517 ``rbd-mirror``), a gateway (``nfs`` or ``rgw``), part of the
518 monitoring stack (``alertmanager``, ``grafana``, ``node-exporter`` or
519 ``prometheus``) or (``container``) for custom containers.
521 The name of the service.
523 See :ref:`orchestrator-cli-placement-spec`.
525 If set to ``true``, the orchestrator will not deploy nor
526 remove any daemon associated with this service. Placement and all other
527 properties will be ignored. This is useful, if this service should not
528 be managed temporarily.
530 Each service type can have additional service specific properties.
532 Service specifications of type ``mon``, ``mgr``, and the monitoring
533 types do not require a ``service_id``.
535 A service of type ``nfs`` requires a pool name and may contain
536 an optional namespace:
548 namespace: mynamespace
550 where ``pool`` is a RADOS pool where NFS client recovery data is stored
551 and ``namespace`` is a RADOS namespace where NFS client recovery
552 data is stored in the pool.
554 A service of type ``osd`` is described in :ref:`drivegroups`
556 Many service specifications can be applied at once using
557 ``ceph orch apply -i`` by submitting a multi-document YAML file::
559 cat <<EOF | ceph orch apply -i -
569 service_id: default_drive_group
576 .. _orchestrator-cli-placement-spec:
578 Placement Specification
579 =======================
581 For the orchestrator to deploy a *service*, it needs to know where to deploy
582 *daemons*, and how many to deploy. This is the role of a placement
583 specification. Placement specifications can either be passed as command line arguments
589 Daemons can be explicitly placed on hosts by simply specifying them::
591 orch apply prometheus --placement="host1 host2 host3"
597 service_type: prometheus
604 MONs and other services may require some enhanced network specifications::
606 orch daemon add mon --placement="myhost:[v2:1.2.3.4:3000,v1:1.2.3.4:6789]=name"
608 where ``[v2:1.2.3.4:3000,v1:1.2.3.4:6789]`` is the network address of the monitor
609 and ``=name`` specifies the name of the new monitor.
614 Daemons can be explictly placed on hosts that match a specific label::
616 orch apply prometheus --placement="label:mylabel"
622 service_type: prometheus
627 Placement by pattern matching
628 -----------------------------
630 Daemons can be placed on hosts as well::
632 orch apply prometheus --placement='myhost[1-3]'
638 service_type: prometheus
640 host_pattern: "myhost[1-3]"
642 To place a service on *all* hosts, use ``"*"``::
644 orch apply crash --placement='*'
650 service_type: node-exporter
658 By specifying ``count``, only that number of daemons will be created::
660 orch apply prometheus --placement=3
662 To deploy *daemons* on a subset of hosts, also specify the count::
664 orch apply prometheus --placement="2 host1 host2 host3"
666 If the count is bigger than the amount of hosts, cephadm deploys one per host::
668 orch apply prometheus --placement="3 host1 host2"
670 results in two Prometheus daemons.
676 service_type: prometheus
684 service_type: prometheus
692 Updating Service Specifications
693 ===============================
695 The Ceph Orchestrator maintains a declarative state of each
696 service in a ``ServiceSpec``. For certain operations, like updating
697 the RGW HTTP port, we need to update the existing
700 1. List the current ``ServiceSpec``::
702 ceph orch ls --service_name=<service-name> --export > myservice.yaml
704 2. Update the yaml file::
708 3. Apply the new ``ServiceSpec``::
710 ceph orch apply -i myservice.yaml [--dry-run]
712 Configuring the Orchestrator CLI
713 ================================
715 To enable the orchestrator, select the orchestrator module to use
716 with the ``set backend`` command::
718 ceph orch set backend <module>
720 For example, to enable the Rook orchestrator module and use it with the CLI::
722 ceph mgr module enable rook
723 ceph orch set backend rook
725 Check the backend is properly configured::
729 Disable the Orchestrator
730 ------------------------
732 To disable the orchestrator, use the empty string ``""``::
734 ceph orch set backend ""
735 ceph mgr module disable rook
737 Current Implementation Status
738 =============================
740 This is an overview of the current implementation status of the orchestrators.
742 =================================== ====== =========
744 =================================== ====== =========
758 daemon {stop,start,...} ⚪ ✔
759 device {ident,fault}-(on,off} ⚪ ✔
767 =================================== ====== =========
771 * ⚪ = not yet implemented