When you specify Type=LoadBalancer
for a Service, the Cloud Controller Manager (CCM) creates and configures Server Load Balancer (SLB) resources for the Service, including SLB instances, listeners, and vServer groups. This topic describes the considerations for configuring a LoadBalancer type Service and the policies that are used by the CCM to update SLB resources.
Policies that are used by the CCM to update SLB resources
Container Service for Kubernetes (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. 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
|
|
Listener | Use the following annotation to configure listeners: service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners: .
| The CCM configures listeners for the SLB instance based on the Service configuration. |
Backend server group | When the endpoint of an Elastic Compute Service (ECS) instance in a vServer group for a Service changes or the cluster nodes are changed, the CCM updates the vServer groups.
|
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 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
type Services.Important If you change the type of a Service fromType=LoadBalancer
toType!=LoadBalancer
, the CCM automatically deletes the configurations related to the SLB instance. As a result, you cannot use the SLB instance to access the Service that is associated with the SLB instance. - 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. If you set
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners:
totrue
, the SLB configurations that you update 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.
- The CCM configures SLB instances only for
Quotas
- 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 Go to the Quota Center page to submit a ticket.
- For more information about VPC resource quotas, 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 that have
Type=LoadBalancer
configured. By default, you can have at most 60 SLB instances within your Alibaba Cloud account. To create more SLB instances, apply for a quota increase in Go to the Quota Center page to submit a ticket. - 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 Go to the Quota Center page to submit a ticket.
- 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 Go to the Quota Center page to submit a ticket.
- 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 Go to the Quota Center page to submit a ticket.
- For more information about SLB resource quotas, see Limits.
To query the SLB resource quotas, go to the Quota Management page in the SLB console.