Service Annotations
CCE allows you to add annotations to a YAML file to realize some advanced Service functions. The following table describes the annotations you can add.
The annotations of a Service are the parameters that need to be specified for connecting to a load balancer. For details about how to use the annotations, see Using kubectl to Create a Service (Automatically Creating a Load Balancer).
| Parameter | Description |
|---|---|
| kubernetes.io/elb.class | Select a proper load balancer type. Value:
Default value: union |
| kubernetes.io/elb.id | ID of a load balancer. The value can contain 1 to 100 characters. Mandatory when an existing load balancer is to be associated. How to obtain: On the management console, click Service List, and choose Network > Elastic Load Balance. Click the name of the target load balancer. On the Summary tab page, find and copy the ID. |
| kubernetes.io/elb.protocol-port | Layer-7 forwarding configuration port used by the Service. |
| kubernetes.io/elb.cert-id | HTTP certificate used by the Service for Layer-7 forwarding. |
| kubernetes.io/elb.subnet-id | ID of the subnet where the cluster is located. The value can contain 1 to 100 characters.
|
| kubernetes.io/elb.enterpriseID | Clusters of v1.15 and later versions support this field. In clusters earlier than v1.15, load balancers are created in the default project by default. This parameter indicates the ID of the enterprise project in which the ELB load balancer will be created. If this parameter is not specified or is set to 0, resources will be bound to the default enterprise project. How to obtain: Log in to the management console and choose Enterprise > Project Management on the top menu bar. In the list displayed, click the name of the target enterprise project, and copy the ID on the enterprise project details page. |
| kubernetes.io/elb.autocreate | Whether to automatically create a load balancer associated with the Service. Example:
|
| kubernetes.io/elb.lb-algorithm | Load balancing algorithm of the backend server group. The default value is ROUND_ROBIN. Value:
When the value is SOURCE_IP, the weights of backend servers in the server group are invalid. |
| kubernetes.io/elb.health-check-flag | Whether to enable the ELB health check. Disabled by default.
|
| kubernetes.io/elb.health-check-option | ELB health check configuration items. |
| kubernetes.io/elb.pass-through | Whether the access requests from within the cluster to the Service pass through the ELB load balancer. For details about the application scenarios, see Enabling Passthrough Networking for LoadBalancer Services. |
| kubernetes.io/elb.session-affinity-mode | Listeners ensure session stickiness based on IP addresses. Requests from the same IP address will be routed to the same backend server.
|
| kubernetes.io/elb.session-affinity-option | Sticky session timeout. |
| kubernetes.io/hws-hostNetwork | Whether the workload Services use the host network. Setting this parameter to true will enable the load balancer to forward requests to the host network. The host network is not used by default. The value can be true or false. |
Last Article: Enabling Passthrough Networking for LoadBalancer Services
Next Article: Ingress
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.