Skip to content

Cluster Autoscaler does not scale down with Topology Spread (despite max skew being satisfied when scaled down) #8093

Closed
@kevinkrp93

Description

@kevinkrp93

Which component are you using?:
Cluster Autoscaler

What version of the component are you using?:

Component version:

What k8s version are you using (kubectl version)?:

1.30.7

What environment is this in?:

AKS

What did you expect to happen?:

Cluster Autoscaler scale down to 2 nodes from 4

What happened instead?:

Cluster Autoscaler does not scale down nodes

How to reproduce it (as minimally and precisely as possible):

  1. create nodepool with w/ 4 nodes, min/max set to 4
  2. Running Deployment spec
 apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-app
  labels:
    app: test-app
spec:
  replicas: 5
  selector:
    matchLabels:
      app: test-app
  template:
    metadata:
      labels:
        app: test-app
    spec:
      nodeSelector:
        agentpool: kubefabric
      topologySpreadConstraints:
      - maxSkew: 1
        topologyKey: "kubernetes.io/hostname"
        whenUnsatisfiable: DoNotSchedule
        minDomains: 2
        labelSelector:
          matchLabels:
            app: test-app
        matchLabelKeys:
            - pod-template-hash
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
        resources:
          requests:
            memory: "256Mi"
            cpu: "500m"  # 500m = 0.5 CPU core
          limits:
            memory: "512Mi"
            cpu: "1"  # 1 CPU core
  1. set min to 2, and wait for scale down. (There will be no scaledown)
  2. Update Deployment spec to remove topology spread constraints, observe scale down

Anything else we need to know?:

Image

Related to Azure/AKS#4201

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions