Updated on 2024-10-17 GMT+08:00

Configuring Labels and Annotations

Pod Annotations

CCE Autopilot clusters provide multiple advanced functions during pod creation. To enable these functions, you can add annotations to pods on the console or using YAML. Table 1 describes the available annotations.

Table 1 Pod annotations

Function and Reference

Annotation

Example Value

Description

Configuring QoS for a Pod

kubernetes.io/ingress-bandwidth

100M

Indicates the ingress bandwidth of a pod.

This annotation controls the rate at which a pod receives data to ensure that the pod can process external requests.

kubernetes.io/egress-bandwidth

100M

Indicates the egress bandwidth of a pod.

This annotation controls the rate at which a pod sends data to external systems. This affects the efficiency of communication between the pod and external services or users.

Setting AZ Affinity

node.cce.io/node-az-list

cn-east-3a,cn-east-3b

Lists the AZs for pod affinity.

For a CCE Autopilot cluster, you can use workload annotations to implement AZ affinity and schedule pods to specified AZs.

Pod Labels

You can use pod labels to organize, select, and manage resources for pods to make it easy to use and maintain resources.

When you create a workload on the console, the following labels are added to the pod by default. The value of app is the workload name.

Example YAML:

...
spec:
  selector:
    matchLabels:
      app: nginx
      version: v1
  template:
    metadata:
      labels:
        app: nginx
        version: v1
    spec:
      ...