CN112882794A - pod capacity expansion method, device, node and storage medium - Google Patents
pod capacity expansion method, device, node and storage medium Download PDFInfo
- Publication number
- CN112882794A CN112882794A CN202110210579.4A CN202110210579A CN112882794A CN 112882794 A CN112882794 A CN 112882794A CN 202110210579 A CN202110210579 A CN 202110210579A CN 112882794 A CN112882794 A CN 112882794A
- Authority
- CN
- China
- Prior art keywords
- pod
- nodes
- round
- copy
- configuration file
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/5061—Partitioning or combining of resources
- G06F9/5072—Grid computing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the technical field of containers, and provides a pod capacity expansion method, a pod capacity expansion device, a pod capacity expansion node and a storage medium, wherein the method comprises the following steps: acquiring a preset configuration file, wherein the preset configuration file comprises the number of copies to be expanded for the pod to be expanded; acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is less than the number of copies; and deploying the copy pod corresponding to the copy number to a plurality of nodes corresponding to the node number according to the preset configuration file and the node number, wherein the copy pod is a copy of the pod to be expanded. In the invention, under the condition that the number of the nodes is less than the number of the copies, the copy pod corresponding to the number of the copies can be deployed to a plurality of nodes corresponding to the number of the nodes, so that the capacity expansion of the pod is not limited by the number of the nodes of Kubernetes.
Description
Technical Field
The invention relates to the technical field of containers, in particular to a pod capacity expansion method, a pod capacity expansion device, a node and a storage medium.
Background
Kubernetes is also called k8s, is a portable container arrangement management tool for container service, is also the most popular open source container arrangement system at present, and the flexible and convenient containerization application of the Kubernetes is well received by vast developers.
Kubernets use a pod to manage a containerized application, the pod is also the minimum granularity programmed by k8s, in order to provide container services more flexibly, kubernets provide a function of expanding the capacity of the pod (increasing the number of copies of the pod) or reducing the capacity (reducing the number of copies of the pod), but kubernets require that the number of expanded copies can only be less than or equal to the number of nodes of the kubernets, and as the request volume of services is larger and larger, the expansion of the pod limited by the number of nodes of the kubernets is far from meeting the service requirements.
Disclosure of Invention
The invention aims to provide a pod capacity expansion method, a pod capacity expansion device, a node and a storage medium, which can ensure that the capacity expansion of a pod is not limited by the number of Kubernetes nodes.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
in a first aspect, the present invention provides a pod extension method, applied to any one node in a plurality of nodes in a kubernets cluster, where the method includes: acquiring a preset configuration file, wherein the preset configuration file comprises the number of copies to be expanded for a pod to be expanded; acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is smaller than the number of the copies; and deploying the copy pod corresponding to the copy number to the plurality of nodes corresponding to the node number according to the preset configuration file and the node number, wherein the copy pod is a copy of the pod to be expanded.
In a second aspect, the present invention provides a pod capacity expansion apparatus, applied to any one of a plurality of nodes in a kubernets cluster, where the apparatus includes: the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a preset configuration file, and the preset configuration file comprises the number of copies to be expanded for a pod to be expanded; acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is smaller than the number of the copies; and the deployment module is used for deploying the copy pod corresponding to the copy number to the plurality of nodes corresponding to the node number according to the preset configuration file and the node number, wherein the copy pod is a copy of the pod to be expanded.
In a third aspect, the present invention provides a node, including a memory and a processor, where the memory stores a computer program, and the processor implements the pod capacity expansion method as described above when executing the computer program.
In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the pod capacity expansion method as described above.
Compared with the prior art, according to the preset configuration file containing the number of copies to be expanded of the pod to be expanded and the number of nodes in the kubernets cluster, even if the number of the nodes is smaller than the number of the copies, the copy pod corresponding to the number of the copies can be deployed to the plurality of nodes corresponding to the number of the nodes, and therefore the expansion of the pod is not limited by the number of the kubernets.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 shows a schematic diagram of a k8s cluster provided in an embodiment of the present invention.
Fig. 2 is a block diagram illustrating a node according to an embodiment of the present invention.
Fig. 3 is a flowchart illustrating a pod capacity expansion method according to an embodiment of the present invention.
Fig. 4 shows an exemplary diagram of a duplicate pod deployment provided by an embodiment of the present invention.
Fig. 5 is a flowchart illustrating another pod capacity expansion method according to an embodiment of the present invention.
Fig. 6 is a schematic block diagram illustrating a pod capacity expansion apparatus according to an embodiment of the present invention.
Icon: 10-node; 11-a processor; 12-a memory; 13-a bus; 14-a communication interface; 20-master node; a 30-node; 100-pod capacity expansion device; 110-an obtaining module; 120-deployment module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. indicate an orientation or a positional relationship based on that shown in the drawings or that the product of the present invention is used as it is, this is only for convenience of description and simplification of the description, and it does not indicate or imply that the device or the element referred to must have a specific orientation, be constructed in a specific orientation, and be operated, and thus should not be construed as limiting the present invention.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
K8s, the most popular open source container orchestration system at present, typically uses a pod to manage one containerized application, which is also the smallest granularity of K8s orchestration, and a pod can contain multiple and single containers, and when multiple containers are contained, these containers always run on the same node because a pod does not span multiple nodes. The pod binds the containers together and manages them as a unit. In pod, multiple containers can simultaneously perform a number of closely related processes, but with some isolation. Each pod has its own IP and independent port, and each pod can access each other through the IP addresses and corresponding ports of the other pods. The pod can communicate with each other whether or not on the same node.
Referring to fig. 1, fig. 1 shows a schematic diagram of a k8s cluster according to an embodiment of the present invention, in fig. 1, a k8s cluster includes a master node 20 and a node 30, the master node 20 is communicatively connected to the node 30, a k8s cluster core service operates on the master node 20, and a pod operates on the node 30.
k8s manages the pod through a controller that defines its deployment characteristics, such as how many copies there are, on what node to run, etc. In order to satisfy different business scenarios, kubernets provide a variety of default controllers including Deployment, repliaset, DaemonSet, stateful eset, Job, etc. The default controller implements orchestration control of the pod, including scaling control. The controller and the pod are in a one-to-many relationship, one controller can control a plurality of pods of the same type, and the control on the number of the pods can be realized by modifying the configuration of the copy number of the controller.
In an actual application scenario, taking a stateful et as an example, if a pod managed by the stateful et configures a host port, since the host port on one node cannot be multiplexed, the pod of the stateful et is limited by the number of k8s cluster nodes when being subjected to capacity expansion, and if the number of copies is greater than the number of nodes, the excess pod is in an unscheduled state. As the request volume of the service is larger, the number of pod required to provide the service by the service is also larger. When the pod expansion of the service is limited by the number of kubernets nodes and the expansion cannot be continued, along with the increase of the service volume, the service processing efficiency is likely to be reduced, and even the service is crashed.
In view of this, embodiments of the present invention provide a method, an apparatus, a node, and a storage medium for pod capacity expansion, so that pod capacity expansion is not limited by the number of kubernets node, and thus, it may be avoided that service processing efficiency is reduced and even service collapse is caused due to the limitation of the number of kubernets node in pod capacity expansion.
It should be noted that the pod capacity expansion method provided by the embodiment of the present invention may be a component of k8s, and may operate in the node 30 in the pod form, or may operate in the master node 20, which will be described in detail below.
Referring to fig. 2, fig. 2 is a block schematic diagram illustrating a node 10 according to an embodiment of the present invention, where the node 10 may be the master node 20 in fig. 1 or the node 30 in fig. 1.
The node 10 comprises a processor 11, a memory 12, a bus 13, a communication interface 14. The processor 11 and the memory 12 are connected by a bus 13, and the processor 11 communicates with an external device via a communication interface 14.
The processor 11 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 11. The Processor 11 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
The memory 12 is used to store a program, for example, the pod capacity expansion apparatus 100 in the embodiment of the present invention, where the pod capacity expansion apparatus 100 includes at least one software functional module that may be stored in the memory 12 in a form of software or firmware (firmware), and the processor 11 executes the program after receiving the execution instruction to implement the pod capacity expansion method in the embodiment of the present invention.
The Memory 12 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory). Alternatively, the memory 12 may be a storage device built in the processor 11, or may be a storage device independent of the processor 11.
The bus 13 may be an ISA bus, a PCI bus, an EISA bus, or the like. Fig. 2 is represented by only one double-headed arrow, but does not represent only one bus or one type of bus.
On the basis of fig. 1 and fig. 2, an embodiment of the present invention provides a pod capacity expansion method applied to the node 10 in fig. 2, referring to fig. 3, and fig. 3 shows a flowchart of the pod capacity expansion method provided in the embodiment of the present invention, where the method includes the following steps:
step S100, acquiring a preset configuration file, wherein the preset configuration file comprises the number of copies to be expanded for the pod to be expanded.
In this embodiment, the pod expansion at least includes the following two cases: (1) the number of the pod to be created is the number of the copies to be expanded, for example, if the number of the pod to be created is 5, the number of the copies to be expanded is 5; (2) the pod to be expanded is already created, but the number of copies of the pod needs to be increased on the basis, at this time, the number of copies of the pod that needs to be increased is the number of copies that need to be expanded, for example, there are already 2 pod that needs to be expanded, and 3 copies need to be added to the pod, and the number of copies that need to be expanded is 3 at this time.
In this embodiment, as a specific implementation manner, for the type of pod in which the number of copies that need to be expanded is greater than the number of nodes, a type of k8s resource may be specially defined for the pod, where the defined k8s resource complies with a resource configuration standard of k8s, for example, a resource tag, a resource category, and a resource requirement included in the k8s resource requirement. In addition, a custom orchestration module may be specially implemented for the custom k8s resource, and the module is responsible for monitoring changes of the custom k8s resource, and controlling creation, update, deletion, scheduling, and the like of the pod corresponding to the custom k8s resource. The custom k8s resource and the custom arrangement module may be registered with k8s in advance, so that after each module operates normally, when the custom arrangement module monitors the change of the custom k8s resource, a corresponding preset configuration file is obtained, where the preset configuration file includes the number of copies to be expanded for the pod to be expanded.
For example, when the pod to be expanded includes a host port configuration, as an example, the preset configuration file may be represented as follows:
in the preset configuration file, apiVersion represents the version of the current configuration format, kind represents the resource type, the resource is a custom resource specially defined for a pod including host port configuration, metadata represents the metadata of the custom resource, name represents the name of the custom resource, spec represents the specification of the custom resource, the specific content is omitted here, replicas represents the number of copies needing capacity expansion, and podconefig represents the complete configuration of the pod in k8s, and the specific content is omitted here.
When capacity expansion is performed on the pod including the host port and the number of copies needing capacity expansion is larger than the number of nodes, a multi-round deployment mode can be adopted, a random port is generated firstly during each round of deployment, the pod deployed in each round adopts the random port generated in the round, and each copy can set different values for the pod.
As another specific embodiment, instead of using podConfig in the specially-defined k8s resource, deployment may be used, in which case, it is not necessary to specially set a pod. At this time, when a multi-wheel deployment mode is adopted, the configuration adopted by each wheel deployment is the same, that is, each wheel deployment comprises the same random port and the same deployment, and since a special field is not needed to identify different copies at this time, the implementation process is simpler.
It should be noted that, by customizing the k8s resource, the related pod capacity expansion is more general, the flexibility is better, and the deep fusion with the k8s can be realized.
Step S110, acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is smaller than the number of copies.
In this embodiment, since the pod runs on the node 30, the number of nodes here may refer to the number of node nodes 30 in the k8s cluster.
It should be noted that, if the number of nodes is equal to the number of copies, each node deploys one pod copy, and if the number of nodes is less than the number of copies, the number of nodes corresponding to the number of copies may be selected according to a preset rule, and then one pod copy is deployed at each selected node, where the preset rule may be random selection, or a node with the most resources left may be selected according to the resource utilization condition of the node.
Step S120, deploying the copy pod corresponding to the copy number to a plurality of nodes corresponding to the node number according to the preset configuration file and the node number, where the copy pod is a copy of the pod to be expanded.
In this embodiment, each copy pod corresponds to one pod configuration file, the pod configuration file may include an index for uniquely identifying each copy pod, and a corresponding pod copy is created according to the pod configuration file. For example, the number of nodes is 3, which are respectively a node a, a node b, and a node c, and the number of copies is 5, each copy corresponds to one pod configuration file, as a specific implementation manner, an identifier of the copy may be added to a pod. As a specific deployment mode, the deployment results of 5 copies of postd are shown in fig. 4, where in fig. 4, the node a is deployed with the testpod-0 and the testpod-3, the node b is deployed with the testpod-1 and the testpod-4, and the node c is deployed with the testpod-2.
In the method provided by the embodiment of the invention, under the condition that the number of the nodes is less than the number of the copies, the copy pod corresponding to the number of the copies is deployed to the plurality of nodes corresponding to the number of the nodes according to the preset configuration file and the number of the nodes in the kubernets cluster, so that the expansion of the pod is not limited by the number of the nodes of the kubernets.
On the basis of fig. 3, an embodiment of the present invention further provides a specific implementation manner for deploying a copy pod corresponding to a copy number to multiple nodes corresponding to a node number, please refer to fig. 5, where fig. 5 shows a flowchart of another pod capacity expansion method provided in the embodiment of the present invention, and step S120 includes the following sub-steps:
step S1201, determining the number of deployment rounds and the target node information of each deployment round according to the number of nodes and the number of copies; the target node information comprises target nodes and corresponding target node numbers.
In this embodiment, as a specific implementation manner, the duplicate pod may be deployed in multiple rounds of deployment, target nodes of each round of deployment may include all nodes in a k8s cluster, or may include part of nodes in a k8s cluster, for example, the number of nodes is 3, and the number of duplicates is 5, the deployment may be performed in two rounds, when the deployment is performed in the first round, the 3 duplicate pods are respectively deployed on 3 different nodes, at this time, target nodes of the deployment in the first round are 3 nodes, when the deployment is performed in the second round, the remaining 2 duplicate pods are deployed on 2 nodes of the 3 nodes, and at this time, target nodes of the deployment in the second round are 2 nodes.
In this embodiment, a specific implementation manner for determining the number of deployment rounds and the target node information of each deployment round may be as follows:
firstly, integer division operation is carried out on the number of the copies and the number of the nodes to obtain a quotient and a remainder.
Next, the quotient is taken as a temporary number of rounds.
Thirdly, taking the number of the nodes as the number of target nodes deployed in each round of the temporary round number, and taking the plurality of nodes as the target nodes deployed in each round of the temporary round number.
In this embodiment, the temporary round number may include multiple rounds, where the target nodes of all the temporary round numbers are all the nodes in the k8s cluster, and the target nodes of all the temporary round numbers are all multiple nodes in the k8s cluster.
Fourthly, if the remainder is 0, the temporary round number is taken as the deployment round number.
And fifthly, if the remainder is not 0, adding a new round on the basis of the number of the temporary rounds, taking the number of the temporary rounds after the new round is added as the number of the deployment rounds, taking the remainder as the number of the target nodes of the new round, and determining the rest nodes from the plurality of nodes as the target nodes of the new round.
In this embodiment, the manner of determining the plurality of nodes with the remainder from the plurality of nodes may be to randomly select the plurality of nodes with the remainder from the plurality of nodes, or to select the plurality of nodes with the remainder having the largest idle resource from the plurality of nodes according to the current resource usage of the plurality of nodes.
And a substep S1202, deploying the copy pod of the target node number deployed in each round to the corresponding target node according to a preset configuration file.
In this embodiment, if the pod to be expanded includes the port configuration item, for any one round of deployment, the specific deployment manner may be:
firstly, the number of target nodes deployed in any round is used as the number of current nodes, and the corresponding target nodes are used as the current nodes.
Secondly, generating a preset number of port numbers.
In this embodiment, the preset configuration file includes a preset number of port configuration items, and each port configuration item needs to correspond to one port number, so that each wheel deployment needs to generate a preset number of port numbers, so as to perform corresponding assignment on each port configuration item deployed in each wheel deployment. For example, the preset number is 3, the number of copies is 8, and the number of nodes is 3, then the number of deployment rounds is 3, 3 port numbers need to be generated in the first deployment round, which are a1, a2, and a3, the copy pod in the first deployment round uses 3 port numbers of a1, a2, and a3, the copy pod in the next deployment round generates 3 ports, which are b1, b2, and b3, the copy pod in the second deployment round uses 3 port numbers of b1, b2, and b3, the copy pod in the third deployment round needs to generate 3 port numbers, which are c1, c2, and c3, and the copy pod in the third deployment round uses 3 port numbers of c1, c2, and c 3. In this embodiment, the preset number of port numbers may be generated randomly, for example, a random function is used to generate the preset number of port numbers.
And thirdly, generating a pod configuration file of the copy pod to be deployed of each current node according to the port number, the preset configuration file and the identification of the copy pod of each current node.
In this embodiment, the port numbers used by the port configuration items in the pod configuration files configured in each round are the same, and in order to distinguish the pod configuration files of different copy pods, the identifiers of the copy pods may be used for distinguishing, for example, a number uniquely characterizing the copy pod is set for different copy pods, and the pod configuration files of different copy pods can be distinguished by the number of each copy pod.
In this embodiment, as a method for specifically generating a pod configuration file of a copy pod to be deployed for each current node, the following steps may be adopted:
(1) and assigning the port configuration items according to the port numbers, wherein the port numbers correspond to the port configuration items one to one.
For example, the port configuration items include configuration item 1, configuration item 2, and configuration item 3, and the randomly generated port numbers are: 8080. 8081, and 8082, configuration item 1 ═ 8080; configuration item 2 is 8081; configuration item 3 is 8082.
(2) And generating a temporary configuration file according to the assigned port configuration item and the pod configuration item.
In this embodiment, the temporary configuration file of the copy pod for each deployment round is the same.
(3) And adding an identifier for representing each copy pod in the temporary configuration file to obtain the pod configuration file of the copy pod to be deployed of each current node.
In this embodiment, as a specific implementation manner, an identifier characterizing each copy pod may be added to a value of pod.metadata.name configuration item in the temporary configuration file, for example, pod.metadata.name ═ testpod-0, where "0" in "testpod-0" characterizes the identifier of the copy pod, in this case, values of pod.metadata.name configuration items in pod configuration files of different copy pods are different, and pod configuration files of different copy pods may be distinguished by using this configuration item.
And finally, calling the api-server component, and sending the pod configuration file of each current node to the corresponding current node so that the current node locally deploys the copy pod according to the corresponding pod configuration file.
In this embodiment, the k8s cluster provides services through an api-server component, and a process corresponding to the api-server component runs on a master node in the k8s cluster.
According to the method provided by the embodiment of the invention, the copy pod is divided into multiple deployments, so that the processing process of the copy pod is simplified, the deployments of the whole copy pod can be unified, and the deployment efficiency is improved. Moreover, for the pod including the port configuration item, the port number can be automatically generated, and the copy pod with the copy number larger than the node number is automatically deployed according to the generated port number, so that the automation of pod capacity expansion is realized, and the problem of host port pod capacity expansion limitation is successfully solved.
In order to perform the corresponding steps in the above embodiments and various possible implementations, an implementation manner of the pod capacity expansion device 100 is given below. Referring to fig. 6, fig. 6 is a block schematic diagram illustrating a pod capacity expansion apparatus 100 according to an embodiment of the present invention. It should be noted that the basic principle and the generated technical effect of the pod capacity expansion device 100 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no reference is made to this embodiment.
The pod capacity expansion device 100 includes an acquisition module 110 and a deployment module 120.
An obtaining module 110, configured to obtain a preset configuration file, where the preset configuration file includes a number of copies to be expanded for a pod to be expanded; and acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is less than the number of the copies.
The deployment module 120 is configured to deploy the copy pod corresponding to the copy number to a plurality of nodes corresponding to the node number according to the preset configuration file and the node number, where the copy pod is a copy of the pod to be expanded.
As a specific embodiment, the deployment module 120 is specifically configured to: determining the number of deployment rounds and target node information of each deployment round according to the number of nodes and the number of copies; the target node information comprises target nodes and corresponding target node numbers; and deploying the copies pod of the target node number deployed in each round to the corresponding target nodes according to the preset configuration file.
As a specific implementation manner, the deployment module 120 determines the number of deployment rounds and the target node information of each deployment round according to the number of nodes and the number of copies, and is specifically configured to: carrying out integer division operation on the number of the copies and the number of the nodes to obtain a quotient and a remainder; taking the quotient as a temporary wheel number; taking the number of the nodes as the number of target nodes deployed in each round of the temporary round number, and taking a plurality of nodes as the target nodes deployed in each round of the temporary round number; if the remainder is 0, taking the temporary round number as a deployment round number; if the remainder is not 0, a new round is added on the basis of the number of the temporary rounds, the number of the temporary rounds after the new round is added is used as the number of the deployment rounds, the remainder is used as the number of the target nodes of the new round, and the rest nodes are determined from the multiple nodes and used as the target nodes of the new round.
As a specific embodiment, the kubernets cluster includes an api-server component, the preset configuration file includes port configuration items with a preset number, and the deployment module 120 is specifically configured to, when deploying the copy pod of the number of target nodes deployed in each round to the corresponding target node according to the preset configuration file,: taking the target node number deployed in any round as the current node number and taking the corresponding target node as the current node; generating port numbers with preset numbers; generating a pod configuration file of the copy pod to be deployed of each current node according to the port number, the preset configuration file and the identification of each copy pod; and calling the api-server component, and sending the pod configuration file of each current node to the corresponding current node so that the current node locally deploys the copy pod according to the corresponding pod configuration file.
As a specific implementation manner, the preset configuration file further includes a pod configuration item, and the deployment module 120 is specifically configured to, when generating, according to the port number, the preset configuration file, and the identifier of each copy pod, a pod configuration file of a copy pod to be deployed for each current node: assigning values to the port configuration items according to the port numbers, wherein the port numbers correspond to the port configuration items one to one; generating a temporary configuration file according to the assigned port configuration item and the pod configuration item; and adding an identifier for representing each copy pod in the temporary configuration file to obtain the pod configuration file of the copy pod to be deployed of each current node.
It should be noted that, as a specific implementation manner, the pod capacity expansion apparatus 100 may be implemented in the form of a plug-in of k8s, and interface k8s in a plug-in form, so that the change condition of the custom k8s resource can be monitored in real time, and good real-time performance is achieved.
An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the pod capacity expansion method as described above.
In summary, embodiments of the present invention provide a pod capacity expansion method, an apparatus, a node, and a storage medium, which are applied to any one node of multiple nodes in a kubernets cluster, where the method includes: acquiring a preset configuration file, wherein the preset configuration file comprises the number of copies to be expanded for the pod to be expanded; acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is less than the number of copies; and deploying the copy pod corresponding to the copy number to a plurality of nodes corresponding to the node number according to the preset configuration file and the node number, wherein the copy pod is a copy of the pod to be expanded. Compared with the prior art, according to the preset configuration file comprising the number of copies to be expanded of the pod to be expanded and the number of nodes in the kubernets cluster, even if the number of the nodes is smaller than the number of the copies, the copy pod corresponding to the number of the copies can be deployed to the plurality of nodes corresponding to the number of the nodes, and therefore the expansion of the pod is not limited by the number of the kubernets.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
Claims (10)
1. A pod capacity expansion method is applied to any one of a plurality of nodes in a kubernets cluster, and comprises the following steps:
acquiring a preset configuration file, wherein the preset configuration file comprises the number of copies to be expanded for a pod to be expanded;
acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is smaller than the number of the copies;
and deploying the copy pod corresponding to the copy number to the plurality of nodes corresponding to the node number according to the preset configuration file and the node number, wherein the copy pod is a copy of the pod to be expanded.
2. The pod capacity expansion method of claim 1, wherein the step of deploying the copy pod corresponding to the number of copies to the plurality of nodes corresponding to the number of nodes according to the preset configuration file and the number of nodes comprises:
determining the number of deployment rounds and target node information of each deployment round according to the number of the nodes and the number of the copies; the target node information comprises target nodes and corresponding target node numbers;
and deploying the copies pod of the target node number deployed in each round to the corresponding target nodes according to the preset configuration file.
3. The pod capacity expansion method according to claim 2, wherein the step of determining the number of deployment rounds and the target node information for each deployment round according to the number of nodes and the number of copies comprises:
performing integer division operation on the number of the copies and the number of the nodes to obtain a quotient and a remainder;
taking the quotient as a temporary wheel number;
taking the number of the nodes as the number of target nodes deployed in each round of the temporary round number, and taking the plurality of nodes as the target nodes deployed in each round of the temporary round number;
if the remainder is 0, taking the temporary round number as the deployment round number;
if the remainder is not 0, a new round is added on the basis of the number of the temporary rounds, the number of the temporary rounds after the new round is added is used as the number of the deployment rounds, the remainder is used as the number of the target nodes of the new round, and the nodes of the remainder are determined from the nodes to be used as the target nodes of the new round.
4. The pod capacity expansion method according to claim 2, wherein the kubernets cluster includes an api-server component, the preset configuration file includes a preset number of port configuration items, and the step of deploying the copies pod of the target node number per deployment to the corresponding target nodes according to the preset configuration file includes:
taking the target node number deployed in any round as the current node number and taking the corresponding target node as the current node;
generating the port numbers with the preset number;
generating a pod configuration file of the copy pod to be deployed of each current node according to the port number, the preset configuration file and the identification of each copy pod;
and calling the api-server component, and sending the pod configuration file of each current node to the corresponding current node so that the current node locally deploys the copy pod according to the corresponding pod configuration file.
5. The pod capacity expansion method according to claim 4, wherein the preset configuration file further includes a pod configuration item, and the step of generating, according to the port number, the preset configuration file, and an identifier of each of the copy pods, a pod configuration file of a copy pod to be deployed by each of the current nodes includes:
assigning values to the port configuration items according to the port numbers, wherein the port numbers correspond to the port configuration items one to one;
generating a temporary configuration file according to the assigned port configuration item and the pod configuration item;
and adding an identifier for representing each copy pod in the temporary configuration file to obtain a pod configuration file of each copy pod to be deployed by the current node.
6. A pod capacity expansion apparatus, applied to any one of a plurality of nodes in a kubernets cluster, the apparatus comprising:
the device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a preset configuration file, and the preset configuration file comprises the number of copies to be expanded for a pod to be expanded; acquiring the number of nodes in the kubernets cluster, wherein the number of the nodes is smaller than the number of the copies;
and the deployment module is used for deploying the copy pod corresponding to the copy number to the plurality of nodes corresponding to the node number according to the preset configuration file and the node number, wherein the copy pod is a copy of the pod to be expanded.
7. The pod capacity expansion device of claim 6, wherein the deployment module is specifically configured to:
determining the number of deployment rounds and target node information of each deployment round according to the number of the nodes and the number of the copies; the target node information comprises target nodes and corresponding target node numbers;
and deploying the copies pod of the target node number deployed in each round to the corresponding target nodes according to the preset configuration file.
8. The pod capacity expansion device of claim 7, wherein the deployment module, when determining, according to the number of nodes and the number of copies, the number of deployment rounds and the target node information for each deployment round, is specifically configured to:
performing integer division operation on the number of the copies and the number of the nodes to obtain a quotient and a remainder;
taking the quotient as a temporary wheel number;
taking the number of the nodes as the number of target nodes deployed in each round of the temporary round number, and taking the plurality of nodes as the target nodes deployed in each round of the temporary round number;
if the remainder is 0, taking the temporary round number as the deployment round number;
if the remainder is not 0, a new round is added on the basis of the number of the temporary rounds, the number of the temporary rounds after the new round is added is used as the number of the deployment rounds, the remainder is used as the number of the target nodes of the new round, and the nodes of the remainder are determined from the nodes to be used as the target nodes of the new round.
9. A node comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the pod capacity expansion method according to any of claims 1-5 when executing the computer program.
10. A computer-readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the pod capacity expansion method of any of claims 1-5.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110210579.4A CN112882794B (en) | 2021-02-25 | 2021-02-25 | pod capacity expansion method, device, node and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110210579.4A CN112882794B (en) | 2021-02-25 | 2021-02-25 | pod capacity expansion method, device, node and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112882794A true CN112882794A (en) | 2021-06-01 |
| CN112882794B CN112882794B (en) | 2022-10-28 |
Family
ID=76054472
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110210579.4A Active CN112882794B (en) | 2021-02-25 | 2021-02-25 | pod capacity expansion method, device, node and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112882794B (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113918275A (en) * | 2021-09-09 | 2022-01-11 | 深圳云天励飞技术股份有限公司 | Method and device for expanding cluster container, computer equipment and storage medium |
| CN114116123A (en) * | 2021-11-02 | 2022-03-01 | 新华三大数据技术有限公司 | Application expansion method and device |
| CN115098215A (en) * | 2022-07-19 | 2022-09-23 | 重庆紫光华山智安科技有限公司 | Data paging method, system, electronic device and storage medium based on multiple services |
| CN115617517A (en) * | 2022-10-12 | 2023-01-17 | 中航信移动科技有限公司 | A data processing system for application pod control |
Citations (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180288152A1 (en) * | 2017-04-01 | 2018-10-04 | Anjaneya R. Chagam Reddy | Storage dynamic accessibility mechanism method and apparatus |
| CN109150987A (en) * | 2018-07-27 | 2019-01-04 | 北京友普信息技术有限公司 | The two-layer container cluster elasticity expansion method of Intrusion Detection based on host layer and container floor |
| CN109446032A (en) * | 2018-12-19 | 2019-03-08 | 福建新大陆软件工程有限公司 | Method and system for Kubernetes replica expansion and contraction |
| US20200042632A1 (en) * | 2018-08-03 | 2020-02-06 | EMC IP Holding Company LLC | Continuous replication and granular application level replication |
| CN110764918A (en) * | 2019-11-04 | 2020-02-07 | 浪潮云信息技术有限公司 | Method for managing main nodes in container cluster |
| CN110958138A (en) * | 2019-11-14 | 2020-04-03 | 新华三大数据技术有限公司 | Container expansion method and device |
| CN111104368A (en) * | 2019-12-16 | 2020-05-05 | 浪潮云信息技术有限公司 | Method and system for realizing storage capacity expansion of container |
| CN111737003A (en) * | 2020-06-24 | 2020-10-02 | 重庆紫光华山智安科技有限公司 | Pod balanced scheduling method and device, main node and storage medium |
| CN112346872A (en) * | 2020-11-24 | 2021-02-09 | 中国工商银行股份有限公司 | Cloud computing capacity expansion method and device based on service call link |
| CN113051075A (en) * | 2021-03-23 | 2021-06-29 | 烽火通信科技股份有限公司 | Kubernetes intelligent capacity expansion method and device |
| US20220083389A1 (en) * | 2020-09-16 | 2022-03-17 | Nutanix, Inc. | Ai inference hardware resource scheduling |
-
2021
- 2021-02-25 CN CN202110210579.4A patent/CN112882794B/en active Active
Patent Citations (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180288152A1 (en) * | 2017-04-01 | 2018-10-04 | Anjaneya R. Chagam Reddy | Storage dynamic accessibility mechanism method and apparatus |
| CN109150987A (en) * | 2018-07-27 | 2019-01-04 | 北京友普信息技术有限公司 | The two-layer container cluster elasticity expansion method of Intrusion Detection based on host layer and container floor |
| US20200042632A1 (en) * | 2018-08-03 | 2020-02-06 | EMC IP Holding Company LLC | Continuous replication and granular application level replication |
| CN109446032A (en) * | 2018-12-19 | 2019-03-08 | 福建新大陆软件工程有限公司 | Method and system for Kubernetes replica expansion and contraction |
| CN110764918A (en) * | 2019-11-04 | 2020-02-07 | 浪潮云信息技术有限公司 | Method for managing main nodes in container cluster |
| CN110958138A (en) * | 2019-11-14 | 2020-04-03 | 新华三大数据技术有限公司 | Container expansion method and device |
| CN111104368A (en) * | 2019-12-16 | 2020-05-05 | 浪潮云信息技术有限公司 | Method and system for realizing storage capacity expansion of container |
| CN111737003A (en) * | 2020-06-24 | 2020-10-02 | 重庆紫光华山智安科技有限公司 | Pod balanced scheduling method and device, main node and storage medium |
| US20220083389A1 (en) * | 2020-09-16 | 2022-03-17 | Nutanix, Inc. | Ai inference hardware resource scheduling |
| CN112346872A (en) * | 2020-11-24 | 2021-02-09 | 中国工商银行股份有限公司 | Cloud computing capacity expansion method and device based on service call link |
| CN113051075A (en) * | 2021-03-23 | 2021-06-29 | 烽火通信科技股份有限公司 | Kubernetes intelligent capacity expansion method and device |
Non-Patent Citations (4)
| Title |
|---|
| LILY PUSPA DEWI等: "Server Scalability Using Kubernetes", 《2019 4TH TECHNOLOGY INNOVATION MANAGEMENT AND ENGINEERING SCIENCE INTERNATIONAL CONFERENCE (TIMES-ICON)》 * |
| NGUYEN等: "Horizontal Pod Autoscaling in Kubernetes for Elastic Container Orchestration", 《SENSORS》 * |
| 刘世龙: "基于Kubernetes的边缘计算边缘侧弹性服务研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
| 陈雁等: "基于Kubernetes应用的弹性伸缩策略", 《计算机系统应用》 * |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113918275A (en) * | 2021-09-09 | 2022-01-11 | 深圳云天励飞技术股份有限公司 | Method and device for expanding cluster container, computer equipment and storage medium |
| CN114116123A (en) * | 2021-11-02 | 2022-03-01 | 新华三大数据技术有限公司 | Application expansion method and device |
| CN115098215A (en) * | 2022-07-19 | 2022-09-23 | 重庆紫光华山智安科技有限公司 | Data paging method, system, electronic device and storage medium based on multiple services |
| CN115098215B (en) * | 2022-07-19 | 2024-06-04 | 重庆紫光华山智安科技有限公司 | Multi-service-based data paging method, system, electronic equipment and storage medium |
| CN115617517A (en) * | 2022-10-12 | 2023-01-17 | 中航信移动科技有限公司 | A data processing system for application pod control |
| CN115617517B (en) * | 2022-10-12 | 2023-11-10 | 中航信移动科技有限公司 | A data processing system for application pod control |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112882794B (en) | 2022-10-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112882794B (en) | pod capacity expansion method, device, node and storage medium | |
| CN115328663B (en) | Method, device, equipment and storage medium for scheduling resources based on PaaS platform | |
| CN111880936B (en) | Resource scheduling method, device, container cluster, computer equipment and storage medium | |
| CN109104467B (en) | Development environment construction method and device, platform system and storage medium | |
| US7493377B2 (en) | Method and apparatus to manage a configuration of clustered computers according to deployment date structures | |
| CN108959385B (en) | Database deployment method, device, computer equipment and storage medium | |
| CN103905508B (en) | Cloud platform application dispositions method and device | |
| CN111770162B (en) | Network bandwidth limiting method, device, master node and storage medium | |
| CN112865993B (en) | Method and device for switching slave nodes in distributed master-slave system | |
| CN111274033B (en) | Resource deployment method, device, server and storage medium | |
| CN101257406B (en) | Method and system for discovering net elements | |
| CN114710549B (en) | A dynamic management method, system and business node for network cards in a container platform | |
| CN112953774A (en) | Network topology generation method, system, equipment and computer storage medium | |
| CN114710350A (en) | Allocation method and device for callable resources | |
| CN114675940A (en) | Application instance construction method, device and equipment | |
| CN112003754A (en) | Visual node registration method for OpenStack cluster | |
| CN110233767A (en) | Service configuration method, system, device and the readable storage medium storing program for executing of distributed type assemblies | |
| CN112953739B (en) | K8S platform-based method, system and storage medium for nanotube SDN | |
| CN115328529B (en) | Application management method and related equipment | |
| CN119987808A (en) | Network upgrade method, device, equipment, medium and program product | |
| CN111338752B (en) | Container adjusting method and device | |
| CN116954870B (en) | Migration method, recovery method and device of cross-cluster application and cluster system | |
| CN115495225A (en) | Data processing method and device, storage medium and electronic device | |
| CN113138842A (en) | Scheduling method, device and medium for micro-service cluster | |
| CN116700983B (en) | Multi-type AI task dynamic scheduling method |
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 |