Scaling EC2 ASGs with Cluster Autoscaler
Kubernetes CA is a core part of the K8s ecosystem and is used to scale worker nodes in or out based on two main conditions:
- If there is a Pod in the Kubernetes cluster in the
Pending
state due to an insufficient resources error - If there is a worker node in the Kubernetes cluster that is identified as underutilized by Kubernetes CA
The following diagram illustrates the basic flow of a scale-out operation to support a single pod being placed in the Pending
state and not being scheduled.
Figure 18.3 – High-level Cluster AutoScaler flow
In the preceding diagram, we can see the following:
- The CA is actively looking for pods that cannot be scheduled for resource reasons and are in the
Pending
state. - The CA makes calls to the EC2 ASG API to increase the desired capacity, which in turn will add a new node to the ASG. A key aspect to note is that the nodes need tagging with
k8s.io/cluster...