Using host labels to deploy daemons on specific hosts
You can use host labels to deploy daemons to specific hosts. There are two ways to use host labels to deploy daemons on specific hosts:
-
By using the
--placementoption from the command line. -
By using a YAML file.
Prerequisites
-
A storage cluster that has been installed and bootstrapped.
-
Root-level access to all nodes in the storage cluster.
Procedure
-
Log into the Cephadm shell:
Example
[root@host01 ~]# cephadm shell -
List current hosts and labels:
Example
[ceph: root@host01 /]# ceph orch host ls HOST ADDR LABELS STATUS host01 _admin,mon,osd,mgr host02 mon,osd,mgr,mylabel-
Method 1: Use the
--placementoption to deploy a daemon from the command line:Syntax
ceph orch apply DAEMON --placement="label:LABEL"Example
[ceph: root@host01 /]# ceph orch apply prometheus --placement="label:mylabel" -
Method 2: To assign the daemon to a specific host label in a YAML file, specify the service type and label in the YAML file:
-
Create the
placement.ymlfile:Example
[ceph: root@host01 /]# vi placement.yml -
Specify the service type and label in the
placement.ymlfile:Example
service_type: prometheus placement: label: "mylabel" -
Apply the daemon placement file:
Syntax
ceph orch apply -i FILENAMEExample
[ceph: root@host01 /]# ceph orch apply -i placement.yml Scheduled prometheus update…
-
-
Verification
-
List the status of the daemons:
Syntax
ceph orch ps --daemon_type=DAEMON_NAMEExample
[ceph: root@host01 /]# ceph orch ps --daemon_type=prometheus NAME HOST PORTS STATUS REFRESHED AGE MEM USE MEM LIM VERSION IMAGE ID CONTAINER ID prometheus.host02 host02 *:9095 running (2h) 8m ago 2h 85.3M - 2.22.2 ac25aac5d567 ad8c7593d7c0