Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AKS] Autoscale agentpool based on node-level CPU usage metrics #6690

Closed
nemobis opened this issue Apr 4, 2024 · 8 comments
Closed

[AKS] Autoscale agentpool based on node-level CPU usage metrics #6690

nemobis opened this issue Apr 4, 2024 · 8 comments
Labels
area/cluster-autoscaler kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@nemobis
Copy link

nemobis commented Apr 4, 2024

Which component are you using?:

Cluster autoscaler

Is your feature request designed to solve a problem? If so describe the problem this feature should solve.:

While I can scale the number of pods for my workloads based on pod-level CPU usage, this isn't always enough. In some circumstances, even if all nodes are at 100 % CPU usage and autoscaling is enabled, no new nodes will be scheduled because the autoscaler only looks at CPU requests.

Describe the solution you'd like.:

I'd like to be able to configure limits in CPU usage for nodes in an agentpool, so that new nodes are added when the node-level CPU usage is above the limit, and new pods can be scheduled on non-breaching nodes only.

Describe any alternative solutions you've considered.:

The kubernetes descheduler could be used to remove pods from overloaded nodes (where the real node-level CPU usage as reported by the kernel to node-exporter is above, say, 95 %). To prevent the pod from being scheduled on the same node again, something else should take care of disabling scheduling on the overloaded node (the RemovePodsViolatingNodeTaints option would also be relevant). Once all nodes become unschedulable, a newly scheduled pod would trigger a request for a new node.

This is possible but sounds a bit roundabout, and the descheduler seems overkill.

Additional context.:

Cluster autoscaling, at least on AKS, only consider memory and CPU requests. When a node is under memory pressure, scheduling is disabled, pods get OOM'ed and eventually the rescheduled pods will cause a new node to be added. However, for CPU pressure this doesn't really happen, and pods may remain starved for CPU indefinitely.

Custom controllers are mentioned as one possibility. I don't want to build a full-blown operator for my assorted loads, when the problem is generic enough.

@nemobis nemobis added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 4, 2024
@nemobis
Copy link
Author

nemobis commented Apr 4, 2024

I've filed this here as a starting point because I didn't know how to determine whether it's out of scope for the kubernetes autoscaler. I see there are some alternative node autoscalers like https://karpenter.sh with different approaches.

@nemobis
Copy link
Author

nemobis commented Apr 4, 2024

#4016 seems somewhat related, though it would need at least something like #5153 to get real node-level metrics.

@nemobis
Copy link
Author

nemobis commented Apr 4, 2024

I see in the FAQ that

CPU-based (or any metric-based) cluster/node group autoscalers, like GCE Instance Group Autoscaler, are NOT compatible with CA. They are also not particularly suited to use with Kubernetes in general.

https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#is-cluster-autoscaler-compatible-with-cpu-usage-based-node-autoscalers

So I suspect this feature request will be declined. The reasons seem to apply mostly to nodepool downscaling, not to upscaling. The sentence

Cluster Autoscaler makes sure that all pods in the cluster have a place to run, no matter if there is any CPU load or not.

make no sense if you're scheduling a new pod on a node which has already run out of CPU cycles.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 3, 2024
@adrianmoisey
Copy link
Member

/area cluster-autoscaler

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 7, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2024
@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cluster-autoscaler kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

4 participants