Service Annotation

Last updated: 2021-01-13 17:10:54

    You can use the following annotations to configure Services so as to enrich CLB capabilities.

    Annotation usage

    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 is a read-only annotation that provides the LoadBalanceId referenced by the current Service.

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

    Note:
    This annotation is used to specify the creation of a private-network CLB, and its value indicates the subnet ID.
    Use case:
    service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-xxxxxxxx

    service.kubernetes.io/tke-existed-lbid

    Note:
    When you use an existing CLB, note that different ways of use have different impacts on Tencent Cloud labels.
    Use case:
    For usage details, see Service Using an Existing CLB.

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

    Note:
    In Service Local mode, only nodes with pods are bound.
    Use case:
    For usage details, see Service Local Mode.

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

    Note:

    • This is used together with the annotation service.kubernetes.io/local-svc-only-bind-node-with-pod.
    • The CLB backend weight is determined by the number of workloads on nodes.

    Use case:
    For usage details, see Service Local Mode.

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

    Note:
    This annotation is used to specify a label for setting the nodes to be bound with the CLB backend.
    Use case:
    For usage details, see Specifying the Access-Layer Backend.

    service.cloud.tencent.com/direct-access

    Note:
    Adopt direct connection between the CLB and pods.
    Use case:
    For usage details, see Using Services with LoadBalancer Directly Connected to Pods.

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

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

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

    Note:
    This annotation can be used to automatically create TkeServiceConfig.
    Use case:
    For usage details, see Associated Actions Between Service and TkeServiceConfig.

    service.kubernetes.io/loadbalance-nat-ipv6

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

    service.kubernetes.io/loadbalance-type (to be deprecated soon)

    Note:

    • This annotation controls the type of automatically created CLBs: Classic CLB or CLB.
    • Values: yunapi_clb (Classic CLB), classic (Classic CLB), yunapiv3_forward_clb (CLB)
    • Default value: yunapiv3_forward_clb (CLB)

      Note:

      Except in special circumstances, we do not recommend using Classic CLBs because they are no longer upgrades, will soon be discontinued, and lack many features.

    service.cloud.tencent.com/specify-protocol

    Note:
    You can use this annotation to configure TCP, UDP, TCP SSL, HTTP, or HTTPS for the specified listening port.
    Use case:
    For usage details, see Service Extension Protocol.

    service.kubernetes.io/service.extensiveParameters

    Note:
    Refer to Creating a CLB Instance to add custom parameters for creating a CLB instance.
    Use case:

    • Creating a NAT64 IPv6 instance: service.kubernetes.io/service.extensiveParameters: '{"AddressIPVersion":"IPV6"}'
    • Purchasing a CTCC CLB: service.kubernetes.io/service.extensiveParameters: '{"VipIsp":"CTCC"}'