Cluster autoscaler on Azure Kubernetes Service
You can enable the cluster autoscaler feature on Azure Kubernetes Service (AKS) to manage the cost of the cluster effectively.
You can use the cluster autoscaler with multiple node pools that are enabled. Depending on your AKS setup, when the nodes are not in use, the nodes of the AKS cluster are automatically shut down to minimize the runtime costs of the AKS cluster without risking the performance of HCL DevOps Test Hub (Test Hub).
When you create an AKS cluster, that contains a single node pool as the default node pool. You can use the az aks node pool command to add a node pool to your existing AKS cluster. You can then use the az aks update command to enable and configure the cluster autoscaler on the node pool for the existing AKS cluster.
az aks nodepool add -g <resource_group> -n wrk0 \
--cluster-name <aks_cluster_name> \
--kubernetes-version <k8s_version> \
--node-vm-size Standard_D2ds_v4 \
--enable-cluster-autoscaler \
--node-count 1 --min-count 1 --max-count 2 \
--labels execution=allow \
--node-taints reserved=reserved:NoSchedule
az aks update \
-g <resource_group> -n <aks_cluster_name> \
--cluster-autoscaler-profile scale-down-unneeded-time=1m scale-down-delay-after-add=1m
<resource_group>
, <k8s_version>
,
and <aks_cluster_name>
with the name of the resource group,
the version number of Kubernetes, and the name of the AKS cluster in the
command.-
Added a user node pool called wrk0
-
Enabled the cluster autoscaler feature
-
Updated the default values of scale-down-unneeded-time and scale-down-delay-after-add in the cluster-wide autoscaler profile to 1m
After you install Test Hub by enabling the cluster autoscaler feature on your AKS cluster, a new container is used only to run test assets. You can run the kubectl get pods command to view the status of the pod, which is displayed as Pending.
You can describe the pod by running the kubectl describe pod <pod_name> -n <namespace> command to view a scale event when you run test assets from Test Hub.
When the test asset run is complete, the pod shuts down automatically. Thus, you can reduce the cost of the cluster when the node is not in use. You can then run the kubectl get nodes command to verify the number of nodes that are currently in the Ready state.