1
votes

I have created Kubernetes cluster with Kubeadm tool on AWS. What are all the possible ways to Autoscale the node?

2

2 Answers

2
votes

I don't know about all the ways to scale a Kubernetes cluster on AWS. However I would argue the best approach would be to use the Kubernetes Cluster Autoscaler. It can dynamically scale out a cluster based on scheduled pods in the cluster (as opposed to something like autoscaling groups that can only schedule based on node resource usage). Even for AWS EKS it is now the documented approach to autoscaling.

0
votes

If you have auto scaling group for the slave nodes in your aws cluster, then you can certainly install Kubernetes Cluster Autoscaler. Please check out this cluster-autoscaler bash script and as it is for kops, you can actually use it to learn how many steps and resources you have to follow/configure to install autoscaler.

  1. First create iam policy
printf "   a) Creating IAM policy to allow aws-cluster-autoscaler access to AWS autoscaling groups…\n"
cat > asg-policy.json << EOF
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "autoscaling:DescribeAutoScalingGroups",
                "autoscaling:DescribeAutoScalingInstances",
                "autoscaling:DescribeLaunchConfigurations",
                "autoscaling:DescribeTags",
                "autoscaling:SetDesiredCapacity",
                "autoscaling:TerminateInstanceInAutoScalingGroup"
            ],
            "Resource": "*"
        }
    ]
}
EOF

  1. Then attach create a role and attached the policy with the created role.
aws iam attach-role-policy --policy-arn $ASG_POLICY_ARN --role-name $IAM_ROLE the policy

  1. then download example yml from here download the desired one and edit the yml to change --nodes=1:10:k8s-worker-asg-1 with your autoscaling group name.

For more details please check this document.