Kubernetes uses labels and taints to manage and schedule resources in clusters. Labels can be used to identify and classify Kubernetes resources, such as nodes. Taints can be used by nodes to repel specific pods.
For more information about the introduction and usage notes for labels, see Labels and Selectors. For more information about the usage notes and effects for taints and tolerations, see Taints and Tolerations. You can specify the following effects: NoSchedule, NoExecute, and PreferNoSchedule.
Create and manage node labels
Labels can be used to identify and classify nodes. Labels can also be used as selectors to select nodes for operations.
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side navigation pane, choose .
Click Manage Labels and Taints. On the Manage Labels and Taints page, click the Labels tab. On the Labels tab, select the nodes that you want to manage and click Add Label. In the Add dialog box, set the Name and Value parameters based on the on-screen instructions.
After you add labels, you can view all the labels that are added to the node in the Labels column. You can also perform the following operations in the Labels column:
Click a label to filter nodes and display nodes that have the label.
Click the
icon of a label to delete the label.
NoteSpecific Kubernetes-native labels cannot be deleted. If you delete such a label, the system automatically re-adds the label to the node.
Create and manage node taints
Taints can be used by nodes to repel specific pods. If you want to schedule a pod to a node with a taint, you must add a toleration that matches the taint to the node. Use scenarios:
You want to select a group of nodes that are dedicated to specific users or workloads.
You want to ensure that only pods that require specific hardware resources are scheduled to nodes that have the hardware resources. For example, you want to ensure that only pods that require GPU resources are scheduled to GPU-accelerated nodes.
You want to evict pods from a node by using taints. You can add the
NoExecute
taint to a node to evict pods from the node. If you want to retain a pod on the node, add the toleration that matches the NoExecute taint to the pod.
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the cluster that you want to manage and click its name. In the left-side navigation pane, choose .
Click Manage Labels and Taints. On the Manage Labels and Taints page, click the Taints tab. On the Taints tab, select the nodes that you want to manage and click Add Taint. In the Add dialog box, set the Name, Value, and Effect parameters based on the on-screen instructions.
For more information about the format and effect of taints, see Taints and Tolerations.
Parameter
Description
Name
The name must be 1 to 63 characters in length, and can contain letters, digits, hyphens (-), underscores (_), and periods (.). It must start and end with a letter or a digit.
If you want to specify a prefixed key, the prefix must be a subdomain name. A subdomain name consists of DNS labels that are separated by periods (.), and cannot exceed 253 characters in length. It must end with a forward slash (/).
Value
You can leave this parameter empty. The value cannot exceed 63 characters in length, and and contain letters, digits, hyphens (-), underscores (_), and periods (.). It must start and end with a letter or digit.
Effect
NoSchedule: If a node has a taint whose effect is NoSchedule, the system does not schedule pods to the node.
NoExecute: If a node has a taint whose effect is NoExecute, the system does not schedule pods to the node, and pods that do not have matching tolerations are evicted from the node.
PreferNoSchedule: If a node has a taint whose effect is PreferNoSchedule, the system attempts to avoid scheduling pods that not have matching tolerations to the node. This effect does not specify a hard requirement.
After you add taints, you can view all the taints that are added to the node in the Taints column. You can also perform the following operations in the Taints column:
Click a taint to filter nodes and display nodes that have the taint.
Click the
icon of a taint to delete the taint.
References
You can manage the labels and taints of nodes in a node pool in a centralized manner. For more information, see Create and manage a node pool.
You can configure a label as the node selector for an application to schedule the application to a node that has the label. For more information, see Schedule pods to specific nodes.
Container Service for Kubernetes (ACK) allows you to manage worker nodes in batches. For example, you can safely update the operating system kernel and install custom monitoring, security, and audit software packages on nodes in batches. For more information, see Manage nodes in batches.