Remove unnecessary nodes from an ACK Edge cluster to scale down your infrastructure without disrupting running workloads.
Prerequisites
Before you begin, make sure that you have:
An ACK Edge cluster. See Create an ACK Edge cluster.
A kubectl client connected to the cluster. See Connect to an ACK cluster via kubectl.
Before you remove a node
What happens when you remove a node
Pods on the node are migrated to other nodes in the cluster, which may cause service interruptions. Remove nodes during off-peak hours and back up node data before proceeding.
The node enters the Unschedulable state during removal.
Hard limits
Only worker nodes can be removed. Master nodes cannot be removed.
ACK Edge clusters support two node types: edge nodes and nodes in the cloud. Both types can be removed, but at least one node in the cloud must remain in the cluster at all times.
Warning: using kubectl delete node on a cloud node
Use the ACK console to remove nodes. If you run kubectl delete node on a cloud node instead, note that:
The node cannot be added to any other ACK cluster after removal.
The Elastic Compute Service (ECS) instance on which the node is deployed is released after the node is removed.
Edge node pool
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose Nodes > Node Pools.
Click the name of the edge node pool.
In the lower part of the Overview tab, select the node to remove and click Remove Node.
In the Remove Node panel, read the usage notes, select I understand the above information and want to remove the node(s), and click OK.
Releasing ECS instances and automatically draining nodes are not supported when removing edge nodes from an edge node pool.
After the node is removed from the cluster, run the following command on the edge node to uninstall Kubernetes components using edgeadm:
Placeholder Description Example [region]Region ID of the cluster cn-hangzhou[clusterVersion]Kubernetes version of the cluster 1.22.15-aliyunedge.1[arch]CPU architecture of the edge node amd64wget http://aliacs-k8s-[region].oss-[region].aliyuncs.com/public/pkg/run/attach/[clusterVersion]/[arch]/edgeadm -O edgeadm; chmod u+x edgeadm; ./edgeadm resetReplace the placeholders with the actual values for your cluster:
Verify the removal
Run kubectl get nodes on your local machine to confirm the node no longer appears in the cluster node list.
Cloud node pool
Log on to the ACK console. In the left-side navigation pane, click Clusters.
On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose Nodes > Node Pools.
Click the name of the cloud node pool.
On the Nodes tab, select the nodes to remove and click Batch Remove at the bottom of the page.
In the Remove Node dialog box, configure the following options as needed, then click OK:
Release ECS Instance: Releases the underlying ECS instance and its data disks after the node is removed.
Only pay-as-you-go ECS instances and their data disks are released.
Subscription ECS instances are automatically released after their subscription period expires.
If you do not select this option, the ECS instance continues to incur charges after the node is removed.
Drain Node: Migrates all pods on the selected nodes to other nodes in the cluster before removal. Make sure other nodes have enough resources to host the migrated pods. Alternatively, drain nodes manually before removal:
kubectl drain <node-name> [options]<node-name>uses the format<region-name>.<node-id>. Example:cn-hangzhou.i-i-bp1asavedmte377c3****Common options:
--force --ignore-daemonsets --delete-local-dataRun
kubectl drain --helpfor the full list of options.
Verify the removal
Run kubectl get nodes to confirm the removed nodes no longer appear in the cluster.