CN112559186B - Kubernetes container resource expansion and contraction method - Google Patents
Kubernetes container resource expansion and contraction method Download PDFInfo
- Publication number
- CN112559186B CN112559186B CN202011524569.XA CN202011524569A CN112559186B CN 112559186 B CN112559186 B CN 112559186B CN 202011524569 A CN202011524569 A CN 202011524569A CN 112559186 B CN112559186 B CN 112559186B
- Authority
- CN
- China
- Prior art keywords
- expansion
- resource
- container
- reaches
- executing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000008602 contraction Effects 0.000 title claims abstract description 26
- 238000000034 method Methods 0.000 title claims abstract description 15
- 230000009467 reduction Effects 0.000 claims abstract description 9
- 238000012544 monitoring process Methods 0.000 claims abstract description 4
- 230000007246 mechanism Effects 0.000 abstract description 3
- 230000000694 effects Effects 0.000 description 3
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
A Kubernetes container resource expansion and contraction method comprises the following specific steps: s1, acquiring Metrics Server monitoring information, and judging whether the resource usage reaches the capacity expansion standard and the capacity reduction standard: if the capacity expansion standard is reached, executing S2; s2, judging whether the number of instances reaches the upper limit; if yes, go to S3; s3, judging whether the resource use reaches the upper limit; if not, executing S4; s4, judging whether the increased resources can be scheduled successfully; if yes, go to S5; s5, creating a new deployment set, increasing the number of resources and expanding the capacity; if the resource usage reaches the capacity reduction standard, executing S10; s10, judging whether the number of the deployment sets reaches the minimum value; if the number of deployment sets does not reach the minimum value, executing S11; and S11, deleting the newly created deployment set and carrying out capacity reduction. The invention carries out the expansion and contraction at the level of the deployment set, so that the horizontal expansion and the vertical expansion coexist, a more comprehensive and comprehensive elastic expansion mechanism is provided, and the expansion and contraction efficiency is improved.
Description
Technical Field
The invention relates to a Kubernetes container resource arrangement platform, in particular to a Kubernetes container resource expansion and contraction method.
Background
One core function of Kubernetes is to support elastic expansion and contraction of container resources so as to deal with the scene that the system load pressure changes along with time; when the load pressure is high, the container resources are automatically expanded to ensure the response speed of the system and prevent the system from being broken down by large flow; when the load is low, the container resources are automatically reduced, so that the resources are saved. The basic unit of Kubernetes resource scheduling is a container group (Pod), a group of same Pod resources are managed through a Deployment set (Deployment), the value of the copy number (Replica) in the Deployment set is the number of the pods managed by the Deployment set, and the CPU and the memory resources of the container in each Pod are configured in a Pod template of the Deployment set; the current Kubernetes container resource elastic expansion and contraction includes Horizontal expansion and contraction (HPA) and Vertical expansion and contraction (VPA).
In the prior art, horizontal expansion and vertical expansion of the same Deployment are possibly in conflict and cannot be used simultaneously; if the horizontal expansion is used only, the scene that the lowest resource demand exceeds the current configuration value after the system runs for a period of time cannot be dealt with; if the vertical expansion is used only, the vertical expansion is limited by node resources, and has an upper limit, so that a scene with extremely high resource demand cannot be met, and the existing Pod needs to be deleted and reconstructed during the vertical expansion, which may cause interruption to the existing service connection request.
Disclosure of Invention
Objects of the invention
In order to solve the technical problems in the background technology, the invention provides a Kubernetes container resource expansion and contraction method.
(II) technical scheme
The invention provides a Kubernetes container resource expansion and contraction method, which comprises the following specific steps:
s1, acquiring Metrics Server monitoring information, and judging whether the resource usage reaches the capacity expansion standard and the capacity reduction standard:
if the resource usage reaches the capacity expansion standard, executing S2;
if the resource usage reaches the capacity reduction standard, executing S10;
s2, judging whether the number of instances reaches the upper limit;
if the number of instances reaches the upper limit, go to S3;
if the number of instances reaches the non-upper limit, go to S6;
s3, judging whether the resource use reaches the upper limit;
if the resource usage reaches the upper limit, returning to execute S1;
if the resource usage does not reach the upper limit, executing S4;
s4, judging whether the increased resources can be scheduled successfully;
if the resource pre-scheduling is successfully increased, executing S5;
if the increase of the resource pre-scheduling fails, returning to execute S1;
s5, creating a new deployment set and increasing the number of resources;
s6, judging whether the resource use reaches the upper limit;
if the resource usage reaches the upper limit, go to S9;
if the resource usage does not reach the upper limit, executing S7;
s7, judging whether the increased resources can be scheduled successfully;
if the resource pre-scheduling is successfully increased, executing S8;
if the increase of the resource pre-scheduling fails, executing S9;
s8, creating a new deployment set, and increasing the number of instances and resources;
s9, creating a new deployment set, and only increasing the number of instances;
s10, judging whether the number of the deployment sets reaches the minimum value;
if the number of the deployment sets reaches the minimum value, returning to the step S1;
if the number of deployment sets does not reach the minimum value, executing S11;
and S11, deleting the newly created deployment set.
Preferably, also includes Kubernetes' container; the Kubernetes container includes a horizontal container bank jack and a vertical container bank jack.
Preferably, the horizontal container group retractors are connected with the deployment set; the deployment set includes a container group copy number; the deployment set container group copy number includes container group a1, container group a2, … …, and container group AN.
Preferably, the vertical container group retractors are connected with the deployment set; the deployment set includes container resources; the deployment set container resource includes container group B1, container group B2, … …, and container group BN.
Compared with the prior art, the technical scheme of the invention has the following beneficial technical effects:
in the invention, the capacity expansion is not carried out at the Pod level, but at the Deployment level; the newly expanded Deployment and the original Deployment can realize the effects of horizontal expansion and vertical expansion at different values of Replicas, a container CPU and an internal memory, provide a more comprehensive and comprehensive elastic expansion mechanism, improve the efficiency of expansion and contraction, perform vertical expansion under the condition of not deleting and rebuilding the existing Pod and avoid causing long service connection interruption.
Drawings
Fig. 1 is a flowchart of a kubernets container resource expansion and contraction method provided by the present invention.
Fig. 2 is a horizontal container group expansion and contraction device of the kubernets container resource expansion and contraction method provided by the invention.
Fig. 3 is a vertical container group expansion and contraction device of the kubernets container resource expansion and contraction method provided by the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings in conjunction with the following detailed description. It should be understood that the description is intended to be exemplary only, and is not intended to limit the scope of the present invention. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present invention.
As shown in fig. 1-3, the kubernets container resource expansion and contraction method provided by the present invention includes the following specific steps:
s1, acquiring Metrics Server monitoring information, and judging whether the resource usage reaches the capacity expansion standard and the capacity reduction standard:
if the resource usage reaches the capacity expansion standard, executing S2;
if the resource usage reaches the capacity reduction standard, executing S10;
s2, judging whether the number of instances reaches the upper limit;
if the number of instances reaches the upper limit, go to S3;
if the number of instances reaches the non-upper limit, go to S6;
s3, judging whether the resource use reaches the upper limit;
if the resource usage reaches the upper limit, returning to execute S1;
if the resource usage does not reach the upper limit, executing S4;
s4, judging whether the increased resources can be scheduled successfully;
if the resource pre-scheduling is successfully increased, executing S5;
if the increase of the resource pre-scheduling fails, returning to execute S1;
s5, creating a new deployment set and increasing the number of resources;
s6, judging whether the resource use reaches the upper limit;
if the resource usage reaches the upper limit, go to S9;
if the resource usage does not reach the upper limit, executing S7;
s7, judging whether the increased resources can be scheduled successfully;
if the resource pre-scheduling is successfully increased, executing S8;
if the increase of the resource pre-scheduling fails, executing S9;
s8, creating a new deployment set, and increasing the number of instances and resources;
s9, creating a new deployment set, and only increasing the number of instances;
s10, judging whether the number of the deployment sets reaches the minimum value;
if the number of the deployment sets reaches the minimum value, returning to the step S1;
if the number of deployment sets does not reach the minimum value, executing S11;
and S11, deleting the newly created deployment set.
In the invention, the capacity expansion is not carried out at the Pod level, but at the Deployment level; the newly expanded Deployment and the original Deployment can realize the effects of horizontal expansion and vertical expansion at different values of Replicas, a container CPU and an internal memory, provide a more comprehensive and comprehensive elastic expansion mechanism, improve the efficiency of expansion and contraction, perform vertical expansion under the condition of not deleting and rebuilding the existing Pod and avoid causing long service connection interruption.
In an alternative embodiment, a kubernets container is also included; the Kubernetes container includes a horizontal container bank jack and a vertical container bank jack.
In an alternative embodiment, horizontal container group expanders connect deployment sets; the deployment set includes a container group copy number; the deployment set container group copy number includes container group a1, container group a2, … …, and container group AN.
In an alternative embodiment, vertical vessel group expanders connect the deployment set; the deployment set includes container resources; the deployment set container resource includes container group B1, container group B2, … …, and container group BN.
It is to be understood that the above-described embodiments of the present invention are merely illustrative of or explaining the principles of the invention and are not to be construed as limiting the invention. Therefore, any modification, equivalent replacement, improvement and the like made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. Further, it is intended that the appended claims cover all such variations and modifications as fall within the scope and boundaries of the appended claims or the equivalents of such scope and boundaries.
Claims (4)
1. A Kubernetes container resource expansion and contraction method is characterized by comprising the following specific steps:
s1, acquiring Metrics Server monitoring information, and judging whether the resource usage reaches the capacity expansion standard and the capacity reduction standard:
if the resource usage reaches the capacity expansion standard, executing S2;
if the resource usage reaches the capacity reduction standard, executing S10;
s2, judging whether the number of instances reaches the upper limit;
if the number of instances reaches the upper limit, go to S3;
if the number of instances reaches the non-upper limit, go to S6;
s3, judging whether the resource use reaches the upper limit;
if the resource usage reaches the upper limit, returning to execute S1;
if the resource usage does not reach the upper limit, executing S4;
s4, judging whether the increased resources can be scheduled successfully;
if the resource pre-scheduling is successfully increased, executing S5;
if the increase of the resource pre-scheduling fails, returning to execute S1;
s5, creating a new deployment set and increasing the number of resources;
s6, judging whether the resource use reaches the upper limit;
if the resource usage reaches the upper limit, go to S9;
if the resource usage does not reach the upper limit, executing S7;
s7, judging whether the increased resources can be scheduled successfully;
if the resource pre-scheduling is successfully increased, executing S8;
if the increase of the resource pre-scheduling fails, executing S9;
s8, creating a new deployment set, and increasing the number of instances and resources;
s9, creating a new deployment set, and only increasing the number of instances;
s10, judging whether the number of the deployment sets reaches the minimum value;
if the number of the deployment sets reaches the minimum value, returning to the step S1;
if the number of deployment sets does not reach the minimum value, executing S11;
and S11, deleting the newly created deployment set.
2. The Kubernetes container resource expansion and contraction method according to claim 1, further comprising a Kubernetes container; the Kubernetes container includes a horizontal container bank jack and a vertical container bank jack.
3. The Kubernetes container resource expansion and contraction method according to claim 2, wherein a horizontal container group expansion and contraction device is connected with a deployment set; the deployment set includes a container group copy number; the deployment set container group copy number includes container group a1, container group a2, … …, and container group AN.
4. The Kubernetes container resource expansion and contraction method according to claim 2, wherein a vertical container group expansion and contraction device is connected with a deployment set; the deployment set includes container resources; the deployment set container resource includes container group B1, container group B2, … …, and container group BN.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011524569.XA CN112559186B (en) | 2020-12-22 | 2020-12-22 | Kubernetes container resource expansion and contraction method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011524569.XA CN112559186B (en) | 2020-12-22 | 2020-12-22 | Kubernetes container resource expansion and contraction method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112559186A CN112559186A (en) | 2021-03-26 |
CN112559186B true CN112559186B (en) | 2021-09-24 |
Family
ID=75032082
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011524569.XA Active CN112559186B (en) | 2020-12-22 | 2020-12-22 | Kubernetes container resource expansion and contraction method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112559186B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113297031B (en) * | 2021-05-08 | 2024-09-24 | 阿里巴巴创新公司 | Container group protection method and device in container cluster |
CN115617517B (en) * | 2022-10-12 | 2023-11-10 | 中航信移动科技有限公司 | Data processing system for applying pod control |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108108223B (en) * | 2017-11-30 | 2022-05-24 | 国网浙江省电力公司信息通信分公司 | Kubernetes-based container management platform |
CN109067862B (en) * | 2018-07-23 | 2020-10-16 | 北京邮电大学 | Method and device for automatic scaling of API Gateway |
CN109379425A (en) * | 2018-10-16 | 2019-02-22 | 浪潮软件集团有限公司 | Distributed cluster deployment management method and device |
CN109446032A (en) * | 2018-12-19 | 2019-03-08 | 福建新大陆软件工程有限公司 | Method and system for Kubernetes replica expansion and contraction |
CN109947537A (en) * | 2019-03-28 | 2019-06-28 | 山东浪潮云信息技术有限公司 | Create the system and method for cloud container service |
US11650837B2 (en) * | 2019-04-26 | 2023-05-16 | Hewlett Packard Enterprise Development Lp | Location-based virtualization workload placement |
CN110262899B (en) * | 2019-06-20 | 2021-05-11 | 华云数据控股集团有限公司 | Monitoring component elastic expansion method and device based on Kubernetes cluster and controlled terminal |
CN110287029A (en) * | 2019-06-27 | 2019-09-27 | 中国—东盟信息港股份有限公司 | A method of it is adjusted based on kubernetes container resource dynamic |
-
2020
- 2020-12-22 CN CN202011524569.XA patent/CN112559186B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN112559186A (en) | 2021-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112559186B (en) | Kubernetes container resource expansion and contraction method | |
CN108429631B (en) | Method and device for instantiating network service | |
CN106487553A (en) | The processing method of VNF example, device and VNFM | |
CN110138753B (en) | Distributed message service system, method, apparatus, and computer-readable storage medium | |
US20150370593A1 (en) | System construction device and system construction method | |
CN103617007A (en) | Method and system for achieving multilevel intelligent storage | |
CN103248522A (en) | Performance data reporting method and device | |
CN104144202A (en) | Hadoop distributed file system access method, system and device | |
CN104915387B (en) | A system and method for processing static pages of an Internet website | |
CN109391978A (en) | Terminal switching method and device | |
CN103200257A (en) | A node and its resource switching method in a high-availability cluster system | |
CN116244061A (en) | Pod scheduling method, storage medium and device based on k8s | |
CN110070260A (en) | Intelligent dispatching method, device, computer equipment and storage medium | |
CN112540842B (en) | Method and device for dynamically adjusting system resources | |
CN118733253A (en) | Container scheduling method, device, storage medium and electronic device for distributed system | |
CN117914675A (en) | A method and device for constructing a distributed cache system | |
CN108121580B (en) | Method and device for realizing application program notification service | |
CN116643858A (en) | Service priority pod-based rescheduling method, device, equipment and medium | |
CN112260398B (en) | Power grid monitoring system supporting dynamic expansion | |
CN116302339A (en) | A method and system for in-place expansion and contraction of a container group based on a container cloud platform | |
CN110851199B (en) | An information protection system in a power system and an initialization method thereof | |
CN105142218A (en) | Network paging method and network paging device | |
CN108632769B (en) | Group complementary building method and device | |
US12250118B2 (en) | Management system, and method for upgrading cluster | |
CN113347692B (en) | Power utilization system, method and equipment, and computer-readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |