If you specify Type=LoadBalancer
for a Service, the cloud controller manager (CCM) of Container Service for Kubernetes (ACK) creates and configures Server Load Balancer (SLB) resources for the Service, including an SLB instance, listeners, and backend server groups. The supported types of SLB instances are Classic Load Balancer (CLB) and Network Load Balancer (NLB). This topic describes the considerations for configuring a LoadBalancer Service and the policies that are used by the CCM to update SLB resources.
Usage notes
Reuse of SLB instances
You can reuse only the SLB instances that are created by using the SLB console. You cannot reuse the SLB instances that are automatically created by the CCM.
If you want to reuse an internal-facing SLB instance in an ACK cluster, the instance must be in the same virtual private cloud (VPC) as the ACK cluster. Only NLB instances can be reused for cross-VPC scenarios.
The network type of the SLB instance to be reused must be the same as the access type of the Service. If you specify
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: "internet"
to enable Internet access for the Service, the network type of the SLB instance must be Internet-facing. If you specifyservice.beta.kubernetes.io/alibaba-cloud-loadbalancer-address-type: "intranet"
to enable internal access for the SLB instance, the network type of the SLB instance must be internal-facing.A listening port of an SLB instance cannot be used by multiple Services at a time.
To reuse an existing SLB instance across clusters, you must make sure that the Services exposed by the SLB instance have different names, unless they are deployed in different namespaces.
Load balancing management by the CCM
The CCM creates and configures SLB resources for only Services with the
Type=LoadBalancer
setting.The CCM uses a declarative API and automatically updates the configurations of an SLB instance to match the configurations of the exposed Service when specific conditions are met. If you set
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners:
totrue
, the SLB configurations that you modify in the SLB console may be overwritten by the CCM.
If you change the setting for a Service from Type=LoadBalancer
to Type!=LoadBalancer
, the CCM deletes the configurations of the SLB instance created for the Service. As a result, the Service cannot be accessed by using the SLB instance.
For an SLB instance created and managed by the CCM, we recommend that you do not modify the configurations of the instance in the SLB console. Otherwise, the CCM may overwrite the configurations and the relevant Service may become inaccessible.
Considerations for managing large-scale SLB instances with CCM
CCM has certain limitations in handling Service events. In large-scale clusters, especially those with a large number of nodes or numerous LoadBalancer Services, the following situations can lead to delays in operations related to SLB instances and modifications to server group endpoints performed by CCM:
Creation or deletion of a large number of Services.
Concurrent changes to numerous Service endpoints.
Addition and removal of nodes when many LoadBalancer Services exist.
When you perform bulk changes to meet business requirements, it is essential to conduct capacity assessments and stress testing in advance. This can help prevent business disruptions that may arise from delays in CCM processing.
What do I do if I need to replace an SLB instance for a Service?
For a LoadBalancer Service, you cannot change the SLB instance specified or created for the Service. To replace an SLB instance in this case, delete and recreate the Service.
Quotas
VPC
A node in a cluster is mapped to a route entry in a route table. By default, each route table for a VPC can contain up to 200 entries. If the number of nodes in a cluster exceeds 200, apply for a quota increase in the log on to the Quota Center console and submit an application
For more information about the limits and quotas related to VPC, see Limits and quotas.
To query the VPC resource quotas, go to the Quota Management page in the VPC console.
SLB
The CCM creates SLB instances for Services with the
Type=LoadBalancer
setting. By default, you can have a maximum of 60 SLB instances within your Alibaba Cloud account. To create more SLB instances, apply for a quota increase in the log on to the Quota Center console and submit an application.The CCM automatically adds Elastic Compute Service (ECS) instances to the backend server groups of an SLB instance based on the Service configurations.
By default, an ECS instance can be added to at most 50 backend server groups. To add the ECS instance to more backend server groups, apply for a quota increase in the log on to the Quota Center console and submit an application.
By default, you can add at most 200 backend servers to an SLB instance. To add more backend servers to an SLB instance, apply for a quota increase in the log on to the Quota Center console and submit an application.
The CCM automatically creates listeners that use Service ports for SLB instances. By default, each SLB instance supports at most 50 listeners. To increase the number of listeners supported by each SLB instance, apply for a quota increase in the log on to the Quota Center console and submit an application.
For more information about the limits on SLB, see Limits on CLB and Limits on NLB.
To query the SLB resource quotas, go to the Quota Center page in the SLB console.
Policies used to update SLB resources
ACK allows you to specify an existing SLB instance for a Service. You can also use the CCM to automatically create an SLB instance for the Service. The two methods use different policies to update SLB resources, as described in the following table.
Resource object | Existing SLB instance | SLB instance created and managed by the CCM |
SLB instance | Use the following annotation to specify an existing SLB instance for a Service:
|
|
Listener | Use the following annotation to configure listeners:
| The CCM configures listeners for the SLB instance based on the Service configuration. |
Backend server group | When the endpoints of the Service change or the cluster nodes change, the CCM automatically updates the vServer groups of the SLB instance created for the Service.
|
Enable deletion protection for Services
You can enable deletion protection for Services involving critical business or sensitive data to avoid maintenance costs associated with accidental deletions. After you enable this feature, you must manually disable it before deleting any resources. For more information about how to enable Service Deletion Protection, see Enable deletion protection for a Service.