Hybrid cluster configuration automatic elastic scaling

Create auto scaling configuration

pre-requirements

Creating an auto-scaling configuration will automatically deploy the cluster-autoscaler component (Deployment deployment) in your hybrid cluster. This component that provides services on the cloud needs to avoid being scheduled to off-cloud nodes and auto-scaling (This type of node will be destroyed after automatic shrinkage, which is not conducive to providing stable services for system components deployed in the Deployment type). Therefore, we recommend that you first create and expand a common node pool and configure the node label alibabacloud.com/cloud-worker-nodes=true for the nodes in the node pool. The cluster-autoscaler component will be automatically scheduled to the cloud nodes with the node label alibabacloud.com/cloud-worker-nodes=true.

Steps

1. Log in to the Container Service management console.
2. In the left navigation bar of the console, click Clusters.
3. On the cluster list page, click the name of the target cluster or click Details under the Action column to the right of the target cluster.
4. In the left navigation bar of the cluster management page, click Node Pools.
5. In the upper right corner of the node pool page, click Auto Scaling Configuration.
6. On the automatic auto scaling configuration page, complete the auto scaling configuration and submit. As follows.
Configure the cluster-autoscaler component

After the automatic auto scaling configuration is successfully completed, a Deployment deployment will be automatically deployed in your cluster as follows:

kubectl -nkube-system get deploy |grep cluster-autoscaler
cluster-autoscaler 1/1 1 1 5s
The cluster-autoscaler component also needs to configure the RAM Policy of its operation-related cloud resources, as follows:
{
"Version": "1",
"Statement": [
{
"Action": [
"ess:DescribeScalingGroups",
"ess:DescribeScalingInstances",
"ess:DescribeScalingActivities",
"ess:DescribeScalingConfigurations",
"ess:DescribeScalingRules",
"ess:DescribeScheduledTasks",
"ess:DescribeLifecycleHooks",
"ess:DescribeNotificationConfigurations",
"ess:DescribeNotificationTypes",
"ess:DescribeRegions",
"ess:CreateScalingRule",
"ess:ModifyScalingGroup",
"ess:RemoveInstances",
"ess:ExecuteScalingRule",
"ess:ModifyScalingRule",
"ess:DeleteScalingRule",
"ecs:DescribeInstanceTypes",
"ess:DetachInstances",
"vpc:DescribeVSwitches"
],
"Resource": [
"*"
],
"Effect": "Allow"
}
]
}

You need to use the Access Key information authorized by the above RAM Policy to create a Secret resource named alibaba-addon-secret, as follows:
$ export ACCESS_KEY_ID=xxxx
$ export ACCESS_KEY_SECRET=xxxx
$ 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} '

Create an auto-scaling node pool

Steps

1. On the Auto Scaling configuration page, continue to click Create Node Pool.

2. On the Create Node Pool page, set the configuration items for creating a node pool. Regarding the detailed description of configuration items, some configuration items are described as follows.

Test automatic elastic scaling

When creating an automatic auto-scaling node pool, we can set the automatic node label for the nodes in the node pool, such as workload=auto, then we can use the following command to test whether the node pool can eject the node correctly:
kubectl run nginx --image nginx -l workload=auto

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us