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, 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.

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 1 --min-count 1 --max-count 2 \
  --labels execution=allow editor=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
Note: You must replace <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.
The preceding commands has one node that runs all the time to reduce the launch time of test editors. You can minimize the compute costs by changing -node-count to 0. The maximum size of the node pool is set to 2. Therefore, due to the resources that are requested by the test editor, you can run only two test editors concurrently.
Note: You must confirm the maximum number of nodes that are available in your quota of Azure subscription to configure the size of the node pool.
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

You can add the following command in Step 8.a or 8.b when you install the server software to run test assets and to open the test editor on the created node pool:
-f hcl-onetest-server/values-dedicated-nodes.yaml

After you install the server software by enabling the cluster autoscaler feature on your AKS cluster, a new container is used only to run test assets and to open the test editor. 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 HCL OneTest Server.

You can describe the pod by running the kubectl describe pod <pod_name> -n <namespace> command to view a scale event in the following circumstances:
  • When you run test assets from HCL OneTest Server.
  • When you open the test editor from HCL OneTest Server.

When the test asset run or editing of test assets 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.