You can set the ratio of preemptible instances to pay-as-you-go instances in a node pool. This allows you to reduce costs by controlling the number of preemptible instances when the node pool contains sufficient pay-as-you-go instances. This topic describes how to set the ratio of preemptible instances to pay-as-you-go instances in a node pool for a Container Service for Kubernetes (ACK) cluster.
- Make sure that you have a sufficient node quota in the cluster. To increase the quota, Submit a ticket. For more information about the quota limits related to ACK clusters, see Limits.
- When you add an existing Elastic Compute Service (ECS) instance to a node pool, make sure that the ECS instance is associated with an elastic IP address (EIP) or a NAT gateway is configured for the virtual private cloud (VPC) where the ECS instance is deployed. Make sure that the ECS instance can access the Internet. Otherwise, the ECS instance cannot be added to the cluster.
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, click Clusters.
- On the Clusters page, find the cluster that you want to manage and click the name of the cluster or click Details in the Actions column. The details page of the cluster appears.
- In the left-side navigation pane of the details page, choose .
- In the upper-right corner of the Node Pools page, click Create Node Pool.
- In the Create Node Pool dialog box, select multiple vSwitches for vSwitch and select Preemptible Instance for Billing Method. For more information about other node pool parameters, see Create a node pool.
- Click Show Advanced Options. Select Cost Optimization for Scaling Policy and set the Percentage of Pay-as-you-go Instances and Enable Supplemental Pay-as-you-go Instances parameters based on your business requirements.
Parameter Description Scaling Policy
- Priority: scales the node pool based on the priorities of the vSwitches that you specify. If Auto Scaling fails to create ECS instances in the zone of the vSwitch with the highest priority, Auto Scaling attempts to create ECS instances in the zone of the vSwitch with a lower priority.
- Cost Optimization: creates ECS instances based on the ascending order of vCPU unit prices. The system
preferably creates preemptible instances when multiple instance types are specified.
If Auto Scaling fails to create preemptible instances for reasons such as preemptible
instances are out of stock, Auto Scaling attempts to create pay-as-you-go ECS instances.
If you set the scaling policy to cost optimization, you can configure the following
- Percentage of Pay-as-you-go Instances: Specify the percentage of pay-as-you-go instances in the node pool. Valid values: 0 to 100.
- Enable Supplemental Preemptible Instances: After you enable this feature, Auto Scaling automatically creates the same number of preemptible instances 5 minutes before the system reclaims the existing preemptible instances. The system sends a notification to Auto Scaling 5 minutes before it reclaims preemptible instances.
- Enable Supplemental Pay-as-you-go Instances: After you enable this feature, Auto Scaling attempts to create pay-as-you-go ECS instances to meet the scaling requirement if Auto Scaling fails to create preemptible instances for reasons such as the unit price is too high or preemptible instances are out of stock.
- Distribution Balancing: evenly distributes ECS instances across the zones of the vSwitches that are specified
for the scaling group. If the distribution of ECS instances across zones is not balanced
due to reasons such as ECS resources are out of stock, you can select this policy
to evenly distribute the ECS instances across zones.
Note This policy takes effect only when you have specified multiple VPC vSwitches.
After you click Confirm Order, take note of the following items:
- The value of Scaling Policy cannot be changed.
- If you select Cost Optimization for Scaling Policy, you can change the values of Percentage of Pay-as-you-go Instances and Enable Supplemental Pay-as-you-go Instances.
- Click Confirm Order.