All Products
Search
Document Center

Container Service for Kubernetes:Remove a node

Last Updated:Oct 24, 2023

This topic describes how to remove idle nodes from a Container Service for Kubernetes (ACK) cluster.

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.

    • After you delete a cluster, the Elastic Compute Service (ECS) instances where the removed nodes are deployed are automatically released.

  • 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 node that you want to remove and click Remove Node.

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

    • Release ECS Instance:

      • Only pas-as-you-go ECS instances are released. The system continues to bill ECS instances that are not released.

      • Subscription ECS instances are automatically released after the subscription expires.

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

    • Drain Node: Select this option to migrate pods that run on the nodes to be removed to other nodes in the cluster. If you select this option, make sure that the other nodes have sufficient resources for 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 format of your-region-name.node-id.

        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: cn-hangzhou.i-xxx.

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

  5. 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

Issue description

The node that you want to remove from a cluster is not displayed on the Nodes page.

Solutions

Perform the following steps 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.

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

References