Automatically clean up NotReady nodes

Updated at:

When you scale in a node pool in a registered cluster, nodes may enter the NotReady state. If these nodes are not cleaned up promptly, cluster resources may be wasted. The cloud-node-controller add-on cleans up NotReady nodes automatically to prevent resource waste.

Prerequisites

Procedure

Before you install the add-on in a registered cluster, create a Resource Access Management (RAM) user with the required permissions and configure an AccessKey pair that grants the RAM user access to Alibaba Cloud resources.

Step 1: Configure permissions for the cloud-node-controller add-on

  1. Create a RAM user and grant the following custom policy to the RAM user. For instructions, see Grant permissions to a RAM user.

    {
        "Version": "1",
        "Statement": [
            {
                "Action": [
                    "ecs:DescribeInstances"      # Allows querying the details of Elastic Compute Service (ECS) instances.
                ],
                "Resource": [
                    "*"
                ],
                "Effect": "Allow"
            }
        ]
    }
  2. Run the following command to configure the AccessKey pair of the RAM user.

    export ACCESS_KEY_ID=<ACCESS KEY ID>
    export ACCESS_KEY_SECRET=<ACCESS KEY SECRET>
  3. Run the following command to create a Secret named alibaba-addon-secret.

    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 preceding custom permissions to the RAM user that is associated with the Secret.

Step 2: Install the cloud-node-controller add-on

  1. Log on to the ACK console. In the left navigation pane, click Clusters.

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

  3. On the Add-ons page, click the Core Components tab. Find the cloud-node-controller add-on and click Install in the lower-right corner of the card.

Step 3: Check the add-on status

  1. Run the following command to check the status of the cloud-node-controller add-on.

    kubectl get pods -n kube-system | grep cloud-node-controller

    Expected output:

    cloud-node-controller-abcXXX    1/1     Running   0     5m
  2. After the add-on is deployed, the system automatically cleans up nodes that are in the NotReady state.