AKS icon indicating copy to clipboard operation
AKS copied to clipboard

[BUG] Resource Quota Enforcement as per VM SKU

Open AAFAYZ opened this issue 1 year ago • 4 comments

Describe the bug I tested applying resource quota in the namespaces and found out that: When applying resource quota specifically with cpu and memory limits, it allows us to provide any value even more than the VM SKU values.

To Reproduce I used this resource quota to apply in my AKS having VMSS SKU: Standard_D2as_v5, Standard_D4as_v5

apiVersion: v1 kind: ResourceQuota metadata: name: memory-cpu-quota spec: hard: limits.cpu: "200"

Applied the above yaml file in one of the namespaces. Found out that it gets applied irrespective of the VM SKU maximum CPU limits.

Expected behavior There should be an error given when we apply the yaml file with the VM SKU capacities. When the resource quota is applied by mistakenly with the higher values than the vm sku capacities, there is a small gap of misunderstanding in the team's which highly increases the time for the application developers to work in.

Environment (please complete the following information):

  • CLI Version: 1.30.0
  • Kubernetes version: 1.31.4
  • CLI Extension version [e.g. 1.7.5] if applicable
  • Browser [e.g. chrome, safari] is applicable

AAFAYZ avatar May 19 '25 11:05 AAFAYZ

Just chipping in - I would disagree that this is a bug.

Think about a situation where you have added multiple Nodepools and where they use different SKUs. How would you expect your resource quota validation to handle the numerous situations this throws up.

What if the SKU was changed (downgraded) after the Quota was created?

What is there is a large SKU in play but the Nodes are also tainted so that only certain workloads could deploy there? You could not expect your Resource Quota to understand your intentions of which Nodepools workloads might deploy into.

This is just an area that your K8s Operators should be aware of and on top of (IMO)

MarkTopping avatar May 21 '25 09:05 MarkTopping

Adding @qpetraroia here to investigate if the quota validation can be added to our Deployment Safeguards feature.

julia-yin avatar Jun 05 '25 20:06 julia-yin

Closing as not a bug. As mentioned, there may be multiple node pools and with node auto provisioning, the VM SKUs being selected are dynamic and can change.

Additionally, if a cluster has auto scaler configured, exceeding the capacity of the VM isn't a problem because this will trigger scaling.

sabbour avatar Jun 05 '25 21:06 sabbour

Thanks for the detailed design input. I understand completely but as said can it be added as some kind of validating admission policies or in gatekeeper system policies to enforce this as automation as part of AKS?

Regards, Faiyaz.

AAFAYZ avatar Jun 11 '25 17:06 AAFAYZ