All Products
Search
Document Center

Container Service for Kubernetes:Remove nodes

Last Updated:Apr 22, 2024

You can remove nodes that you no longer need on the Node Pools page in the Container Service for Kubernetes (ACK) console to prevent unexpected results. When you remove a node, the pods that run on the node are migrated to other nodes. This may cause service interruptions. We recommend that you remove nodes during off-peak hours.

Prerequisites

Usage notes

  • When you remove a node, the pods that run on the node are migrated to other nodes. This may cause service interruptions. We recommend that you remove nodes during off-peak hours.

  • Unknown errors may occur when you remove nodes. Before you remove nodes, back up the data on the nodes.

  • Nodes remain in the Unschedulable state when they are being removed.

  • You can remove only worker nodes. You cannot remove master nodes.

  • We recommend that you remove nodes in the ACK console. If you run the kubectl delete node command to remove nodes from an ACK cluster, take note of the following limits:

    • The removed nodes cannot be added to other ACK clusters.

    • The Elastic Compute Service (ECS) instance on which the node is deployed is released after the node is removed.

  • If you use the ECS or Auto Scaling console to remove nodes or release instances from a node pool, the nodes or instances are automatically suspended and then removed from the ACK console. The same rule applies if you use the ECS or Auto Scaling API to remove nodes or release instances, or the subscription of the instances in the node pool expires. If the node pool is configured with an expected number of nodes, the node pool automatically scales to the expected number of nodes based on the node pool configurations.

Procedure

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

  2. On the Clusters page, click the name of the cluster that you want to manage and choose Nodes > Node Pools in the left-side navigation pane.

  3. On the Node Pools page, click the name of the node pool that you want to manage. On the Nodes tab, select the nodes that you want to remove and click Batch Remove in the lower part of the page.

  4. Optional: In the Remove Node dialog box, you can select Release ECS Instance and Drain Node.

    • Release ECS Instance:

      • Only pas-as-you-go ECS instances and the data disks on the instances are released. You are still charged for the ECS instances that are not released.

      • Subscription ECS instances are automatically released after the subscriptions expire.

      • If you do not select Release ECS Instance, you are still charged for the ECS instance where the node is deployed.

    • Drain Node: Migrates pods that run on the nodes to be removed to other nodes in the cluster. If you select this option, make sure that other nodes in the cluster have sufficient resources to host these pods.

      You can also run the kubectl drain node-name [options] command to migrate pods that run on the nodes to other nodes in the cluster.

      Note
      • node-name must be in the your-region-name.node-id format.

        your-region-name specifies the region where the cluster that you want to manage is deployed. node-id specifies the ID of the ECS instance where the node to be removed is deployed. Example of node-name: cn-hangzhou.i-i-bp1asavedmte377c3****.

      • options specifies the optional parameters of the command. Example of options: --force --ignore-daemonsets --delete-local-data. You can run the kubectl drain --help command to view help information.

  5. Select I understand the above information and want to remove the node(s) and click OK.

    Note

    If a message that indicates a node removal failure appears, clear Release ECS Instance and Drain Node, and then remove the nodes again.

FAQ

How can I remove a node if I cannot find the node on the Nodes tab of the node pool?

Perform the following operations to remove the node:

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

  2. On the Clusters page, click the name of the cluster that you want to manage and choose Nodes > Nodes in the left-side navigation pane.

  3. On the Nodes page, select the nodes that you want to remove and click Batch Remove in the lower part of the page.

  4. In the Remove Node dialog box, confirm the information and click OK.

References

  • ACK allows you to scale a node pool by modifying the expected number of nodes in the node pool. You can scale out node pools to meet the requirements of business development and scale in node pools to reduce resource costs. For more information, see Scale a node pool.

  • You can add existing ECS instances to an ACK cluster or re-add existing nodes to a node pool. To do this, you can log on to the ACK console and manually add nodes or configure ACK to automatically add nodes. For more information, see Add existing ECS instances to an ACK cluster.

  • For information about how to update a node pool without affecting data disks, see Node pool updates.