CN113395178B - Method and device for elastic expansion and contraction of container cloud - Google Patents

Method and device for elastic expansion and contraction of container cloud Download PDF

Info

Publication number
CN113395178B
CN113395178B CN202110651643.2A CN202110651643A CN113395178B CN 113395178 B CN113395178 B CN 113395178B CN 202110651643 A CN202110651643 A CN 202110651643A CN 113395178 B CN113395178 B CN 113395178B
Authority
CN
China
Prior art keywords
node
capacity expansion
expansion
utilization rate
preset
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
Application number
CN202110651643.2A
Other languages
Chinese (zh)
Other versions
CN113395178A (en
Inventor
赵贝
马忠飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Juhaokan Technology Co Ltd
Original Assignee
Juhaokan Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Juhaokan Technology Co Ltd filed Critical Juhaokan Technology Co Ltd
Priority to CN202110651643.2A priority Critical patent/CN113395178B/en
Publication of CN113395178A publication Critical patent/CN113395178A/en
Priority to PCT/CN2021/128490 priority patent/WO2022257347A1/en
Application granted granted Critical
Publication of CN113395178B publication Critical patent/CN113395178B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0896Bandwidth or capacity management, i.e. automatically increasing or decreasing capacities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/147Network analysis or design for predicting network behaviour
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • H04L41/5041Network service management, e.g. ensuring proper service fulfilment according to agreements characterised by the time relationship between creation and deployment of a service
    • H04L41/5051Service on demand, e.g. definition and deployment of services in real time
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a method and a device for elastic cloud expansion of a container, wherein the device comprises a micro-service, cluster node resources, an automatic expansion controller, a node controller and a node resource pool; the method comprises the steps of judging whether the resource utilization rate of the micro service meets a preset capacity expansion condition or not, calculating the resources required for capacity expansion when the preset capacity expansion condition is met, judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not, and calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion when the residual nodes do not meet the resources required for capacity expansion; and selecting the node meeting the minimum specification from the node resource pool as a new node to join in the cluster node resource according to the minimum specification request required by capacity expansion. The capacity expansion node is realized in advance by automatically monitoring the cluster state and the current resource utilization rate of the micro-service, two-stage elastic capacity expansion and contraction are realized, quick capacity expansion is realized, the service requirement is better met, and the capacity expansion is automatically reduced after the service flow is reduced, so that the cost is saved.

Description

Method and device for elastic expansion and contraction of container cloud
Technical Field
The application relates to the technical field of networks, in particular to a method and a device for elastic cloud expansion of a container.
Background
Under a container cloud cluster based on Kubernetes, a large number of micro services are managed and scheduled, each micro service can have a plurality of instances (pod), and in a container form, the micro services are distributed to run on a plurality of nodes of a cloud platform, so that certain peak periods inevitably exist in application, and with the sudden increase of traffic, the instances of the micro services are difficult to deal with the increase of traffic.
Kubernets have a Pod level automatic scaling (HPA) function, the HPA obtains monitoring index data of the utilization rate of micro-service resources through a resource monitoring system in a cluster, compares the monitoring index data with a preset threshold value, and creates a new instance when the monitoring index data exceeds the preset threshold value; the HPA can well solve the expansion of the micro-service instance, but when the node resources are not enough to deploy a new instance, the HPA cannot expand, and further automatic expansion cannot be realized.
In the related art, a public cloud with node capacity expansion is subjected to capacity expansion when an instance in a monitoring cluster cannot be scheduled; however, it takes time to expand the node, and after the node is created, the micro service traffic has already decreased, and the service request cannot be processed.
Disclosure of Invention
The application provides a method and a device for elastic cloud expansion of a container, which can be used for solving the technical problem that the existing node expansion is carried out when an instance in a cluster cannot be scheduled, so that the node expansion cannot meet the current micro-service flow demand.
In a first aspect, the application provides a device for elastic cloud expansion of a container, which comprises a micro-service, cluster node resources, an automatic expansion controller, a node controller and a node resource pool;
the automatic scaling controller is used for monitoring the micro-service and the cluster node resources, and the micro-service starts HPA;
judging whether the resource utilization rate of the micro service meets a preset capacity expansion condition or not;
when a preset capacity expansion condition is met, calculating resources required for capacity expansion, and monitoring the residual nodes in the cluster node resources, wherein the resources required for capacity expansion comprise the pod number and the pod corresponding specification;
judging whether the residual nodes in the cluster node resources meet the resources required by capacity expansion;
when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion;
sending a minimum specification request required for capacity expansion to the node controller;
and the node controller responds to a minimum specification request required by the capacity expansion of the automatic expansion controller, and selects a node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource.
With reference to the first aspect, in an implementation manner, the presetting of the capacity expansion condition includes:
acquiring the resource utilization rate of the micro service within first preset time, and calculating the average value of the resource utilization rate to obtain the average resource utilization rate;
calculating the difference value between the average resource utilization rate and a preset threshold upper limit;
and when the difference value is smaller than the preset expansion value, the resource utilization rate meets the preset expansion condition.
With reference to the first aspect, in an implementation manner, the presetting of the capacity expansion condition further includes:
acquiring the resource utilization rate within second preset time, and acquiring the change trend of the resource utilization rate;
predicting the next resource utilization rate according to the change trend;
calculating the difference value between the next resource utilization rate and the preset threshold upper limit;
and when the difference value is smaller than the preset expansion value, the resource utilization rate meets the preset expansion condition.
With reference to the first aspect, in an implementation manner, the automatic scaling controller is further configured to determine whether a resource usage rate of the micro service meets a preset scaling condition;
when the preset capacity reduction condition is met, monitoring the rest nodes in the cluster node resources, taking the nodes without the corresponding micro service instances as nodes to be offline, and sending an offline node request to a node controller;
and the node controller responds to the offline node request, appoints the node to be offline, and returns the node to be offline to the node resource pool.
With reference to the first aspect, in an implementation manner, the apparatus further includes a database, where the database is used to store node names and corresponding node specifications.
With reference to the first aspect, in an implementation manner, selecting a node that meets a minimum specification from a node resource pool as a new node to join in the cluster node resource includes:
selecting the node corresponding to the minimum specification as a node to be added according to the database;
initializing the nodes to be added, and optimizing the kernel parameters of the nodes to be added;
calling an installation docker script and installing docker service;
and calling and installing a Kubernetes system service script, completing installation, and adding the node to be added as a new node into the cluster node resource.
According to the technical scheme, in the first aspect, the application provides a device for elastic cloud expansion of a container, which comprises a micro service, cluster node resources, an automatic expansion controller, a node controller and a node resource pool; the automatic scaling controller is used for monitoring the micro-service and the cluster node resources, and the micro-service starts HPA; judging whether the resource utilization rate of the micro service meets a preset capacity expansion condition or not; when a preset capacity expansion condition is met, calculating resources required for capacity expansion, and monitoring the residual nodes in the cluster node resources, wherein the resources required for capacity expansion comprise the pod number and the pod corresponding specification; judging whether the residual nodes in the cluster node resources meet the resources required by capacity expansion; when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; sending a minimum specification request required for capacity expansion to the node controller; and the node controller responds to a minimum specification request required by the capacity expansion of the automatic expansion controller, and selects a node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource. The device realizes node expansion and contraction capacity in advance, ensures that a cluster has expansion conditions during service expansion, realizes two-stage elastic expansion and contraction capacity, realizes expansion nodes in advance by automatically monitoring cluster states and micro-service current resource utilization rate, can be directly dispatched without waiting during service expansion, better meets service requirements, realizes quick expansion, automatically reduces capacity after service flow is reduced, and saves cost.
In a second aspect, the present application provides a method for elastic cloud stretching of a container, comprising:
acquiring the resource utilization rate of a micro service, wherein the micro service starts an HPA;
judging whether the resource utilization rate of the micro service meets a preset capacity expansion condition or not, calculating the resources required for capacity expansion when the preset capacity expansion condition is met, and acquiring the residual nodes in the cluster node resources, wherein the resources required for capacity expansion comprise pod numbers and pod corresponding specifications;
judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not, and when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion;
and selecting the node meeting the minimum specification from the node resource pool as a new node to join the cluster node resource according to the minimum specification request required by capacity expansion.
With reference to the second aspect, in an implementation manner, determining whether the resource usage rate of the micro service meets a preset capacity expansion condition includes:
acquiring the resource utilization rate of the micro service within first preset time, and calculating the average value of the resource utilization rate to obtain the average resource utilization rate;
and calculating a difference value between the average resource utilization rate and a preset threshold upper limit, wherein when the difference value is smaller than a preset expansion value, the resource utilization rate meets a preset expansion condition.
With reference to the second aspect, in an implementation manner, determining whether the resource usage rate of the micro service meets a preset capacity expansion condition further includes:
acquiring the resource utilization rate within second preset time, acquiring the variation trend of the resource utilization rate, and predicting the next resource utilization rate according to the variation trend;
and calculating a difference value between the next resource utilization rate and the preset threshold upper limit, wherein when the difference value is smaller than the preset expansion value, the resource utilization rate meets the preset expansion condition.
With reference to the second aspect, in one implementation manner, the method further includes:
judging whether the resource utilization rate of the micro service meets a preset capacity reduction condition or not, monitoring the rest nodes in the cluster node resource when the preset capacity reduction condition is met, taking the nodes without the corresponding micro service instances as nodes to be offline, and sending an offline node request to a node controller;
and the node controller puts the node to be offline back to the node resource pool.
According to the technical scheme, the second aspect of the application provides a method for elastic expansion and contraction of a container cloud, which comprises the steps of obtaining the resource utilization rate of a micro-service, wherein the micro-service starts an HPA; judging whether the resource utilization rate of the micro-service meets a preset capacity expansion condition or not, calculating the resources required for capacity expansion when the preset capacity expansion condition is met, and acquiring the residual nodes in the cluster node resources, wherein the resources required for capacity expansion comprise the pod number and the pod corresponding specification; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not, and when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; and selecting the node meeting the minimum specification from the node resource pool as a new node to join the cluster node resource according to the minimum specification request required by capacity expansion. The method realizes the expansion and contraction of the nodes in advance, ensures that the cluster has expansion conditions during service expansion, realizes two-stage elastic expansion and contraction, realizes the expansion of the nodes in advance by automatically monitoring the cluster state and the current resource utilization rate of the micro-service, can directly dispatch without waiting during service expansion, better meets the service requirement, realizes quick expansion, automatically reduces the capacity after the service flow is reduced, and saves the cost.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
In order to more clearly explain the technical solution of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of the HPA function description of the embodiment of the present application;
FIG. 2 is a schematic structural diagram of a device for elastically stretching and contracting a container cloud according to an embodiment of the present disclosure;
FIG. 3 is a flow chart illustrating the expansion of a cloud elastic expansion device according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating expansion of a cloud elastic expansion device according to another embodiment of the present disclosure;
FIG. 5 is a flow chart illustrating expansion of a cloud elastic expansion device according to another embodiment of the present disclosure;
fig. 6 is a flowchart illustrating a process of shrinking the container cloud elastic expansion device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the exemplary embodiments of the present application clearer, the technical solutions in the exemplary embodiments of the present application will be clearly and completely described below with reference to the drawings in the exemplary embodiments of the present application, and it is obvious that the described exemplary embodiments are only a part of the embodiments of the present application, but not all the embodiments.
All other embodiments, which can be derived by a person skilled in the art from the exemplary embodiments shown in the present application without inventive effort, shall fall within the scope of protection of the present application. Moreover, while the disclosure herein has been presented in terms of exemplary one or more examples, it is to be understood that each aspect of the disclosure can be utilized independently and separately from other aspects of the disclosure to provide a complete disclosure.
It should be understood that the terms "first," "second," "third," and the like in the description and in the claims of the present application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used are interchangeable under appropriate circumstances and can, for example, be implemented in sequences other than those illustrated or otherwise described herein with reference to the embodiments of the application.
Furthermore, the terms "comprises" and "comprising," as well as any variations thereof, are intended to cover a non-exclusive inclusion, such that a product or device that comprises a list of elements is not necessarily limited to those elements explicitly listed, but may include other elements not expressly listed or inherent to such product or device.
The term module, as used herein, refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware or/and software code that is capable of performing the functionality associated with that element.
Reference throughout this specification to "embodiments," "some embodiments," "one embodiment," or "an embodiment," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, appearances of the phrases "in various embodiments," "in some embodiments," "in at least one other embodiment," or "in an embodiment," or the like, throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Thus, the particular features, structures, or characteristics shown or described in connection with one embodiment may be combined, in whole or in part, with the features, structures, or characteristics of one or more other embodiments, without limitation. Such modifications and variations are intended to be included within the scope of the present application.
With the development of network technology, the demand for network services is increasing, and under the cloud platform cluster environment, more and more cloud clusters based on Kubernetes (K8 s for short) containers are widely applied, and the clusters are a collection of cloud resources required by the operation of the containers. Kubernets is an open-source container orchestration engine that supports automated deployment, large-scale scalable, application containerization management; under a container cloud cluster based on Kubernetes, managing and scheduling a large number of micro services, wherein each micro service can have a plurality of instances and run on a plurality of nodes of a cloud platform in a distributed mode in the form of containers; the nodes are basic elements formed by the container cluster, can be virtual machines, physical machines and host machines, and each node comprises basic components required by the operation of the pod. Kubernetes has an instance horizontal automatic scaling HPA function, the HPA obtains monitoring index data of the utilization rate of micro-service resources through a resource monitoring system (Heapster) in a cluster, the pod number in micro-service is automatically expanded and reduced according to the monitoring index data, the Heapster is a native cluster monitoring scheme of the Kubernetes, and the Heapster runs in the pod form and can automatically discover cluster nodes and obtain monitoring data from the nodes. As shown in fig. 1, the deploymer is responsible for managing stateless applications, i.e., microprograms, declares a pod template, controls an operation policy of the pod, is suitable for deploying stateless microservices, and when the utilization rate of the microservices exceeds a preset threshold upper limit, the HPA automatically creates a new pod for the microservices to implement capacity expansion.
However, when the node residual resources are not enough to deploy a new pod, the HPA cannot achieve capacity expansion, which leads to continuous increase of service load and further micro-service collapse; at present, some public clouds with node expansion and contraction capacity are expanded when the instance in the monitoring cluster can not be scheduled; however, it takes time to expand the node, and after the node is created, the micro service traffic has already decreased, and the service request cannot be processed effectively.
In some embodiments, there may be significant peak periods for smart tv traffic, say evening daily, and additionally there may inevitably be some unpredictable peaks, and peak period service instances may have difficulty coping with increased traffic if peak periods can be predicted in advance and occur gradually over a longer period of time.
In order to solve the problem of the expansion and contraction capacity effectiveness of the Service level and the Node level, a container cloud elastic expansion and contraction device is provided, and the container cloud elastic expansion and contraction device can comprise a micro Service (Service), an automatic expansion and contraction Controller (Autoscale Controller), a cluster Node resource, a Node Controller (Node Controller) and a Node resource pool.
The micro-service, the nodes, the automatic expansion controller and the node controller form a Kubernetes-based container cloud elastic expansion device, and as shown in FIG. 2, the micro-service automatically expands the capacity according to the flow; the node deploys the micro-service, whether the residual resources of the node meet the requirement of an expansion instance is judged through cluster node resources, and a new node is expanded or a down-line node is put through the nodes stored in the node resource pool; monitoring index data of service resource utilization rate and node residual condition by the automatic expansion controller; and the node deployment micro-service receives the capacity expansion and reduction request of the automatic scaling controller and executes specific capacity expansion and reduction operation.
The application provides a container cloud elastic expansion device which comprises a micro-service, cluster node resources, an automatic expansion controller, a node controller and a node resource pool, wherein the micro-service is used for providing a cloud elastic expansion function; the automatic scaling controller is used for monitoring the micro-service and the cluster node resource, and the micro-service starts HPA; judging whether the resource utilization rate of the micro service meets a preset capacity expansion condition or not; when a preset capacity expansion condition is met, calculating resources required for capacity expansion, and monitoring the rest nodes in the cluster node resources, wherein the resources required for capacity expansion comprise pod numbers and pod corresponding specifications; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not; when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; sending a minimum specification request required for capacity expansion to the node controller; and the node controller responds to a minimum specification request required by the capacity expansion of the automatic expansion controller, and selects a node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource. The device realizes node expansion and contraction capacity in advance, guarantees that a cluster has expansion conditions during service expansion, thereby realizing two-stage elastic expansion and contraction capacity, realizes expansion nodes in advance by automatically monitoring cluster states and micro-service current resource utilization rate, can be directly dispatched without waiting during service expansion, better meets service requirements, realizes quick expansion, automatically reduces capacity after service flow is reduced, and saves cost.
In some embodiments provided by the present application, as shown in fig. 3, the HPA function is turned on for any micro-service of the device that elastically expands and contracts the container cloud, and the device has the capability of automatically expanding and contracting the container cloud. The controller monitors the content including resource usage of the microservices and the condition of the remaining nodes in the cluster node resources. The method for cloud elastic expansion of the container applied to the device comprises the following steps:
s101, monitoring the resource utilization rate of the micro service.
The related starting of the current resource utilization rate of the HPA microservice includes other self-defined resources such as a CPU, a memory, or a QPS (Query Per Second) disk io. Whether the next step operation is carried out is judged by judging whether the resource utilization rate meets the preset capacity expansion condition, and the preset capacity expansion conditions corresponding to different resource utilization rates are different. When the preset capacity expansion condition is met, the following steps are executed:
s102, calculating resources required by capacity expansion, and monitoring the residual nodes in the cluster node resources.
In some embodiments, the specific algorithm of the resources required for capacity expansion may determine the actually required pod number by collecting the current resource utilization rate, the current pod number, and the target resource utilization rate, and specifically may be: actual required pod number = (current resource usage/target resource usage) × current pod number. The number of the pod to be expanded can be obtained through the difference between the actually required pod number and the current pod number.
Taking the CPU utilization rate as an example, the current collected pod number is 4, the current CPU utilization rate is 90%, the set target CPU utilization rate is 60%, and then the pod number actually required is: (90%/60%) 4=6, and the pod number is expanded according to a difference 2 between the needed pod number of 6 and the current pod number of 2, where the corresponding resources required for expansion include 2 pod numbers; meanwhile, the specification corresponding to the pod is obtained.
And monitoring the condition of the residual nodes in the cluster node resources, and judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion. The method comprises the steps of comparing the number of the pots required by the resources required for capacity expansion and the specifications corresponding to the pots with the remaining nodes, checking whether the available resources of the remaining nodes can be successfully scheduled and executed, wherein the resources required for capacity expansion comprise the number of the pots and the specifications corresponding to the pots, and when the available resources cannot be met, namely the micro-service workload demand exceeds the capacity of the remaining nodes, at the moment, adding the nodes to increase the whole available resources of cluster node resources.
S103, calculating a minimum specification required by capacity expansion according to the resources required by the capacity expansion.
The minimum specification required for capacity expansion is the specification requirement for the new node, which is the basic element of the container cluster composition, and which depends on the service, each node contains the basic composition required to run the pod.
And S104, sending a minimum specification request required by capacity expansion.
The automatic scaling controller sends a minimum specification requirement required for capacity expansion to the node controller, and sends a request for the minimum specification required for capacity expansion from the service level to the node level.
And S105, selecting the node meeting the minimum specification from the node resource pool as a new node.
According to the method and the device, the node resources of different specifications are provided through the node resource pool, the introduction and the offline of the nodes are conveniently and rapidly realized, and the resource cost is saved. And selecting the node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource.
In some embodiments, the apparatus for cloud elastic expansion and contraction of a container further includes a database for storing node names, node numbers, and corresponding node specifications, and the node controller obtains an appropriate node in the database according to the minimum specification.
According to the minimum specification, the following operations are executed in combination with the database: selecting a node which meets the requirements most from the node resource pool as a node to be added; initializing the nodes to be added, and optimizing the kernel parameters of the nodes to be added; calling an installation docker script and installing docker service; and calling and installing a Kubernetes system service script, and adding the node to be added as a new node to be added into the cluster node resource.
Continuing to obtain the resources required for capacity expansion by taking the example of the CPU utilization rate as above, wherein the pod number is 2, and the corresponding specification is 2C2G, at this time, the node with the corresponding minimum specification of 4C4G is obtained, and the node corresponds to the database, and when the 4C4G node exists in the database, the node is taken as the node to be added; and if the node does not exist, selecting the node meeting the minimum specification as the node to be added.
According to the technical scheme, the method for elastic cloud expansion of the container comprises the steps of obtaining the resource utilization rate of the micro-service, and starting the HPA by the micro-service; judging whether the resource utilization rate of the micro-service meets a preset capacity expansion condition or not, calculating the resources required for capacity expansion when the preset capacity expansion condition is met, and acquiring the residual nodes in the cluster node resources, wherein the resources required for capacity expansion comprise the pod number and the pod corresponding specification; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not, and when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; and selecting the node meeting the minimum specification from the node resource pool as a new node to join the cluster node resource according to the minimum specification request required by capacity expansion. The method realizes the expansion and contraction of the nodes in advance, ensures that the cluster has expansion conditions during service expansion, realizes two-stage elastic expansion and contraction, realizes the expansion of the nodes in advance by automatically monitoring the cluster state and the current resource utilization rate of the micro-service, can directly dispatch without waiting during service expansion, better meets the service requirement, realizes quick expansion, automatically reduces the capacity after the service flow is reduced, and saves the cost.
As shown in fig. 4, in some embodiments provided in the present application, a method for performing cloud elastic expansion and contraction of a container in combination with a specific preset expansion condition includes the following steps:
s201, monitoring the average resource utilization rate of the micro-service in the first preset time.
Acquiring the resource utilization rate of micro service within first preset time, and calculating the average value of the resource utilization rate to obtain the average resource utilization rate; in some embodiments, the first preset time may be set to 5 minutes, and the average resource usage rate is obtained by averaging data in the time period.
S202, calculating a difference value between the average resource utilization rate and a preset threshold upper limit.
And comparing the difference value with a preset expansion value, wherein the preset expansion value is a range value of a sub-threshold area which is within the upper limit of the preset threshold and is adjacent to the upper limit of the preset threshold, and the sub-threshold area is used as a judgment basis to judge the expansion of the node in advance, so that the direct scheduling can be realized without waiting during service expansion. And when the difference value is smaller than the preset capacity expansion value, the resource utilization rate meets the preset capacity expansion condition.
S203, calculating resources required by capacity expansion and monitoring the residual nodes of the cluster node resources.
And the resources required for capacity expansion comprise the pod number and the specification corresponding to the pod, the condition of the residual nodes in the cluster node resources is monitored, and whether the residual nodes in the cluster node resources meet the resources required for capacity expansion is judged. The method comprises the steps of comparing the number of the pots required by the resources required for capacity expansion and the specifications corresponding to the pots with the remaining nodes, checking whether the available resources of the remaining nodes can be successfully scheduled and executed, wherein the resources required for capacity expansion comprise the number of the pots and the specifications corresponding to the pots, and when the available resources cannot be met, namely the micro-service workload demand exceeds the capacity of the remaining nodes, at the moment, adding the nodes to increase the whole available resources of cluster node resources.
And S204, calculating the minimum specification required by capacity expansion according to the resources required by capacity expansion.
The minimum specification required for capacity expansion is the specification requirement for the new node, which is the basic element of the container cluster composition, and which depends on the service, each node contains the basic composition required to run the pod.
And S205, sending a minimum specification request required by capacity expansion.
And S206, selecting the node meeting the minimum specification from the node resource pool as a new node.
According to the method and the device, the node resources of different specifications are provided through the node resource pool, the introduction and the offline of the nodes are conveniently and rapidly realized, and the resource cost is saved. And selecting the node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource.
According to the technical scheme, the method for elastic cloud expansion of the container comprises the steps of obtaining and monitoring the average resource utilization rate of the micro-services within a first preset time, wherein the micro-services open the HPA; calculating a difference value between the average resource utilization rate and a preset threshold upper limit, when the difference value is smaller than a preset capacity expansion value, calculating resources required for capacity expansion, and acquiring residual nodes in cluster node resources, wherein the resources required for capacity expansion comprise pod numbers and pod corresponding specifications; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not, and when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; and selecting the node meeting the minimum specification from the node resource pool as a new node to join the cluster node resource according to the minimum specification request required by capacity expansion. The method realizes node expansion and contraction capacity in advance, ensures that a cluster has expansion conditions during service expansion, realizes two-stage elastic expansion and contraction capacity, realizes expansion nodes in advance by automatically monitoring cluster states and the current resource utilization rate of micro-services, can directly dispatch without waiting during service expansion, better meets service requirements, realizes rapid expansion, automatically reduces capacity after service flow is reduced, and saves cost.
As shown in fig. 5, in some embodiments provided in the present application, in combination with another specific preset expansion condition, a method for performing cloud elastic expansion and contraction of a container includes the following steps:
s301, collecting the change trend of the utilization rate of the micro service resources in the second preset time.
And S302, predicting the next resource utilization rate according to the change trend.
And acquiring the change trend of the resource utilization rate by acquiring the resource utilization rate within second preset time. And combining a trend prediction algorithm to obtain the next resource utilization rate.
In some embodiments, the trend prediction algorithm may be through an ARIMA model, a neural network model, a Prophet model, or the like.
And S303, calculating the difference value between the next resource utilization rate and the preset threshold upper limit.
And comparing the difference value with a preset expansion value, wherein the preset expansion value is used as a range value of a sub-threshold area which is within the upper limit of the preset threshold and is adjacent to the upper limit of the preset threshold, and the sub-threshold area is used as a judgment basis to judge the node expansion in advance, so that the direct scheduling can be realized without waiting during service expansion. And when the difference value is smaller than the preset expansion value, the resource utilization rate meets the preset expansion condition.
S304, calculating resources required for capacity expansion and monitoring the rest nodes of the cluster node resources.
And the resources required for capacity expansion comprise the pod number and the specification corresponding to the pod, the condition of the residual nodes in the cluster node resources is monitored, and whether the residual nodes in the cluster node resources meet the resources required for capacity expansion is judged. By comparing the pod number required by the resources required for capacity expansion and the specifications corresponding to the pod with the remaining nodes, whether the available resources of the remaining nodes can be successfully scheduled and executed and the resources required for capacity expansion include the pod number and the specifications corresponding to the pod is checked, when the available resources cannot be met, namely the micro-service workload demand exceeds the capacity of the remaining nodes, at the moment, the nodes are required to be added to increase the whole available resources of the cluster node resources.
S305, calculating a minimum specification required by capacity expansion according to the resources required by capacity expansion.
The minimum specification required for capacity expansion is the specification requirement for the new node, which is the basic element of container cluster composition, and which depends on the traffic, each node containing the basic composition required to run the pod.
S306, sending a minimum specification request required by capacity expansion.
And S307, selecting the node meeting the minimum specification from the node resource pool as a new node.
According to the method and the device, the node resources of different specifications are provided through the node resource pool, the introduction and the offline of the nodes are conveniently and rapidly realized, and the resource cost is saved. And selecting the node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource.
According to the technical scheme, the method for elastic cloud expansion of the container comprises the steps of collecting the change trend of the utilization rate of micro-service resources within second preset time, and starting HPA by the micro-service; predicting the next resource utilization rate according to the variation trend, calculating a difference value between the next resource utilization rate and a preset threshold upper limit, when the difference value is smaller than a preset capacity expansion value, calculating resources required for capacity expansion, and acquiring residual nodes in cluster node resources, wherein the resources required for capacity expansion comprise pod numbers and pod corresponding specifications; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not, and when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; and selecting the node meeting the minimum specification from the node resource pool as a new node to join the cluster node resource according to the minimum specification request required by capacity expansion. The method realizes node expansion and contraction capacity in advance, ensures that a cluster has expansion conditions during service expansion, realizes two-stage elastic expansion and contraction capacity, realizes expansion nodes in advance by automatically monitoring cluster states and the current resource utilization rate of micro-services, can directly dispatch without waiting during service expansion, better meets service requirements, realizes rapid expansion, automatically reduces capacity after service flow is reduced, and saves cost.
As shown in fig. 6, in some embodiments provided in the present application, the HPA function is turned on for any one of the micro-services of the device in which the container cloud elastically stretches, and the device has the capability of automatically stretching. The controller monitors the content including resource usage of the microservices and the condition of the remaining nodes in the cluster node resources. The cloud elastic shrinkage method of the container applied to the device comprises the following steps:
s101, monitoring the resource utilization rate of the micro service.
And starting the current resource utilization rate of the HPA micro-service in a related manner, judging whether to perform the next step operation by judging whether the resource utilization rate meets a preset capacity reduction condition, wherein the preset capacity reduction conditions corresponding to different resource utilization rates are different. When the preset capacity reducing condition is met, the following steps are executed:
and S106, monitoring the residual nodes of the cluster node resources.
And preferentially judging the new node, and when the new node is found to have no related micro service example and the micro service has no capacity expansion requirement or the residual nodes of the current cluster node resource meet the capacity expansion requirement, taking the new node as the node to be offline. And judging other nodes, and when finding that the other nodes have no related micro-service instance, using the other nodes as nodes to be offline.
And S107, taking the nodes which do not correspond to the related micro service instances as nodes to be offline, and sending an offline node request to the node controller.
And S108, putting the nodes to be offline back to the node resource pool.
According to the technical scheme, the method for elastic expansion of the cloud container has the advantages that the capacity is automatically reduced after the service flow is reduced, and the cost is saved.
The embodiments provided in the present application are only a few examples of the general concept of the present application, and do not limit the scope of the present application. Any other embodiments extended according to the scheme of the present application without inventive efforts will be within the scope of protection of the present application for a person skilled in the art.

Claims (8)

1. A container cloud elastic expansion device is characterized by comprising a micro-service, cluster node resources, an automatic expansion controller, a node controller and a node resource pool;
the automatic scaling controller is used for monitoring the micro-service and the cluster node resource, and the micro-service starts HPA;
judging whether the resource utilization rate of the micro service meets a preset capacity expansion condition or not; when a preset capacity expansion condition is met, calculating resources required for capacity expansion, and monitoring the rest nodes in the cluster node resources, wherein the resources required for capacity expansion comprise pod numbers and pod corresponding specifications; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion or not; when the residual nodes do not meet the resources required for capacity expansion, calculating the minimum specification required for capacity expansion according to the resources required for capacity expansion; sending a minimum specification request required for capacity expansion to the node controller, wherein the satisfaction of a preset capacity expansion condition means that a difference value between the average resource utilization rate of the micro service and a preset threshold upper limit is smaller than a preset capacity expansion value within a first preset time, or the satisfaction of the preset capacity expansion condition means that a difference value between the predicted resource utilization rate of the micro service and the preset threshold upper limit is smaller than the preset capacity expansion value;
judging whether the resource utilization rate of the micro service meets a preset capacity reduction condition or not; when the preset capacity reduction condition is met, monitoring the rest nodes in the cluster node resources, taking the nodes without the corresponding micro service instances as nodes to be offline, and sending an offline node request to a node controller;
the node controller responds to a minimum specification request required by capacity expansion of the automatic expansion controller, and selects a node meeting the minimum specification from the node resource pool as a new node to be added into the cluster node resource; and responding to the offline node request, appointing the node to be offline, and putting the node to be offline back to the node resource pool.
2. The apparatus for cloud elastic expansion and contraction of a container according to claim 1, wherein the preset expansion condition comprises:
acquiring the resource utilization rate of the micro service within a first preset time, and calculating the average value of the resource utilization rates to obtain the average resource utilization rate;
calculating the difference value between the average resource utilization rate and a preset threshold upper limit;
and when the difference value is smaller than the preset capacity expansion value, the resource utilization rate meets the preset capacity expansion condition.
3. The apparatus for cloud elastic expansion and contraction of a container according to claim 1, wherein the preset expansion condition further comprises:
acquiring the resource utilization rate within second preset time, and acquiring the change trend of the resource utilization rate;
predicting the next resource utilization rate according to the change trend;
calculating the difference value between the next resource utilization rate and the preset threshold upper limit;
and when the difference value is smaller than the preset capacity expansion value, the resource utilization rate meets the preset capacity expansion condition.
4. The apparatus for cloud elastic expansion and contraction of containers according to claim 1, further comprising a database for storing node names, node numbers and corresponding node specifications.
5. The cloud elastic expansion device for containers according to claim 4, wherein selecting a node satisfying a minimum specification from a node resource pool as a new node to join the cluster node resource comprises:
selecting the node with the proper minimum specification as a node to be added according to the database;
carrying out node initialization on the node to be added, and optimizing the kernel parameter of the node to be added;
calling an installation docker script and installing docker service;
and calling and installing a Kubernets system service script, and adding the node to be added as a new node into the cluster node resource.
6. A method of cloud elastic expansion and contraction of a container, comprising:
acquiring the resource utilization rate of the micro-service, wherein the micro-service starts an HPA;
judging whether the resource utilization rate of the micro-service meets a preset capacity expansion condition or not, calculating the resources required for capacity expansion when the preset capacity expansion condition is met, and acquiring the residual nodes in the cluster node resources, wherein the resources required for capacity expansion comprise the pod number and the pod corresponding specification; judging whether the residual nodes in the cluster node resources meet the resources required for capacity expansion, and when the residual nodes do not meet the resources required for capacity expansion, calculating a minimum specification required for capacity expansion according to the resources required for capacity expansion, wherein the condition of meeting a preset capacity expansion condition means that the difference between the average resource utilization rate of the micro service and a preset threshold upper limit is smaller than a preset capacity expansion value within a first preset time, or the condition of meeting the preset capacity expansion condition means that the difference between the predicted resource utilization rate of the micro service and the preset threshold upper limit is smaller than the preset capacity expansion value; selecting a node meeting the minimum specification from a node resource pool as a new node to join the cluster node resource according to the minimum specification request required by capacity expansion;
judging whether the resource utilization rate of the micro service meets a preset capacity reduction condition or not, monitoring the residual nodes in the cluster node resource when the preset capacity reduction condition is met, taking the nodes without the corresponding micro service instances as nodes to be offline, and sending an offline node request to a node controller;
and the node controller puts the node to be offline back to the node resource pool.
7. The method for cloud elastic expansion and contraction of the container according to claim 6, wherein the step of determining whether the resource utilization rate of the micro service meets a preset expansion condition comprises the steps of:
acquiring the resource utilization rate of the micro service within first preset time, and calculating the average value of the resource utilization rate to obtain the average resource utilization rate;
and calculating a difference value between the average resource utilization rate and a preset threshold upper limit, wherein when the difference value is smaller than a preset expansion value, the resource utilization rate meets a preset expansion condition.
8. The method for cloud elastic expansion and contraction of the container according to claim 7, wherein determining whether the resource utilization rate of the micro service meets a preset capacity expansion condition further comprises:
acquiring the resource utilization rate within second preset time, acquiring the variation trend of the resource utilization rate, and predicting the next resource utilization rate according to the variation trend;
and calculating the difference value between the next resource utilization rate and the preset threshold upper limit, wherein when the difference value is smaller than the preset capacity expansion value, the resource utilization rate meets the preset capacity expansion condition.
CN202110651643.2A 2021-06-11 2021-06-11 Method and device for elastic expansion and contraction of container cloud Active CN113395178B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110651643.2A CN113395178B (en) 2021-06-11 2021-06-11 Method and device for elastic expansion and contraction of container cloud
PCT/CN2021/128490 WO2022257347A1 (en) 2021-06-11 2021-11-03 Container cloud autoscaling method, and cluster server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110651643.2A CN113395178B (en) 2021-06-11 2021-06-11 Method and device for elastic expansion and contraction of container cloud

Publications (2)

Publication Number Publication Date
CN113395178A CN113395178A (en) 2021-09-14
CN113395178B true CN113395178B (en) 2022-12-09

Family

ID=77620721

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110651643.2A Active CN113395178B (en) 2021-06-11 2021-06-11 Method and device for elastic expansion and contraction of container cloud

Country Status (2)

Country Link
CN (1) CN113395178B (en)
WO (1) WO2022257347A1 (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113395178B (en) * 2021-06-11 2022-12-09 聚好看科技股份有限公司 Method and device for elastic expansion and contraction of container cloud
CN116204268A (en) * 2021-11-30 2023-06-02 华为技术有限公司 Expansion and contraction method of cloud instance and related equipment thereof
CN114726734A (en) * 2022-03-21 2022-07-08 平安壹账通云科技(深圳)有限公司 Cloud service resource capacity expansion method and device, electronic equipment and storage medium
CN114745277B (en) * 2022-03-30 2024-05-28 杭州博盾习言科技有限公司 Elastic expansion method and device for public cloud cross-domain private line, electronic equipment and medium
CN115022173B (en) * 2022-05-10 2023-05-26 度小满科技(北京)有限公司 Service capacity expansion method, device, equipment and storage medium
CN115037615A (en) * 2022-06-23 2022-09-09 新华智云科技有限公司 Self-adaptive application capacity expansion method based on cloud platform
CN115361385B (en) * 2022-08-15 2024-05-10 山东体育学院 Automatic elastic telescoping system and telescoping method for cloud native application in Docker Swarm environment
CN117687739A (en) * 2022-09-05 2024-03-12 华为云计算技术有限公司 Resource scheduling method and related equipment thereof
CN116055562A (en) * 2022-10-26 2023-05-02 北京蔚领时代科技有限公司 Automatic expansion method and device for cloud game storage space
CN118034847A (en) * 2022-11-07 2024-05-14 华为云计算技术有限公司 Method and device for managing computing resources
CN116048814B (en) * 2023-02-21 2023-10-03 上海汇付支付有限公司 Automatic optimization method for application resource specification based on monitoring utility data
CN116112569B (en) * 2023-02-23 2023-07-21 安超云软件有限公司 Micro-service scheduling method and management system
CN116560818B (en) * 2023-06-29 2023-09-12 深圳市易图资讯股份有限公司 Method and system for distributing and scheduling space data service
CN116860461B (en) * 2023-09-04 2023-12-19 深圳大道云科技有限公司 Resource scheduling method, equipment and storage medium of K8s cluster
CN116938724B (en) * 2023-09-19 2024-01-30 广东保伦电子股份有限公司 Method for expanding and shrinking capacity of server in audio-video conference

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104317638A (en) * 2014-10-17 2015-01-28 华为技术有限公司 Application stretching management method and device
CN109428764B (en) * 2017-09-05 2021-10-15 华为技术有限公司 Virtual network function instantiation method
CN108228347A (en) * 2017-12-21 2018-06-29 上海电机学院 The Docker self-adapting dispatching systems that a kind of task perceives
CN110262899B (en) * 2019-06-20 2021-05-11 华云数据控股集团有限公司 Monitoring component elastic expansion method and device based on Kubernetes cluster and controlled terminal
CN111464355B (en) * 2020-03-31 2022-11-15 北京金山云网络技术有限公司 Method and device for controlling expansion and contraction capacity of Kubernets container cluster and network equipment
CN112540905A (en) * 2020-12-18 2021-03-23 青岛特来电新能源科技有限公司 System risk assessment method, device, equipment and medium under micro-service architecture
CN113395178B (en) * 2021-06-11 2022-12-09 聚好看科技股份有限公司 Method and device for elastic expansion and contraction of container cloud

Also Published As

Publication number Publication date
CN113395178A (en) 2021-09-14
WO2022257347A1 (en) 2022-12-15

Similar Documents

Publication Publication Date Title
CN113395178B (en) Method and device for elastic expansion and contraction of container cloud
CN108965485B (en) Container resource management method and device and cloud platform
US10719343B2 (en) Optimizing virtual machines placement in cloud computing environments
CN112583861B (en) Service deployment method, resource allocation method, system, device and server
CN113051075B (en) Kubernetes intelligent capacity expansion method and device
CN110677305A (en) Automatic scaling method and system in cloud computing environment
CN111147565B (en) Cluster node control method, device and equipment and readable storage medium
CN106648900B (en) Supercomputing method and system based on smart television
CN113608871A (en) Service processing method and device
CN113867959A (en) Training task resource scheduling method, device, equipment and medium
CN111459681B (en) Dynamic elastic telescoping method based on micro-service load
CN112965817B (en) Resource management method and device and electronic equipment
CN105373485A (en) Memory cleaning system and method and terminal device
Wang et al. A cluster autoscaler based on multiple node types in kubernetes
CN109936471B (en) Multi-cluster resource allocation method and device
CN108810992B (en) Resource control method and device for network slice
CN113190329A (en) Server and method for automatically stretching container cloud cluster resources
CN115794306A (en) Resource allocation method and device based on preemption instance, electronic equipment and medium
CN108540336A (en) A kind of elastic telescopic dispatching method and device
CN113434256A (en) Cloud resource transverse expansion method, readable storage medium and cloud resource management system
CN114240395A (en) Resource delivery method and device, computer equipment and storage medium
CN108279982B (en) Method, system and equipment for managing pbs resources and hadoop resources
CN102238022A (en) Network management system and data acquisition method
CN112416530A (en) Method and device for flexibly managing cluster physical machine nodes and electronic equipment
CN115361281B (en) Processing method, device, equipment and medium for expanding capacity of multiple cloud cluster nodes

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