Share via

Validating AKS auto scalar functionality

Varma 1,620 Reputation points
2026-02-16T08:20:59.1466667+00:00

I have aks cluster with node pool 1 having node count 2,

auto scalar is not enabled yet.

but i want to check functionality of auto scalar , i have deployment file with nginx.

so what is the next steps i should do to test this auto scalar functionality ?

Azure Kubernetes Service
Azure Kubernetes Service

An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.


1 answer

Sort by: Most helpful
  1. Ankit Yadav 14,450 Reputation points Microsoft External Staff Moderator
    2026-02-16T08:54:04.4433333+00:00

    Hello @Varma

    If the AKS cluster autoscaler isn’t enabled yet, you’ll first need to enable it. Then, you can deploy a workload that creates unschedulable pods to trigger scaling. This way you can test it out better way.

    Step 1: Enable the Cluster Autoscaler (see below for sample Azure cli command)

    az aks nodepool update \
      --resource-group myResourceGroup \
      --cluster-name myAKSCluster \
      --name nodepool1 \
      --enable-cluster-autoscaler \
      --min-count 1 \
      --max-count 5
    

    This allows AKS to scale the node pool automatically between 1 and 5 nodes, depending on scheduling needs.

    Verify Autoscaler Settings

    Instead of listing node pools, use this command to confirm autoscaler configuration:

    az aks nodepool show \
      --resource-group myResourceGroup \
      --cluster-name myAKSCluster \
      --name nodepool1 \
      --query "{autoscalerEnabled:enableAutoScaling,min:minCount,max:maxCount}" \
      --output table
    

    This reliably shows whether autoscaling is enabled and the configured limits.

    Step 2: Deploy a Workload with Resource Requests

    The cluster autoscaler reacts to resource requests, not actual CPU or memory usage. So defining requests is essential.

    Example deployment:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - name: nginx
            image: nginx
            resources:
              requests:
                cpu: "500m"
                memory: "512Mi"
    

    Apply it:

    kubectl apply -f nginx-deployment.yaml
    

    Step3: Trigger Scale up

    Increase the number of replicas beyond the current node capacity:

    kubectl scale deployment nginx-deployment --replicas=15
    

    Some pods should move into a Pending state due to insufficient resources:

    kubectl get pods
    

    When unschedulable pods are detected, the cluster autoscaler will automatically add nodes (within the defined min/max range).

    Step 4: Observe Scaling Activity

    You can monitor the behavior using:

    Watch nodes in real time:

    kubectl get nodes -w
    

    Check cluster events:

    kubectl get events
    

    Or review scaling activity in the Azure Portal under: AKS -> Node pools

    Step 5: Test Scale-Down

    Reduce replicas using:-

    kubectl scale deployment nginx-deployment --replicas=1
    

    After nodes remain underutilized for a period of time, the autoscaler will gradually remove extra nodes down to the configured minimum.

    References:


    If there are any follow-up queries here or if you run into any failures while trying the above commands, just let me know in the comments and I'll be happy to help you out further.

    If this helped to clarify your query, please don't forget to click on "Accept Answer" button.

    Accept Answer button would look something like below:

    User's image

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.