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 OneTest Server.

When you create an AKS cluster, it 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.

You can use the following commands to add a node pool and enable 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 0 --min-count 0 --max-count 2 \
--labels purpose=test-execution \
--node-taints purpose=test-execution: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
Important:
  • You must replace <resource_group> and <aks_cluster_name> with the name of the resource group and the name of the AKS cluster in the command.

  • You must add the following command in Step 8.a or 8.b when you install the server software to run test assets on the created node pool:
    -f hcl-onetest-server/values-dedicated-nodes.yaml
After you run the commands, you have completed the following actions:
  • 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

When you install the server software by enabling the cluster autoscaler feature on your AKS cluster, a new container is created only to run test assets. You can run the kubectl get pods command to see the status of the execution pod, which is displayed as Pending.

You can describe the pod by running the kubectl describe pod <pod_name> -n <namespace> command to see a scale event when test assets are running from HCL OneTest Server.

When the test asset run is complete, the execution pods shut 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.