All Products
Search
Document Center

Container Service for Kubernetes:Automatically clean up NotReady nodes

Last Updated:Jul 06, 2026

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

Configure permissions for cloud-node-controller

Create a RAM user, grant the required policy, and store credentials as a Kubernetes Secret.

  1. Create a RAM user and grant the following custom policy:

    {
        "Version": "1",
        "Statement": [
            {
                "Action": [
                    "ecs:DescribeInstances"
                ],
                "Resource": [
                    "*"
                ],
                "Effect": "Allow"
            }
        ]
    }

    The ecs:DescribeInstances permission allows the component to query ECS instances and determine node health.

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

  3. Create a Secret named alibaba-addon-secret in the kube-system namespace.

    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}"
    Note

    If the Secret already exists, grant the policy to its associated RAM user instead.

Install cloud-node-controller

  1. Log on to the Container Service Management Console. In the left navigation pane, click Clusters.

  2. On the Clusters page, click your cluster name. In the left navigation pane, click Add-ons.

  3. 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-controller

Expected output:

cloud-node-controller-abcXXX    1/1     Running   0     5m

The component automatically detects and removes NotReady nodes caused by scale-in operations.