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 --placement option 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

  1. Log into the Cephadm shell:

    Example

    [root@host01 ~]# cephadm shell
  2. 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 --placement option 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:

      1. Create the placement.yml file:

        Example

        [ceph: root@host01 /]# vi placement.yml
      2. Specify the service type and label in the placement.yml file:

        Example

        service_type: prometheus
        placement:
          label: "mylabel"
      3. Apply the daemon placement file:

        Syntax

        ceph orch apply -i FILENAME

        Example

        [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_NAME

    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