All Products
Search
Document Center

Container Compute Service:Considerations for configuring a LoadBalancer Service

Last Updated:Aug 23, 2024

When you configure a Type=LoadBalancer Service, the cloud controller manager (CCM) of Alibaba Cloud Container Compute Service (ACS) automatically creates or configures a Server Load Balancer (SLB) for the Service. The CCM also automatically configures listeners and backend server groups for the SLB instance. This topic describes the considerations for configuring a LoadBalancer Service in an ACS cluster and the resource update policies of the CCM.

Policies used by the CCM to update SLB resources

ACS allows you to specify an existing SLB instance for a Service or use the CCM to automatically create an SLB instance. The two methods use different policies to update SLB resources. The following table describes the differences.

Resource object

Existing SLB instance

SLB instance created and managed by the CCM

SLB

Use the following annotation to specify an existing SLB instance for a Service: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-id.

  • The CCM uses the specified SLB instance to enable load balancing. You can use other annotations to configure the SLB instance. The CCM automatically creates vServer groups for the instance.

  • If the Service is deleted, the CCM does not delete the existing SLB instance that is specified in the annotation.

  • The CCM automatically creates, configures, and manages SLB resources based on the Service configuration, including the SLB instance, listeners, and vServer groups.

  • If the Service is deleted, the CCM deletes the created SLB instance.

Listeners

Use the following annotation to configure listeners: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners:.

  • If you set the annotation to false, the CCM does not configure or manage listeners for the SLB instance.

  • If you set the annotation to true, the CCM configures and manages listeners for the SLB instance based on the Service configuration. If the SLB instance has existing listeners, the CCM creates new listeners to replace the existing ones.

CCM configures listeners for the SLB instance based on the Service configuration.

Backend server groups

When the endpoints of a Service change or the cluster nodes change, the CCM automatically updates the vServer groups of the SLB instance created for the Service. In ACS clusters, the CCM can mount only pod IP addresses as backend servers to an SLB instance.

Precautions

  • Before you reuse an existing SLB instance, check whether the instance meets the following requirements

    • The SLB instance that you want to reuse is created in the SLB console. You cannot reuse an SLB instance that is created by the CCM.

    • To reuse an internal-facing SLB instance for a cluster, the SLB instance and the cluster must be deployed in the same virtual private cloud (VPC).

  • Considerations for using the CCM to configure an SLB instance

    • The CCM configures SLB instances only for LoadBalancer Services.

      Important

      If you change the of a Service from Type=LoadBalancer to Type!=LoadBalancer, the CCM automatically deletes the configurations related to the SLB instance created for Service. As a result, you cannot use the SLB instance to access the Service.

    • When specific conditions are met, the CCM uses a declarative API to automatically update the configuration of an SLB instance based on the Service configuration. When service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners: is set to true, your modifications made in the SLB console may be overwritten.

      Important

      If the SLB instance is created and managed by the CCM, we recommend that you do not modify the configuration of the SLB instance in the SLB console. Otherwise, the CCM may overwrite the configuration and the Service may become unavailable.

Quotas

VPC

SLB