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.

Prerequisites

  • Only whitelisted users can set the ratio of preemptible instances to pay-as-you-go instances, Submit a ticket.
  • An ACK cluster is created and the Kubernetes version of the cluster is later than 1.9. If the Kubernetes version of your cluster is 1.9 or earlier, you must update the Kubernetes version for your cluster. For more information, see Update the Kubernetes version of an ACK cluster.
    Notice
    • 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.

Procedure

  1. Log on to the ACK console.
  2. In the left-side navigation pane of the ACK console, click Clusters.
  3. 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.
  4. In the left-side navigation pane of the details page, choose Nodes > Node Pools.
  5. In the upper-right corner of the Node Pools page, click Create Node Pool.
  6. 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.
  7. 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.
    Scaling policy.png
    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 that 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 parameters:
      • 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 that 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 that 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 vSwitches in the VPC.
    Note

    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.
  8. Click Confirm Order.

What to do next

After you create the node pool, find the node pool on the Node Pools page and click Details in the Actions column. Then, click the Overview tab. In the Node Configurations, you can view the percentage of pat-as-you-go instances in the node pool.