Labels and Annotations
Pod Annotations
CCE allows you to add annotations to a YAML file to realize some advanced pod functions. The following table describes the annotations you can add.
Annotation |
Description |
Default Value |
---|---|---|
kubernetes.AOM.log.stdout |
Standard output parameter. If not specified, the standard log output of all containers is reported to AOM. You can collect stdout logs from certain containers or ignore them at all. Example:
|
None |
metrics.alpha.kubernetes.io/custom-endpoints |
Parameter for reporting AOM monitoring metrics that you specify. For details, see Monitoring Custom Metrics on AOM. |
None |
prometheus.io/scrape |
Parameter for reporting Prometheus metrics. If the value is true, the current workload reports the monitoring metrics. For details, see Monitoring Custom Metrics Using Cloud Native Cluster Monitoring. |
None |
prometheus.io/path |
URL for Prometheus to collect data. For details, see Monitoring Custom Metrics Using Cloud Native Cluster Monitoring. |
/metrics |
prometheus.io/port |
Endpoint port number for Prometheus to collect data. For details, see Monitoring Custom Metrics Using Cloud Native Cluster Monitoring. |
None |
prometheus.io/scheme |
Protocol used by Prometheus to collect data. The value can be http or https. For details, see Monitoring Custom Metrics Using Cloud Native Cluster Monitoring. |
None |
kubernetes.io/ingress-bandwidth |
Ingress bandwidth of a pod. For details, see Configuring QoS for a Pod. |
None |
kubernetes.io/egress-bandwidth |
Egress bandwidth of a pod. For details, see Configuring QoS for a Pod. |
None |
Pod Labels
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: ...
You can also add other labels to the pod for affinity and anti-affinity scheduling. In the following figure, three pod labels (release, env, and role) are defined for workload 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]
For example, if key/value is set to role/backend, APP 3 will be selected for affinity scheduling. For details, see Workload Affinity (podAffinity).
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot