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.
- 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.
- 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-nameNote 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.
- In the left-side navigation pane, choose Nodes page. to go to the
- In the target cluster, select the target node and choose Remove Node page.
in the Actions column to go to the 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.
- Optional: Select Release ECS Instance to permanently release the ECS instance where the node resides.
- 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.
- Click OK.