Updated on 2024-09-27 GMT+08:00

Label Overview

Labels are used to identify cloud resources. When you have multiple cloud resources of the same type, you can use labels to classify them based on usage, owner, or environment. Each label contains a key and a value. Labels are attached to resources in the format of "key:value".

The following describes how to manage labels of a container-deployed stateless workload. Workload labels are often used for affinity and anti-affinity scheduling. For details, see Configuring a Scheduling Policy of a Component Instance. You can add labels to multiple workloads or a specified workload.

You can manage the labels of stateless workloads, stateful workloads, and Daemon sets based on service requirements. This section uses stateless workloads as an example to describe how to manage labels.

In the following figure, labels release, env, and role are defined for workloads APP 1, APP 2, and APP 3. The values of these labels vary with workload.

  • APP 1: [release:alpha;env:development;role:frontend]
  • APP 2: [release:beta;env:testing;role:frontend]
  • APP 3: [release:alpha;env:production;role:backend]

If you set key to role and value to frontend when using workload scheduling or another function, APP 1 and APP 2 will be selected.

Figure 1 Label example