This topic explains how to use the cloud-node-controller component to automatically clean up NotReady nodes in registered clusters. When you scale in a node pool, nodes may remain in NotReady state. If you do not remove them promptly, cluster resources can be wasted.
Prerequisites
A standard node pool is created and scaled out.
kubectl is connected to the registered cluster.
Configure permissions for cloud-node-controller
Create a RAM user, grant the required policy, and store credentials as a Kubernetes Secret.
Create a RAM user and grant the following custom policy:
{ "Version": "1", "Statement": [ { "Action": [ "ecs:DescribeInstances" ], "Resource": [ "*" ], "Effect": "Allow" } ] }The
ecs:DescribeInstancespermission allows the component to query ECS instances and determine node health.Set the AccessKey ID and AccessKey Secret of the RAM user as environment variables.
export ACCESS_KEY_ID=<ACCESS KEY ID> export ACCESS_KEY_SECRET=<ACCESS KEY SECRET>Replace
<ACCESS KEY ID>and<ACCESS KEY SECRET>with your RAM user credentials.Create a Secret named
alibaba-addon-secretin thekube-systemnamespace.kubectl -n kube-system create secret generic alibaba-addon-secret \ --from-literal="access-key-id=${ACCESS_KEY_ID}" \ --from-literal="access-key-secret=${ACCESS_KEY_SECRET}"NoteIf the Secret already exists, grant the policy to its associated RAM user instead.
Install cloud-node-controller
Log on to the Container Service Management Console. In the left navigation pane, click Clusters.
On the Clusters page, click your cluster name. In the left navigation pane, click Add-ons.
On the Add-ons page, go to the Core Components tab and find cloud-node-controller. Click Install.
Verify the component status
Confirm the component is running:
kubectl get pods -n kube-system | grep cloud-node-controllerExpected output:
cloud-node-controller-abcXXX 1/1 Running 0 5mThe component automatically detects and removes NotReady nodes caused by scale-in operations.