Manually scale a node pool

Updated at:

Adjust the Expected Nodes value of a node pool to scale it in or out. ACK then keeps the actual number of nodes at that value, so scale-out adds capacity for your workloads and scale-in reduces costs.

ACK supports node auto scaling or node instant scaling to adjust node resources based on workload.

How it works

The Expected Nodes field sets the target number of nodes for a node pool. Once you submit a change, ACK automatically drives the actual node count to that target—creating or removing ECS instances as needed.

Scale out—increase Expected Nodes above the current count. ACK then updates the expected instance count of the underlying Auto Scaling scaling group. For more information, see Expected number of instances. ACK provisions ECS instances through Auto Scaling, runs the cloud-init script on each, then adds them to the pool. If instance creation fails, ACK retries automatically until the number of nodes reaches Expected Nodes. Instance types and zones depend on the node pool's scaling policy.

Scale in—decrease Expected Nodes below the current count. Only pay-as-you-go ECS instances are released during scale-in. To release a subscription instance, first convert it to pay-as-you-go in the ECS console, and then release it. See Convert a subscription instance to pay-as-you-go. Scaling in one node takes about 1 to 3 minutes (about 2 minutes measured for a pay-as-you-go ecs.g7.large instance), depending on the instance type and cluster size. The lifecycle of a node's system disk and data disks is bound to the node. When a node is released during scale-in, its disks are released with it and all data on those disks is permanently lost and cannot be recovered. For data that requires persistence, manage it with a PersistentVolume (PV) so that storage is decoupled from the node lifecycle.

Important

When scale-in is triggered by changing Expected Nodes, ACK removes nodes even if node drain fails. If you have a strict drain requirement, remove the target node manually instead. See Remove a node.

Removal order during scale-in depends on the scaling policy:

Scaling policy Removal order
Priority Newly created instances are removed first.
Distribution balancing Zones are filtered by policy; newly created instances are removed first to balance counts across zones.
Cost optimization Instances are removed in descending order of vCPU price.

Billing during scale-out

Billing is based on the actual specifications of the ECS instances created. For example, with two instance types, pay-as-you-go billing, and the Priority scaling policy:

  • Two Node A instances are created in the zone of the first-priority vSwitch.

  • If Node A inventory is insufficient, three Node B instances are created in the zone of the second-priority vSwitch.

Cost = instance type unit price × node count × billing duration. For this example, the cost for one hour is (Node A unit price × 2 × 1) + (Node B unit price × 3 × 1).

GPU node pools

The ebmgn7 and ebmgn7e ECS Bare Metal Instance families do not support automatic Multi-Instance GPU (MIG) cleanup. Therefore, when you add such instances, ACK resets any MIG configuration retained on them. The reset duration is indeterminate, and a reset that takes too long may prevent instances from joining the cluster.

Prerequisites

Make sure you have:

  • An ACK cluster with at least one node pool

  • (Optional) Required only if CloudOps Orchestration Service (OOS) has not been authorized: the AliyunOOSLifecycleHook4CSRole role is assigned to your Alibaba Cloud account. If you use a RAM user, AliyunRAMReadOnlyAccess is attached to the RAM user.

Scale a node pool

Important

Do not run kubectl delete node. This removes nodes from Kubernetes without releasing their ECS instances, causing the node pool to lose track of capacity. Use the ACK console to scale node pools.

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, click the name of the target cluster. In the left navigation pane, choose Nodes > Node Pools.

  3. Find the node pool to scale and click Scale in the Actions column, and then set Scaling Mode to Manual.

  4. (Optional) If CloudOps Orchestration Service (OOS) has not been authorized, click AliyunOOSLifecycleHook4CSRole to create the role and complete the authorization.

    If the current account is an Alibaba Cloud account, click AliyunOOSLifecycleHook4CSRole to complete the authorization. If you use a RAM user, make sure that the Alibaba Cloud account has the AliyunOOSLifecycleHook4CSRole role before you attach the AliyunRAMReadOnlyAccess policy to the RAM user.
  5. Set the Expected Nodes value and confirm the change. The Status column cycles through Updating, Scaling Out (or Removing), and then Active.

    • When the status shows Scaling Out, the node pool is being scaled out. When it returns to Active, scale-out is complete.

    • When the status shows Removing, the node pool is being scaled in. When it returns to Active, scale-in is complete.

    Important

    If the cluster's security group blocks access to 100.64.0.0/10, new nodes cannot join the cluster.

To view scale-out task details, click the node pool name, then open the Scaling Activities tab.

View the operational log on a node:

