Before you restart or release an ECS instance in a Kubernetes cluster, you need to remove the ECS node from the cluster. This topic describes how to remove a node from a Kubernetes cluster.

Prerequisites

Background information

  • Removing nodes involves Pod migration. This may negatively affect the services provided by the Pods. We recommend that you remove nodes during off-peak hours.
  • Unexpected events may occur when you remove nodes. We recommend that you back up data in advance and exercise caution when performing this action.
  • During the removing process, the scheduler sets the node to be removed as unschedulable.
  • Only Worker nodes can be removed.

Procedure

  1. Run the following command to migrate the Pods on the target node to other nodes:
    Note Make sure that the other nodes in the cluster have sufficient resources to run the Pods.
    kubectl drain node-name
    Note The node-name parameter must be in the format of your-region-name.node-id.
    • your-region-name indicates the name of the region where your cluster is located.
    • node-id indicates the ID of the ECS instance in which the node to be removed resides. For example, cn-hanghzou.i-xxx.
  2. In the left-side navigation pane, choose Clusters > Nodes to go to the Nodes page.
  3. In the target cluster, select the target node and choose More > Remove in the Actions column to go to the Remove Node page.Remove nodes
    Note To remove multiple nodes, you can choose the target cluster on the Nodes page, select the nodes to be removed, and then click Batch Remove.
  4. Optional: Select Release ECS Instance to permanently release the ECS instance where the node resides.Release ECS instances
    Note
    • Only pay-as-you-go ECS instances can be released.
    • Subscription-based ECS instances are automatically released after they expire.
    • If you do not select Release ECS Instance, you will continue to be billed for the ECS instance where the node resides.
  5. Click OK.