Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize automatic scaling of K8S Cluster Autoscaler Cluster

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to achieve K8S Cluster Autoscaler cluster automatic scaling, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

What is cluster-autoscaler?

Cluster Autoscaler (CA) is a stand-alone program that is used to scale kubernetes clusters. One of the questions often asked when using kubernetes clusters is, how large the node size should be maintained to meet the application needs? the emergence of cluster-autoscaler solves this problem, it can automatically scale the cluster dynamically according to the amount of resources requested by the deployment application.

Project address: https://github.com/kubernetes/autoscaler

When will Cluster Autoscaler scale the cluster?

In the following cases, the cluster is automatically expanded or scaled:

Capacity expansion: due to insufficient resources, some Pod cannot be scheduled on any current node

Capacity reduction: when the resource utilization of the Node node is low, and the pod existing on this node node can be rescheduled to run on other node nodes

When will the cluster node not be deleted by CA?

The pod on the node is restricted by the PodDisruptionBudget controller.

There is a pods on the node with the namespace kube-system.

The pod on the node is not created by the controller, for example, not by deployment, replica set, job, stateful set.

There is pod on the node that uses local storage

After the pod is expelled on the node, there is nowhere to go, that is, no other node can schedule the pod

The node has comments: "cluster-autoscaler.kubernetes.io/scale-down-disabled": "true" (supported in CA 1.0.3 or later)

How does Horizontal Pod Autoscaler work with Cluster Autoscaler?

Horizontal Pod Autoscaler changes the number of replicas of the deployment or replica set based on the current CPU load. If the load increases, HPA will create a new copy, and there may or may not be enough space in the cluster. If there are not enough resources, CA will try to start some nodes so that the Pod created by HPA can run. If the load is reduced, HPA stops some replicas. As a result, some nodes may become underutilized or completely empty, and then CA will terminate these unwanted nodes.

How to prevent nodes from being deleted by CA?

Starting with CA 1.0, nodes can be labeled as follows:

"cluster-autoscaler.kubernetes.io/scale-down-disabled": "true"

You can add it to (or remove it from) a node using kubectl:

$kubectl annotate nodecluster-autoscaler.kubernetes.io/scale-down-disabled=true

Run Cluster Autoscaler best practices?

Do not directly modify nodes that belong to a group of auto-scaling nodes. All nodes in the same node group should have the same capacity, label, and system pod running on it

Pod declares requests resource restrictions

Use PodDisruptionBudgets to prevent sudden deletion of Pod (if necessary)

Before you specify the minimum / maximum settings for the node pool, check that your cloud provider's quota is large enough

Do not run any other node group auto scalers (especially from your cloud provider)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report