grep cloud-init /var/log/messages
After a node joins the pool, /var/log/messages is cleared and retains only failed join entries. If a node fails to join, the log is synced to the task result on the Cluster Tasks tab.

Troubleshoot unexpected node count changes

If the node count increases without a manual change to Expected Nodes, node pool auto scaling is usually the cause. When Pending pods in the cluster cannot be scheduled because of insufficient CPU or memory, a node pool with auto scaling enabled scales out to add scheduling capacity. Perform the following checks to identify the cause of the change and bring the node count back to the expected range.

Check for Pending pods

First, check whether the cluster contains pods in the Pending state, the most common trigger for automatic scale-out.

Find all pods in the Pending state:

kubectl get pods -A --field-selector=status.phase=Pending

Check why a specific pod cannot be scheduled:

kubectl describe pod <pod-name> -n <namespace>

In the returned Events, check the FailedScheduling event. Its Reason field gives the type of the insufficient resource (for example Insufficient cpu or Insufficient memory). A message such as 0/2 nodes are available: 2 Insufficient cpu, 2 Insufficient memory means that the CPU or memory available on existing nodes cannot satisfy the requests declared by the pod. This shortage triggered the node pool scale-out.

Check the node pool scaling configuration

Check whether auto scaling is enabled for the target node pool, and which scaling mode and node scaling solution it uses.

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

  2. On the Clusters page, click the name of the target cluster. In the left navigation pane, choose Nodes > Node Pools.

  3. Check whether auto scaling is enabled for the target node pool, and confirm its Scaling Mode and the node scaling solution in use (node auto scaling or node instant scaling).

If auto scaling is not enabled for the target node pool, the change is not caused by auto scaling. Continue with the non-standard operations listed in "Operations to avoid" in this topic.

Check the scaling activity records

Identify when the node count changed and what triggered the change.

  1. Click the name of the target node pool to go to its details page.

  2. On the Basic Information tab, in the Scaling Configuration section, check the Minimum Instances, Maximum Instances, and current actual node count. Confirm whether the actual node count has been raised above Minimum Instances.

  3. On the Scaling Activities tab, check the scaling activity records. The Add ECS instance and Remove ECS instance records give the time and the trigger of each node change.

Control the node count

After you identify the cause, limit the range within which auto scaling can adjust nodes by changing the Minimum Instances and Maximum Instances of the node pool. To fix the node count, change the Scaling Mode to Manual, and set Expected Nodes as described in "Scale a node pool" in this topic.

Operations to avoid

Important

Do not perform any of the following operations. They bypass the Expected Nodes mechanism, prevent the node pool from scaling as expected, and can cause unnecessary costs.

Operation What happens What to do instead
Delete nodes with kubectl delete node ACK tracks expected nodes against ECS instances in the scaling group, not the Kubernetes node list. The ECS instance keeps running, but the node shows as Unknown. Click the node pool name, open the Nodes tab, and remove nodes. The node has already been removed from the cluster, so draining is not required. Select Release ECS Instance to terminate the ECS instance as well; leave it cleared to keep the instance running and billed. Manually added and subscription nodes must be released from the ECS console.
Release ECS instances directly from the ECS console or API The node pool detects the discrepancy and creates new ECS instances to restore the expected count. Use the ACK console to remove nodes. See Remove a node . Manually added nodes and subscription nodes require manual release from the ECS console.
Remove ECS instances from the scaling group in the Auto Scaling console (without changing expected count) The node pool detects the change and creates replacement instances. Do not modify scaling groups used by node pools directly in the Auto Scaling console. Doing so can cause the node pool to behave unexpectedly.
Let subscription ECS instances expire The node pool detects the release and creates replacement instances. Remove or renew subscription instances before they expire. See Remove a node and Renew a subscription instance .
Manually enable health checks on the scaling group in the Auto Scaling console or through OpenAPI. When a health check identifies an unhealthy (such as suspended) instance, Auto Scaling creates a replacement ECS instance. Health checks are disabled by default for scaling groups used by ACK, and ACK creates new ECS instances only when a node is released. Do not modify the settings of a scaling group used by a node pool directly; otherwise, the node pool may behave unexpectedly.

Troubleshoot scaling failures

If scaling fails, click the cluster name on the Clusters page, open the Cluster Tasks tab, and click View Cause to see the error details.

