Considerations for configuring a LoadBalancer service

更新时间:
复制 MD 格式

When you set the type of a service to LoadBalancer, the cloud controller manager (CCM) of Alibaba Cloud Container Compute Service (ACS) provisions a Server Load Balancer (SLB) instance for the service, which includes resources like listeners and backend server groups. This topic describes the key considerations for configuring a LoadBalancer service in an ACS cluster and explains the CCM's resource update policies.

SLB update policies

You can either use an existing SLB instance for a service or let the CCM create a new one. These two methods have different resource update policies, as shown in the following table.

Resource

Existing SLB instance

CCM-managed SLB instance

SLB instance

Specify an existing instance by using the service.beta.kubernetes.io/alibaba-cloud-loadbalancer-id annotation.

  • The CCM uses the specified SLB instance to load balance traffic for the service. It also configures the SLB instance based on other annotations and automatically creates vServer groups for it.

  • When you delete the service, the CCM does not delete the specified SLB instance.

  • The CCM automatically creates and configures resources, such as the SLB instance, listeners, and vServer groups, based on the service configuration.

  • When you delete the service, the CCM also deletes the SLB instance that it automatically created.

Listener

Configure listener behavior by using the service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners annotation:

  • If set to false, the CCM does not manage any listener configurations for the SLB instance.

  • If set to true, the CCM manages listeners based on the service configuration. If a listener already exists, the CCM overwrites its configuration.

The CCM automatically creates and configures listeners based on the service configuration.

Backend server group

When the backend endpoints or cluster nodes of the service change, the CCM automatically updates the vServer groups of the SLB instance. In an ACS cluster, the CCM supports adding only pod IPs to the vServer groups.

Usage notes

  • Which SLB instances can be reused?

    • You can reuse SLB instances that you create in the SLB console, but not those automatically created by the CCM.

    • If you want to reuse a private SLB instance in a Kubernetes cluster, the SLB instance must be in the same virtual private cloud (VPC) as the cluster.

  • Considerations for CCM-managed SLB instances

    • The CCM configures an SLB instance only for a service of type LoadBalancer. The CCM does not configure load balancing for services of other types.

      Important

      When a Service of Type=LoadBalancer is changed to Type!=LoadBalancer, the CCM deletes the SLB configuration, which makes the Service inaccessible through that SLB.

    • The CCM uses a declarative API and automatically reconciles the SLB instance configuration based on the service configuration. When the service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners annotation is set to true, any manual changes that you make to the configuration in the SLB console risk being overwritten.

      Important

      Do not manually modify any configuration of an SLB instance that is created and maintained by Kubernetes in the SLB console. Otherwise, your changes may be overwritten and the service may become inaccessible.

Quotas

VPC

SLB