Using host labels to deploy daemons on specific hosts

Use host labels to deploy daemons to specific hosts.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • An IBM Storage Ceph cluster is installed and bootstrapped.
  • Root-level access to all nodes in the storage cluster.

About this task

There are two ways to use host labels to deploy daemons on specific hosts:
  • By using a YAML service specification file.
    Note: Using the YAML file is the preferred method, as it aligns with Infrastructure as Code best practice.
  • By using the --placement option from the command line.

    For example, ceph orch apply DAEMON --placement="label:LABEL"

Deploying daemons from the command line

Procedure

  1. Log in to the cephadm shell.
    For example,
    [root@host01 ~]# cephadm shell
  2. List all current hosts and labels by using the ceph orch host ls command.
    For example,
    [ceph: root@host01 /]# ceph orch host ls
    
    HOST     ADDR     LABELS               STATUS
    host01   host01   _admin,mon,osd,mgr
    host02   host02   mon,osd,mgr,mylabel
  3. Use the --placement option to deploy a daemon from the command line.
    ceph orch apply DAEMON --placement="label:LABEL"
    For example,
    [ceph: root@host01 /]# ceph orch apply prometheus --placement="label:mylabel"

Deploying daemons with a YAML file

Procedure

  1. Log in to the cephadm shell.
    For example,
    [root@host01 ~]# cephadm shell
  2. List all current hosts and labels by using the ceph orch host ls command.
    For example,
    [ceph: root@host01 /]# ceph orch host ls
    
    HOST     ADDR     LABELS               STATUS
    host01   host01   _admin,mon,osd,mgr
    host02   host02   mon,osd,mgr,mylabel
  3. Assign the daemon to a specific host label in a YAML file.
    Be sure to specify the service type and label, by using your preferred text editor.
    1. Create the placement.yml file.
      For example,
      [ceph: root@host01 /]# vi placement.yml
    2. Specify the service type and label within the YAML file.
      service_type: prometheus
      placement:
        label: "mylabel"
    3. Apply the daemon placement file.
      ceph orch apply -i FILENAME
      For example,
      [ceph: root@host01 /]# ceph orch apply -i placement.yml
      Scheduled prometheus update…

What to do next

Verify the status of the daemons.
ceph orch ps --daemon_type=DAEMON_NAME
For example,
[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