Error code Cause Solution
RecommendEmpty.InstanceTypeNoStock Insufficient ECS inventory in the current zone. Edit a node pool to add vSwitches in different zones and configure multiple instance types to increase the instance creation success rate. The node pool list shows the pools with low elastic strength, so you can assess the availability of their configuration and the health of the instance supply. See View the elastic strength of a node pool.
NodepoolScaleFailed.FailedJoinCluster Nodes failed to join the ACK cluster. Log in to the node and run grep cloud-init /var/log/messages to check the error.
InvalidAccountStatus.NotEnoughBalance / InsufficientBalance.CreditPay / Account.Arrearage Insufficient account balance. Top up your account. If your balance is insufficient, you can also add existing ECS instances to the cluster to avoid waiting for the top-up. In the ACK console, open the details page of the target cluster, and in the node pool list on the Nodes tab, click the name of the target node pool. Click More > Add Existing Node, and select the ECS instances to add. This method requires auto scaling to be disabled for the target node pool; node pools with auto scaling enabled do not support adding existing nodes. For more information, see Add existing ECS instances to a cluster .
InvalidParameter.NotMatch (boot mode mismatch) Image bootMode BIOS does not match instanceType bootMode The instance type does not support the OS image's boot mode (BIOS). Select a different instance type. Check the OS and image ID on the node pool's Overview tab. Call DescribeImageSupportInstanceTypes to query supported instance types.
QuotaExceed.ElasticQuota ECS quota exceeded for the specified instance type in the current region. Select a different instance type, reduce existing ECS instances, or request a quota increase at the Quota Center.
InvalidResourceType.NotSupported The instance type is not supported or out of stock in the current zone. Call DescribeAvailableResource to find supported instance types in the zone, then update the node pool.
InvalidImage.NotSupported The specified image does not support vSGX instance. The OS image does not support security-enhanced instances. Select a different instance type. See Create a trusted instance in the ECS console for supported images.
InvalidParameter.NotMatch (vTPM image mismatch) The specified instanceType only support vTPM image. The specified OS image does not support security-enhanced instances. Select a different instance type. Check the OS and image ID on the node pool's Overview tab.
QuotaExceeded.PrivateIpAddress The current vSwitch has no available private IP addresses. Add more vSwitches to the node pool and retry.
InvalidParameter.KmsNotEnabled The Key Management Service (KMS) key is disabled. Log in to the KMS console and enable the key.
InvalidInstanceType.NotSupported The specified instanceType is not supported by the image architecture. The instance type does not support the OS image architecture. Select a different instance type. Call DescribeImageSupportInstanceTypes to query compatible instance types. See OS images for ACK-supported images.
ApiServer.InternalError / Err.QueryEndpoints an error on the server ("Get https://192.168.xxx.xxx:xxx/api/v1/nodes: dial tcp 192.168.xxx.xxx:xxx: connect: connection refused") has prevented the request from succeeding The ACK cluster's API server is unreachable. Check API server accessibility. See Troubleshoot cluster access issues in the ACK console .
RecommendEmpty.InstanceTypeNotAuthorized No permission to use the specified instance type. Submit a ticket to request ECS permissions.
RecommendEmpty.DiskTypeNoStock Insufficient cloud disk inventory in the zone. Add more vSwitches or select a different disk type.
InvalidParameter.KMSKeyId.KMSUnauthorized No permission to access KMS. In the ECS console, assign the AliyunECSDiskEncryptDefaultRole role to ECS. See Encryption-related permissions.
InvalidParameter.Conflict The specified disk category (xxxx) is not support the specified instance type. The cloud disk type is not compatible with the instance type. Select a different instance type or disk type.
NotSupportSnapshotEncrypted.DiskCategory System disk encryption requires an ESSD. Select an ESSD. For disk types and encryption, see Disk types and encryption .
ScalingActivityInProgress The node pool is already being scaled. Wait for the current scaling activity to complete before retrying. Do not scale node pools directly in the Auto Scaling console.
Instance.StartInstanceFailed ECS instances failed to start. Retry. If the issue persists, submit a ticket to the ECS team.
OperationDenied.NoStock The instance type is out of stock in the specified zone. Select a different instance type and try again. Elastic strength quantifies the probability that a node pool can scale out, based on real-time inventory. For more information, see View the elastic strength of a node pool.
NodepoolScaleFailed.WaitForDesiredSizeTimeout The scale-out task timed out. In the ACK console, go to Clusters > cluster name > Nodes > Node Pools and click the node pool name. Open the Scaling Activities tab to view task details.
ApiServer.TooManyRequests The Kubernetes API server throttled the request. Reduce request frequency or retry later.
NodepoolScaleFailed.PartialSuccess Some nodes failed to be created due to insufficient inventory. Change the instance types configured for the node pool. See View the elastic strength of a node pool . See Edit a node pool . Elastic strength quantifies the probability that a node pool can scale out, based on real-time inventory.

Next steps