In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about what are the new features of Kubernetes. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
New feature background
Different applications have different business values and different requirements for expansion and reduction, such as the following three types of applications:
Critical traffic processing applications: this kind of applications want to expand rapidly when the traffic arrives, and slowly reduce the capacity after the traffic peak has passed, in order to avoid the rebound of traffic.
Critical data processing applications: this kind of applications want to expand rapidly when a large amount of data arrives, and quickly reduce capacity when the data is reduced, so as to save costs.
Conventional traffic / data processing applications: this kind of application is not so important and can slowly expand and reduce capacity to avoid jitter caused by rapid expansion and reduction.
However, the current version of the implementation (1.15-1.16) can not meet the expectations of such applications.
The current version of the kube-controller-manager parameter, horizontal-pod-autoscaler-downscale-stabilization, can control the speed of capacity reduction to some extent. A recommended zoom value is calculated and recorded in each scheduling period (default is 30s). Each time the scaling value is calculated, the historical recommended value is checked, and the largest one is selected from the most recent historical recommended value. Downscale-stabilization is used to specify this time window, and the default is 5min.
In addition, at the HPA controller level, there are two hard-coded constants that control the speed of expansion:
ScaleUpLimitFactor = 2.0 / / expansion multiple
ScaleUpLimitMinimum = 4.0 / / number of capacity expansion
The algorithm for calculating the target value of capacity expansion is as follows:
Max (current number of scaleUpLimitFactor* copies, scaleUpLimitMinimum))
In other words, the capacity expansion is either doubled or 4 pod is expanded, which is the larger of the two. On the one hand, this expansion speed does not meet the application requirements mentioned above, on the other hand, the hard code is really not friendly, although it is designed to expand steadily to avoid jitter. Note: the algorithm mentioned here is at the HPA controller level. The expansion ratio is calculated according to the current value and target value of each HPA, and then the algorithm is applied to limit the expansion speed.
To sum up, the implementation of the current version can not meet the demand of some applications for capacity expansion, and we need to make some improvements. The goal of this article is to analyze the results of the community discussion on this requirement, which can be regarded as analyzing the new features in advance, but the final implementation may not be consistent with this.
New feature goal
Combined with the above background, it is not difficult to see that this improvement goal has two points:
Allow users to control the expansion and expansion speed more accurately.
Allow users to control the expansion speed at the HPA level (each HPA can have personalized control)
New feature design
Since you want to control each HPA separately, you need to add the corresponding parameters to the HPA resource API, so the following four parameters will be introduced:
PeriodSeconds (cycle of capacity expansion)
We know that there is a parameter (--horizontal-pod-autoscaler-sync-period) in kube-controller-manager that controls the HPA controller processing cycle, in which all HPA is processed (scaling recommendations are generated for HPA, and scaling is performed).
The periodSeconds introduced in this plan controls the interval between the two scaling operations of each HPA, which can also be called cooldown time.
Percent (percentage of expansion and reduction)
As the name implies, this is the percentage that controls the expansion and reduction of capacity, which can be simply understood as changing the hard-coded scaleUpLimitFactor = 2.0 into a configurable item.
For example, if ScaleUpPercent is 150, the proportion of each capacity expansion is 150% (10muri-> 25).
Pods (expand and reduce the number of capacity)
This is to control the absolute number of each expansion and reduction, which can be simply understood as changing the hard-coded scaleUpLimitMinimum = 4.0 into a configurable item.
For example, if ScaleUpPods = 5, the number of capacity expansion each time will be 5 (10muri-> 15).
Delay
This parameter is the same as the horizontal-pod-autoscaler-downscale-stabilization meaning of kube-controller-manager, that is, when calculating the capacity expansion, we need to look back at the recommended value for how long (the largest one is selected), which can be simply understood as sinking the parameters of kube-controller-manager to the HPA level.
It is important to note that these parameters can control both expansion and reduction. Here are some examples to illustrate how to use them.
New feature example Story 1: I hope the application can be expanded as soon as possible
When you want the application to be expanded as soon as possible, you can use a larger percent. For example:
ScaleUp
Percent = 900 (each expansion is 900%, that is, 10 times the speed)
If the initial number of pod is 1, then the expansion path is as follows:
1-> 10-> 100-> 1000
Of course, HPA's existing maxReplicas is still valid, and the maximum number of pod cannot exceed this setting.
Story 2: I hope the application can be expanded and reduced gradually as soon as possible.
When you want the application to be expanded as soon as possible and reduced more slowly, you can use the following configuration:
ScaleUp
Percent = 900,
ScaleDown
Pods = 1 (one pod per reduction)
PeriodSeconds = 600 (downsizing every 10 minutes)
If the initial number of pod is 1, then the expansion path is as follows:
1-> 10-> 100-> 1000
At the same time, the downsizing path is as follows (one pod for each reduction every 10 minutes):
1000-> 1000-> 1000->... (7 more min)-> 999Story 3: I hope to slowly expand capacity and reduce capacity normally.
For slow capacity expansion and normal capacity reduction, you can use the following configuration:
ScaleUp
Pods = 1
If the initial number of pod is 1, then the expansion path is as follows:
1-> 2-> 3-> 4Story 4: I hope normal capacity expansion, not automatic capacity reduction
If you want to expand the capacity normally, but do not automatically reduce the capacity, you can use the following configuration:
ScaleDown:
Percent= 0
Pods = 0
If you set the percentage of reduction and pod to 0, you will never scale down.
Story 5: I want to scale down more carefully
If you want to be more cautious when downsizing, you can use delaySeconds (which is very similar to kube-controller-manager 's horizontal-pod-autoscaler-downscale-stabilization). The configuration is as follows:
ScaleDown:
Pods = 5
DelaySeconds = 600,
Then, each reduction up to 5 pod, at the same time each reduction, at least see the previous 600s recommended value, select the maximum value. In this way, you will become very cautious when downsizing.
API change
The main change in API is to add a Constraints field to the HorizontalPodAutoscalerSpec.
Type HPAScaleConstraintValue struct {Rate * HPAScaleConstraintRateValue DelaySeconds * int32type HPAScaleConstraintRateValue struct {Pods * int32 Percent * int32 PeriodSeconds * int32} type HPAScaleConstraints struct {ScaleUp * HPAScaleConstraintValue ScaleDown * HPAScaleConstraintValue} type HorizontalPodAutoscalerSpec struct {ScaleTargetRef CrossVersionObjectReference MinReplicas * int32 MaxReplicas int32 Metrics [] MetricSpec Constraints * HPAScaleConstraints} Thank you for reading! This is the end of this article on "what are the new features of Kubernetes". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.