tencent cloud

Tencent Kubernetes Engine

Service Annotation

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-08-20 11:07:58
Traduzido e Verificado por IA
You can configure the Service through the following Annotation to achieve richer capabilities of the load balancer.

Annotation Usage Instructions

apiVersion: v1
kind: Service
metadata:
annotations:
service.kubernetes.io/tke-existed-lbid: lb-6swtxxxx
name: test
........

Annotation Collection

service.kubernetes.io/loadbalance-id

Note: This read-only annotation provides the ID of the CLB instance referenced by the current Service. You can view the CLB instance ID in the same VPC as the cluster in the Tencent Cloud CLB console.


service.kubernetes.io/qcloud-loadbalancer-internal-subnetid

Note: Use this Annotation to specify creating an internal CLB instance, with the value set to a subnet ID.
Example:
service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxxxxx

service.kubernetes.io/tke-existed-lbid

Note: When using an existing CLB instance, pay attention to the impact of different usage methods on Tencent Cloud tags.
Example: For usage details, see Using Existing CLBs.

service.kubernetes.io/local-svc-only-bind-node-with-pod

Note: In Service Local mode, only nodes with running Pods are bound.
Example: For usage details, see Service Local Mode.


service.cloud.tencent.com/local-svc-weighted-balance

Note:
Use it together with the Annotation service.kubernetes.io/local-svc-only-bind-node-with-pod.
The weight of the CLB backend will be determined by the number of workloads on the node.
Example: For usage details, see Service Local Mode.


service.kubernetes.io/qcloud-loadbalancer-backends-label

Note: Specify the tag to set the nodes bound to the CLB backend.
Example: For usage details, see Specifying the Access-Layer Backend.


service.cloud.tencent.com/direct-access

Note: Use CLB to directly connect to Pods.
Example: For usage details, see Using Services with CLB-to-Pod Direct Access Mode.


service.cloud.tencent.com/tke-service-config

Note: Configure CLB through tke-service-config.
Example: For usage details, see Service CLB Configuration.


service.cloud.tencent.com/tke-service-config-auto

Note: This annotation can automatically create a TkeServiceConfig.


service.kubernetes.io/loadbalance-nat-ipv6

Note: This is a read-only annotation. When you create a NAT64 IPv6 CLB instance, the IPv6 address of the CLB instance will be displayed in the annotation.
Example:
service.kubernetes.io/loadbalance-nat-ipv6: "2402:4e00:1402:7200:0:9223:5842:2a44"


service.kubernetes.io/loadbalance-type (Deprecated)

Note:
Controls the type of automatically created CLBs: traditional CLBs or ALBs.
Optional values: yunapi_clb (traditional), classic (traditional), yunapiv3_forward_clb (application).
Default value: yunapiv3_forward_clb (application).
Attention:
Unless there is a special reason, traditional CLBs are not recommended because they have stopped iteration and are scheduled for discontinuation, and they lack many features.


service.cloud.tencent.com/specify-protocol

Note: You can configure TCP, UDP, TCP SSL, HTTP, and HTTPS for specified listener ports through annotations.
Example: For usage details, see Service Extension Protocol.


service.kubernetes.io/service.extensiveParameters

Note: This annotation uses the parameters from CLB creation. It can only be configured at creation and cannot be modified after creation. Modifying this annotation after creation has no effect. Refer to Creating a CLB Instance to add custom parameters when creating a CLB instance.
Example:
To create a NAT64 IPv6 instance: service.kubernetes.io/service.extensiveParameters: '{"AddressIPVersion":"IPV6"}'.
To purchase a China Telecom CLB instance: service.kubernetes.io/service.extensiveParameters: '{"VipIsp":"CTCC"}'.
Customize the CLB name at creation:
service.kubernetes.io/service.extensiveParameters: '{"LoadBalancerName":"my_custom_lb_name"}'


service.cloud.tencent.com/enable-grace-shutdown

Note: Graceful shutdown in CLB direct connection mode is supported. When a Pod is deleted, the Pod has a DeletionTimestamp and its status is set to Terminating. At this point, the weight of the CLB for this Pod is adjusted to 0.
Example: This feature is supported only in direct connection mode and requires service.cloud.tencent.com/direct-access. For usage details, see Graceful Service Shutdown.


service.cloud.tencent.com/enable-grace-shutdown-tkex

Note: Graceful shutdown in CLB direct connection mode is supported. When endpoints in the Endpoint object are not-ready, the weights of the not-ready CLB backends are set to 0.
Example: This feature is supported only in direct connection mode and requires service.cloud.tencent.com/direct-access. For usage details, see the relevant capabilities in Graceful Service Shutdown.


service.kubernetes.io/qcloud-loadbalancer-internet-charge-type

Note: The billing type of CLB can only be configured at creation. It cannot be modified after creation, and modifying this annotation after creation has no effect. Specify the billing type when creating a CLB instance. Use it together with the service.kubernetes.io/qcloud-loadbalancer-internet-max-bandwidth-out annotation.
Valid values:
BANDWIDTH_POSTPAID_BY_HOUR: Billing by bandwidth and by the hour.
TRAFFIC_POSTPAID_BY_HOUR: Billing by traffic and by the hour.
Example:
service.kubernetes.io/qcloud-loadbalancer-internet-charge-type: "TRAFFIC_POSTPAID_BY_HOUR"


service.kubernetes.io/qcloud-loadbalancer-internet-max-bandwidth-out

Note: CLB bandwidth settings can only be configured at creation. The bandwidth cannot be modified after creation, and modifying this annotation after creation has no effect. Specify the maximum outbound bandwidth when creating a CLB instance. This setting takes effect only for CLB instances with public network attributes. Use it together with the service.kubernetes.io/qcloud-loadbalancer-internet-charge-type annotation.
Valid values: The supported range is 1 to 2048, in Mbps.
Example:
service.kubernetes.io/qcloud-loadbalancer-internet-max-bandwidth-out: "2048"


service.cloud.tencent.com/security-groups

Note: This Annotation can be used to bind security groups to a CLB Service. A single CLB instance can have up to 5 security groups bound.
Attention:
View the Use Limits of CLB security groups.
Typically, you need to use the default security group traversal capability. By default, traffic between CLB and CVM is allowed, and traffic from CLB only needs to pass the security group check on CLB. The corresponding Annotation is service.cloud.tencent.com/pass-to-target.
For scenarios where Using Existing CLBs, if multiple Services declare different security groups, logic conflicts may occur.
Example:
service.cloud.tencent.com/security-groups: "sg-xxxxxx,sg-xxxxxx"


service.cloud.tencent.com/modification-protection

Note:
This annotation is used to configure CLB modification protection. After this feature is enabled, the attributes of the CLB instance cannot be modified via the CLB console or API.
Example:
service.cloud.tencent.com/modification-protection: "true"


service.cloud.tencent.com/pass-to-target

Note: This Annotation allows you to configure the default security group traversal capability for CLB Services. By default, traffic between CLB and CVM is allowed, and traffic from CLB only needs to pass the security group check on CLB.
Attention:
View the Use Limits of CLB security groups.
Typically, you need to use the security group binding capability. The corresponding Annotation is service.cloud.tencent.com/security-groups.
For scenarios where Using Existing CLBs, if multiple Services declare different allow configurations, logic conflicts may occur.
Example:
service.cloud.tencent.com/pass-to-target: "true"

Ajuda e Suporte

Esta página foi útil?

comentários