- Documentation
Volcengine Kubernetes Engine
Volcengine Kubernetes Engine
Best practices
Scheduling
Injecting node labels or annotations into pods
Scheduling
Injecting node labels or annotations into pods
Injecting node labels or annotations into pods
This topic describes how to inject labels or annotations of a node into business-related pods to quickly identify the availability zone (AZ) of business applications.
Application scenarios
When a pod is created and the application starts, the pod needs to retrieve the corresponding AZ to optimize communication between services within the AZ. To support this, VKE allows you to add a specific label or annotation to the pod, and VKE will recognize this label or annotation and inject AZ information into the pod.
Notes
The following document mainly introduces the practices officially tested and verified. In order to achieve the expected results and comply with the Volcengine Kubernetes Engine (VKE) Limits, you must strictly follow the procedures (or the recommended resources) in this document. If you need to modify the procedures to suit your service requirements, contact the customer manager for consultation. Prerequisites
warning
This feature is only supported in clusters running one of the following Kubernetes versions:
- v1.24.15-vke.12 and later
- v1.20.15-vke.18 and later
If the Kubernetes version of your cluster does not meet this requirement, upgrade the control plane version first. Then follow the steps below to inject node annotations or labels into pods. For detailed operations, see Upgrading clusters. - In the clusters, the scheduler-plugin add-on has been installed. For detailed operations, refer to scheduler-plugin add-on.
- At least one node has been added to the cluster. For detailed operations, see Adding nodes.
Procedure
- View the annotation or label on the node of the cluster. The following figure shows a label with the key topology.kubernetes.io/zone as an example.
- In the VKE console, enter the details page of the target cluster and click Nodes > Node. Click the name of the target node to enter the Node details page and go to the Label tab to view node labels.
- Create a pod in the cluster. When you create the pod manifest, specify the key of the label or annotation to be injected. The key must match the key of the annotation or label on the node. The value supports the following options:
- required-injection_from-annotation: Indicates that the value of the node annotation with the key topology.kubernetes.io/zone is injected into the corresponding location in the pod.
- required-injection_from-label: Indicates that the value of the node label with the key topology.kubernetes.io/zone is injected into the corresponding location in the pod.
- After the pod is created, you can view the pod information via kubectl or the VKE console to verify that the corresponding value is injected into the label or annotation.
- Run the following command.
-
- In the VKE console, enter the details page of the target cluster and click Workload > Pod. Click the name of the target pod to enter the Pods details page and check information on the Overview tab.
Last updated: 2026.07.23 11:53:57