Updated on 2023-08-03 GMT+08:00

Managing Node Labels

You can add different labels to nodes and define different attributes for labels. By using these node labels, you can quickly understand the characteristics of each node.

Node Label Usage Scenarios

Node labels are mainly used in the following scenarios:

  • Node management: Node labels are used to classify nodes.
  • Affinity and anti-affinity between workloads and nodes:
    • Different workloads have different resource requirements such as CPU, memory, and I/O. If a workload consumes too many resources in a cluster, other workloads in the same cluster may fail to run properly. In this case, you are advised to add different labels to nodes. When deploying a workload, you can configure node affinity and anti-affinity based on node labels.
    • A system can be divided into multiple modules. Each module consists of multiple microservices. To ensure efficient O&M, you can add a module label to each node so that each module can be deployed on the corresponding node. In this way, modules do not interfere with each other and microservices can be easily maintained on their nodes.

Inherent Node Labels

After a node is created, some inherent labels are generated for the node. These labels cannot be edited or deleted. Table 1 describes these labels.

Table 1 Inherent labels of a node

Key

Value

failure-domain.beta.kubernetes.io/region

Indicates the region where the node is located.

failure-domain.beta.kubernetes.io/zone

Indicates the AZ where the node is located.

beta.kubernetes.io/arch

Indicates the processor architecture of the node.

For example, amd64 indicates a AMD64-bit processor.

beta.kubernetes.io/os

Indicates the operating system of the node.

For example, linux indicates that the node uses Linux as its operating system.

kubernetes.io/availablezone

Indicates the AZ where the node is located.

kubernetes.io/hostname

Indicates the host name of the node.

os.architecture

Indicates the processor architecture of the node.

For example, amd64 indicates a AMD64-bit processor.

os.name

Indicates the operating system name of the node.

For example, EulerOS_2.0_SP2 indicates that the node uses EulerOS 2.2 as its operating system.

os.version

Indicates the kernel version of the node.

Adding a Node Label

  1. Log in to the cluster console. In the navigation pane, choose Cluster Overview. On the Nodes tab page, click Manage Label in the row where the node to be added with labels resides.
  2. Click Add Label, enter a key and value, and click OK.

    As shown in the following figure, enter deploy_qa for Key and true for Value, and click OK.

    Figure 1 Adding a label

Deleting a Node Label

Only labels added by users can be deleted. Those inherent node labels cannot be deleted.

  1. Log in to the cluster console. In the navigation pane, choose Cluster Overview. On the Nodes tab page, click Manage Label in the row where the node whose labels are to be deleted resides.
  2. Click Delete in the row where the label to be deleted resides, and then click OK.