CN112162817A - Processing method and device for deploying service resources of container cluster and storage medium - Google Patents

Processing method and device for deploying service resources of container cluster and storage medium Download PDF

Info

Publication number
CN112162817A
CN112162817A CN202010942114.3A CN202010942114A CN112162817A CN 112162817 A CN112162817 A CN 112162817A CN 202010942114 A CN202010942114 A CN 202010942114A CN 112162817 A CN112162817 A CN 112162817A
Authority
CN
China
Prior art keywords
resource
cascade
resources
target
level
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
Application number
CN202010942114.3A
Other languages
Chinese (zh)
Other versions
CN112162817B (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.)
Sina Technology China Co Ltd
Original Assignee
Sina Technology China 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 Sina Technology China Co Ltd filed Critical Sina Technology China Co Ltd
Priority to CN202010942114.3A priority Critical patent/CN112162817B/en
Publication of CN112162817A publication Critical patent/CN112162817A/en
Application granted granted Critical
Publication of CN112162817B publication Critical patent/CN112162817B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a processing method and a device for deploying service resources of a container cluster, and a storage medium, wherein the processing method comprises the following steps: monitoring deployment service resources of the container cluster; when a changed target deployment service resource exists in the container cluster, acquiring cascade resource relation data and cascade resource state data corresponding to at least one group of cascade resource groups with cascade relation; if the target deployment service resource belongs to a target cascade resource group in at least one group of cascade resources, updating the copy number of each level of cascade resources in the target cascade resource group according to the change condition of the target deployment service resource and the capacity expansion and contraction strategy of the Pod corresponding to each level of cascade resources in the target cascade resource group; and adjusting the capacity of the Pod correspondingly managed by each level of cascade resources in the target cascade resource group according to the updated copy number. The method and the device can realize automatic scaling adjustment of the Pod capacity corresponding to the deployment service resource with the dependency relationship through the cascade relationship.

Description

Processing method and device for deploying service resources of container cluster and storage medium
Technical Field
The present application relates to the field of container cluster technologies, and in particular, to a method and an apparatus for processing a container cluster deployment service resource, and a computer-readable storage medium.
Background
K8S is a container-based cluster management platform, which is known collectively as kubernets. In kubernets resource and function, Deployment (Deployment) and stateful set (stateful set) are two independent resources. I.e. at the cluster level k8S level, there is no direct correlation between the two. In addition, even between Deployment and Deployment, and between StatefulSet and StatefulSet, there is no necessary association. However, for the service level, there may be a dependency or cascade relationship between the Deployment and the Deployment, and between the stateful set and the stateful set. Therefore, some deployments or stateful sets with dependency or cascade relationships in service call cannot directly perform association operations. Such as: the service of the Deployment A depends on the service of the Deployment B, and when the capacity of the Pod of the Deployment A is expanded due to the increase of the traffic volume, the service of the Deployment B cannot be sensed, and the service of the Deployment B is directly dragged down.
Therefore, it is necessary to provide a solution to solve the problem that the Pod capacity corresponding to the deployed service resource with dependency cannot be expanded or contracted according to the business requirement due to the absence of correlation between the independent resources.
Disclosure of Invention
An object of the embodiment of the present application is to provide a method and an apparatus for processing a deployment service resource of a container cluster, and a computer-readable storage medium, so as to solve a problem that Pod capacity corresponding to a deployment service resource with a dependency relationship cannot be scaled according to a business requirement.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, a method for processing deployment service resources of a container cluster is provided, including: monitoring deployment service resources of a container cluster, wherein the deployment service resources of the container cluster comprise at least one group of cascade resource groups with cascade relation, each cascade resource group comprises a root resource and cascade resources of each level to which the root resource belongs, and the type of the deployment service resources comprises independent resources and the cascade resource groups; when a changed target deployment service resource exists in the container cluster, acquiring cascade resource relation data and cascade resource state data corresponding to at least one group of cascade resource groups with a cascade relation, wherein the cascade resource relation data describes the relation between a root resource of the cascade resource group and cascade resources of all levels to which the root resource belongs, and a capacity expansion and contraction strategy of a Pod (Pod) managed by the cascade resources of all levels, and the cascade resource state data records the copy number of the root resource and the cascade resources of all levels to which the root resource belongs; if the target deployment service resource belongs to the target cascade resource group in the at least one group of cascade resource groups with the cascade relation, updating the copy number of each level of cascade resources in the target cascade resource group according to the change condition of the target deployment service resource and the capacity scaling strategy of the Pod managed by each level of cascade resources in the target cascade resource group; and adjusting the capacity of the Pod correspondingly managed by each level of cascade resources in the target cascade resource group according to the updated copy number.
Optionally, the updating, according to the change condition of the target deployment service resource and the capacity scaling policy of the Pod for managing each level of cascading resources in the target cascading resource group, the number of copies corresponding to each level of cascading resources in the target cascading resource group includes: when the change condition of the target deployment service resource is the change of the copy number of the root resource of the target cascade resource group, updating the root resource in the target cascade resource group and the copy number of the cascade resource at each level to which the root resource belongs according to a capacity expansion and contraction strategy of the Pod managed by the cascade resources at each level in the target cascade resource group; when the change condition of the target deployment service resource is the change of the capacity expansion and contraction strategy of the Pod managed by the target deployment service resource described in the cascade resource relation data, updating the target deployment service resource and the copy number of the cascade resource at each level to which the target deployment service resource belongs according to the capacity expansion and contraction strategy of the Pod managed by each level of cascade resource in the target cascade resource group.
Optionally, the updating the number of copies of the root resource and the cascade resources of each level to which the root resource belongs in the target cascade resource group includes: updating the copy number of the deployment service resources corresponding to the root resources in the target cascade resource group and the copy number of the deployment service resources corresponding to each level of cascade resources in the target cascade resource group; correspondingly updating the copy quantity of the root resource and all levels of cascade resources in the cascade resource state data according to the updated copy quantity of each deployed service resource;
updating the copy number of the target deployment service resource and the cascade resources of each level to which the target deployment service resource belongs, wherein the updating comprises the following steps: updating the copy number of the target deployment service resource and the copy number of the deployment service resource corresponding to each level of cascade resource to which the target deployment service resource belongs; and correspondingly updating the target deployment service resources and the copy number of the cascade resources at each level to which the target deployment service resources belong in the cascade resource state data according to the updated copy number of each deployment service resource.
Optionally, the cascade resource relationship data includes first description data defining a root resource of the cascade resource group and second description data defining a first cascade resource corresponding to a next level of the root resource of the cascade resource group, where the first description data includes a first field, and the first field points to the second description data; the second description data includes a capacity scaling policy of the Pod managed by the first cascading resource and at least one of a type, a name, an application program interface, and a namespace of the first cascading resource.
Optionally, the cascade resource relationship data further includes third description data defining a second cascade resource corresponding to a next level of the first cascade resource, where the third description data further includes a second field, the second field stores a list of the third description data, and the third description data is the same as the second description data.
Optionally, the capacity scaling policy includes at least one of a policy type and a copy number range, where the copy number range includes a maximum copy number and/or a minimum copy number.
Optionally, the cascade resource state data includes first state data defining a root resource of the cascade resource group and second state data defining a first cascade resource corresponding to a next level of the root resource of the cascade resource group, where the first state data includes the number of copies of the root resource of the cascade resource group and a third field, and the third field points to the second state data; the second state data includes a number of copies of the first cascaded resource and at least one of a type, a name, an application program interface, and a namespace of the first cascaded resource.
Optionally, the cascade resource status data further includes third status data defining a second cascade resource corresponding to a next level of the first cascade resource, where the third status data further includes a fourth field, and the fourth field stores a list of the third description data, and the third description data is the same as the second description data.
In a second aspect, a processing apparatus for deploying service resources for a container cluster is provided, which includes a processor and a processor electrically connected to the memory, the memory storing a computer program executable by the processor, and the computer program implementing the steps of the method according to the first aspect when executed by the processor.
In a third aspect, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to the first aspect.
In the embodiment of the application, deployment service resources of a container cluster are monitored, when changed target deployment service resources exist in the container cluster, cascade resource relation data and cascade resource state data corresponding to at least one group of cascade resource groups with a cascade relation in the deployment service resources of the container cluster are obtained, the cascade resource relation data describe relations between root resources of the cascade resource groups and cascade resources of all levels to which the root resources belong, and capacity expansion and contraction strategies of Pod (Pod) managed by the cascade resources of all levels, and the cascade resource state data record the copy number of the root resources and the cascade resources of all levels to which the root resources belong.
Therefore, by monitoring the change of the deployment service resources of the container cluster, when the changed target deployment service resources exist, the number of copies corresponding to other deployment service resources establishing a cascade relation with the changed target deployment service resources is correspondingly updated according to the capacity expansion and contraction strategy of the corresponding Pod, so as to realize the automatic adjustment of the correspondingly managed Pod capacity.
Therefore, the cascade relation is established by the depolymenet or the stateful set which has the dependency relation or the cascade relation in the service calling, and when one of the deployed service resources changes, the other corresponding cascade resources correspondingly update the copy number to expand and contract the corresponding Pod capacity, so that the dynamic cascade linkage between the linked deployed service resources can be realized, and the safety of providing service by deploying the service resources by the container cluster is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a flowchart illustrating a processing method for deploying service resources of a container cluster according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a hierarchical structure of a cascaded resource group having a cascading relationship according to an embodiment of the present application.
Fig. 3 is a data structure diagram of a cascade resource relationship corresponding to a cascade resource group in the embodiment of the present application.
Fig. 4 is a diagram of a cascade resource state data structure corresponding to a cascade resource group according to an embodiment of the present application.
Fig. 5 is an example flowchart of a processing method for deploying service resources of a container cluster according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of a processing apparatus for deploying service resources of a container cluster according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. 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 application. The reference numbers in the present application are only used for distinguishing the steps in the scheme and are not used for limiting the execution sequence of the steps, and the specific execution sequence is described in the specification.
In order to solve the problems in the prior art, an embodiment of the present application provides a method for processing a container cluster to deploy service resources, as shown in fig. 1, including the following steps:
step 102: and monitoring the deployment service resource of the container cluster. The deployment service resources of the container cluster comprise at least one group of cascading resource groups with a cascading relationship, each cascading resource group comprises a root resource and cascade resources of each level to which the root resource belongs, and the type of the deployment service resources comprises independent resources and cascading resource groups. For example, in a kubernets container cluster, deploying service resources includes Deployment (deployments) and stateful set (stateful set). The monitoring of the Deployment service resources is performed to discover which and what kind of changes have occurred in the Deployment and stateful set resources in the container. The independent resource is a single deployment service resource without cascade relation, and the cascade resource group comprises at least two deployment service resources with cascade relation of upper and lower layers.
Step 104: when the + -changed target deployment service resources exist in the container cluster, acquiring cascade resource relation data and cascade resource state data corresponding to at least one group of cascade resource groups with a cascade relation, wherein the cascade resource relation data describes the relation between the root resources of the cascade resource groups and cascade resources at all levels to which the cascade resource groups belong, and a capacity expansion and contraction strategy of the Pod managed by the cascade resource groups at all levels, and the cascade resource state data records the copy number of the root resources and cascade resources at all levels to which the root resources belong.
Step 106: if the target deployment service resource belongs to a target cascade resource group in the at least one group of cascade resources, updating the copy number of each level of cascade resources in the target cascade resource group according to the change condition of the target deployment service resource and a capacity expansion and contraction strategy of a Pod (Pod) managed by each level of cascade resources in the target cascade resource group; and
step 108: and adjusting the capacity of the Pod correspondingly managed by each level of cascade resource in the target cascade resource group according to the updated copy number.
The cascade resource group is a collection of service resources with the same root resource, at least one cascade resource group can be defined in the container cluster, and the root resource in each cascade resource group and the corresponding cascade resources at each level have a cascade relationship of an upper level and a lower level. For example, referring to fig. 2, fig. 2 is a schematic diagram of a hierarchical structure of a cascaded resource group having a cascading relationship according to an embodiment of the present application.
As shown in fig. 2, the top level 0 in a certain cascaded resource group corresponds to a root resource, that is, deployment a, and each level of cascaded resources corresponding to the next level of deployment a includes deployment B, deployment C, stateful set D, and deployment E. Deployment B and deployment C are levels 1 directly corresponding to the next level of deployment A of the root resource, a state set D is a level 2 directly corresponding to the next level of deployment C, and deployment E is a level 3 directly corresponding to the next level of state set D. The number of the cascading resources of each layer corresponding to each level in the cascading resource group may be one or multiple, and is specifically determined according to the association between each deploying service resource. Similarly, the number of hierarchical layers of the cascading resources in the cascading resource group is at least two or more layers including the root resource, and is specifically determined according to the relevance between each deployment service resource.
In an embodiment, the target Deployment service resource may be a Deployment service resource currently modified by a user, and the user may modify the configuration of a Deployment service resource or a stateful set resource, so that the target Deployment service resource changes.
Optionally, the change condition of the target deployment service resource is a change in the number of copies of the root resource of the target cascade resource group where the target deployment service resource is located, or a change in a capacity scaling policy of a Pod managed by the target deployment service resource described in the cascade resource relationship data.
The cascade resource relationship data describes the relationship between the root resource of the cascade resource group and the cascade resources of each level to which the root resource belongs, for example, the cascade relationship between the root resource and the cascade resources of each level shown in fig. 2, and further describes the capacity scaling policy of each Pod for managing deployment service resources corresponding to the cascade resource group. The capacity expansion and reduction strategy of the Pod is used for configuring the Pod corresponding to each deployed service resource to be expanded or reduced according to which strategy. Optionally, the capacity scaling policy of Pod includes at least one of a policy type and a copy number range.
Optionally, the policy type includes at least one of synchronization, percentage, more than number of copies, and less than number of copies, where synchronization indicates that the number of cascaded resources of a certain hierarchical connection and the number of copies of its previous hierarchical connection are kept synchronous, percentage indicates that the number of cascaded resources of the certain hierarchical connection and the number of copies of its previous hierarchical connection keep a certain percentage, more than number of copies indicates that the number of cascaded resources of the certain hierarchical connection is more than the number of cascaded copies of its previous hierarchical connection by a certain amount, and less than number of copies indicates that the number of cascaded resources of the certain hierarchical connection is less than the number of cascaded copies of its previous hierarchical connection by a certain amount. The copy number range comprises the maximum copy number and/or the minimum copy number, and the copy number corresponding to a certain cascading resource is limited in range. That is, the maximum number of copies corresponding to a certain cascading resource cannot exceed the maximum number of copies, and/or the minimum number of copies cannot be lower than the minimum number of copies.
In this way, by expanding or reducing the copy number policy and the copy number range corresponding to the cascading resource, the copy corresponding to the cascading resource can be adjusted, and further, the capacity of the Pod correspondingly managed by the cascading resource can be adjusted.
And recording the copy number of the root resource and all levels of cascade resources to which the root resource belongs by the cascade resource state data, and updating the copy number of the cascade resources according to the capacity expansion and contraction strategy of the Pod.
In order to solve the problems in the prior art, at least one group of cascading resource groups with a cascading relationship in the deployment service resources of the container cluster is customized, so that a dynamic cascading linkage is achieved by setting the cascading relationship and the cascading strategy.
Optionally, the cascade resource relationship data includes first description data defining a root resource of a cascade resource group and second description data defining a first cascade resource corresponding to a next level of the root resource of the cascade resource group, where the first description data includes a first field, and the first field points to the second description data; the second description data includes a capacity scaling policy of the Pod managed by the first cascading resource and at least one of a type, a name, an application program interface, and a namespace of the first cascading resource.
The above data structure represents a group of cascading resources having a layer of root resources and a layer of cascading resources that is the next level of the root resources. Optionally, the cascade resource of the next level of the root resource may correspond to a layer of cascade resources of the next level. The number of root resources is one, and the number of cascading resources per level may be at least one.
That is, the cascade resource relationship data further includes third description data defining a second cascade resource corresponding to a next level of the first cascade resource, where the third description data further includes a second field, the second field stores a list of the third description data, and the third description data is the same as the second description data.
Thus, a cascade relation between the root resource of the cascade resource group and each cascade resource is established.
Optionally, the cascade resource state data includes first state data defining a root resource of a cascade resource group and second state data defining a first cascade resource corresponding to a next level of the root resource of the cascade resource group, where the first state data includes the number of copies of the root resource of the cascade resource group and a third field, and the third field points to the second state data; the second state data includes a number of copies of the first cascaded resource and at least one of a type, a name, an application program interface, and a namespace sum of the first cascaded resource.
Optionally, the cascade resource status data further includes third status data defining a second cascade resource corresponding to a next level of the first cascade resource, where the third status data further includes a fourth field, and the fourth field stores a list of the third description data, and the third description data is the same as the second description data.
In this manner, the states of cascaded resources of a hierarchy of entire sets of cascaded resources may be concatenated out.
Next, referring to fig. 3 and 4, taking a group of cascade resource groups having a cascade relationship as an example, cascade resource relationship data and cascade resource state data corresponding to the cascade resource group in the embodiment of the present application are explained.
As shown in fig. 3, the cascading resource relationship data may be obtained by creating a plurality of data structures to create a cascading relationship between the respective deployed service resources having an association or dependency relationship, including a structure corresponding to the cascading Pod natural scaling capacity specification 11 of the root resource, a structure corresponding to the slave reference 12 of the first cascading resource, and a structure corresponding to the slave reference 16 of the second cascading resource.
The cascading Pod natural scaling manifest 11 defines a Deployment or stateful set object of the root resource, and the root reference field type of the cascading Pod natural scaling manifest is a structure of the secondary reference 12. That is, the root reference field points to the structure of the slave reference 12.
The Deployment or stateful set object of the first cascading resource is defined from the structure referring to 12, and as shown in fig. 3, includes a type field, a name field, an interface version field of an application, and a namespace field of the Deployment or stateful set resource, and these fields are used for uniquely determining the Deployment or stateful set resource in the kuberenetes container cluster.
The policy field in the structure body of reference 12 is used to determine the capacity scaling policy of the Pod managed by the Deployment or stateful set, and the structure body of policy 13 corresponding to the policy field.
The policy type in the structure of the policy 13 defines the specific policy type of the extended/contracted capacity of the Pod for resource management of the Deployment or stateful set. Specific policy types include, for example: sync, percent, more copies than copies, less copies than copies.
The structure body of the range 14 corresponding to the range field corresponding to the number of copies in the structure body of the policy 13 is used to define the upper limit and the lower limit of the capacity scaling policy of the Pod, that is, the maximum number of copies and the minimum copy, and is used to restrict the number of the pods correspondingly managed by the first cascaded resource.
From the structure of reference 12, the reference field is a list 15, and the structure stored in list 15 is: the structure composed of the structure corresponding to citation 16, the structure corresponding to policy 17, and the structure corresponding to range 18 is the same as the structure composed of the structure corresponding to citation 12, the structure corresponding to policy 13, and the structure corresponding to range 14. That is, the next level of the cascade of the Deployment or stateful set resource will be able to concatenate the entire cascade hierarchy of the set of cascade resources through the slave reference field in the structure of the slave reference 12.
As shown in fig. 4, the cascading resource status data may also be obtained by creating a plurality of data structures to record the status of each deployment service resource having an association or dependency relationship, including a structure corresponding to the cascading Pod automatic expansion/contraction status 21 of the root resource, a structure corresponding to the case 22 of the first cascading resource, and a structure corresponding to the case 24 of the second cascading resource.
The structure body of the cascade Pod automatic expansion and contraction state 21 includes three fields, which are respectively used for defining the zoom time of the last Pod, the current copy number of the Deployment or stateful set resource of the root resource, and the root condition of the cascade resource state of the Deployment or stateful set resource of the root resource.
The root case field points to the structural body corresponding to the case 22, and the structural body of the case 22 is used for defining a specific state, including a current copy number field of a Deployment or stateful set resource representing the first cascading resource, a type field of the resource, a name field, an interface version field of an application program, and a namespace field, and is used for uniquely determining the Deployment or stateful set resource.
The case field of the structure of case 12 is a list 23, the structure stored in the list 23 is a structure composed of the structures of case 24, and the structures of case 24 and 22 are the same. That is, the status of the entire cascade hierarchy of the cascade resource group can be concatenated out through the status field in the structure of the status 22 in the next cascade status of the resource of the delivery or stateful set.
In step 106, updating the number of copies corresponding to each level of cascading resources in the target cascading resource group according to the change condition of the target deployment service resource and the capacity scaling policy of the Pod corresponding to each level of cascading resources in the target cascading resource group, including:
when the change condition of the target deployment service resource is the change of the copy number of the root resource of the target cascade resource group, updating the root resource in the target cascade resource group and the copy number of the cascade resource at each level to which the root resource belongs according to a capacity expansion and contraction strategy of the Pod managed by the cascade resources at each level in the target cascade resource group;
when the change condition of the target deployment service resource is the change of the capacity expansion and contraction strategy of the Pod managed by the target deployment service resource described in the cascade resource relation data, updating the target deployment service resource and the copy number of the cascade resource at each level to which the target deployment service resource belongs according to the capacity expansion and contraction strategy of the Pod managed by each level of cascade resource in the target cascade resource group.
When the change condition of the target deployment service resource is that the copy number of the root resource of the target cascade resource group changes, updating the root resource of the target cascade resource group and the copy number of the cascade resource of each level to which the root resource belongs according to the capacity scaling strategy of the Pod managed by each level of cascade resource in the target cascade resource group, which is described as follows by taking fig. 2 as an example: if the number of actually updated copies of the root resource deployment A of the level 0 is 10, then the number of the actually updated copies of the root resource deployment A of the level 0 is 10 according to the strategy type 'synchronization' of the cascade resource deployment B of the level1 of the next level; deployment C is then based on policy type "less than number of copies" and less than number of copies is 3, and the number of copies in the update status data is (10-3) ═ 7. The level 2 resource, i.e., the number of copies of the stateful set D, is updated according to the level1 deployment C of the level one above it. In the case where the deployment C updates the number of copies to 7, the number of copies of the stateful set D may be updated to (7+1) ═ 8 according to the policy type "more copies" and 3 more copies. Similarly, according to the policy type "synchronization" and range "maximum copy number is 6" and "minimum copy number is 2" corresponding to the deployment E of the hierarchy 3, the number of copies of the update deployment E may be 6, according to the number of update copies of the stateful set D of the hierarchy 2 being 8.
When the change condition of the target deployment service resource is the change of the capacity scaling policy of the Pod managed by the target deployment service resource described in the cascade resource relationship data, updating the target deployment service resource and the copy number of the cascade resource at each level to which the target deployment service resource belongs according to the capacity scaling policy of the Pod managed by the cascade resource at each level in the target cascade resource group, which is described as follows by taking fig. 2 as an example: if the change condition of the deployment C of the cascade resources of level1 is the change of the capacity scaling policy of its associated Pod, for example, the policy type is "less than the number of copies is 3" as shown in fig. 2, and the policy type is "synchronous", the number of copies is updated to 10 according to the actual number of copies 10 of the deployment a of the previous level. Correspondingly, if there is no change in the stateful set D of level 2 of the next level, the number of copies needs to be updated to (10+1) ═ 11 according to the policy type. According to the cascade relation, the number of the copies of the deployment E of the level 3 is still kept to be 6 according to the number of the copies of the stateful set D of the level 2, the policy type corresponding to the deployment E and the copy number range.
Optionally, the updating the number of copies of the root resource and the cascade resources of each level to which the root resource belongs in the target cascade resource group includes: updating the copy number of the deployment service resources corresponding to the root resources in the target cascade resource group and the copy number of the deployment service resources corresponding to each level of cascade resources in the target cascade resource group; and correspondingly updating the copy quantity of the root resource and all levels of cascade resources in the cascade resource state data according to the updated copy quantity of each deployed service resource.
That is, the updating comprises two steps, wherein in the first step, according to the change of the number of the root resource copies of the monitored target deployment service resource, the corresponding copy number increase and decrease are executed firstly; then, the number of the non-cached copies of the target deployment service resource is requested to be obtained again so as to determine the number of the copies actually completed by the copy adding operation. For example, the change of the monitoring user to the target deployment service resource is to modify the number of the copies of the root resource to 11, then the number of the copies of the root resource is updated according to the change, then the number of the non-cached copies of the target deployment service resource is obtained, it is determined that the number of the copies of the root resource is actually modified by the update operation to 10, and then the number of the copies in the cascade resource state data corresponding to the target deployment service resource is updated to 10 according to the actually updated 10 numbers of the copies.
Optionally, the updating the copy number of the target deployment service resource and the cascade resources of each level to which the target deployment service resource belongs includes: updating the copy number of the target deployment service resource and the copy number of the deployment service resource corresponding to each level of cascade resource to which the target deployment service resource belongs; and correspondingly updating the target deployment service resources and the copy number of the cascade resources at each level to which the target deployment service resources belong in the cascade resource state data according to the updated copy number of each deployment service resource.
Reference is now made to fig. 5, which is a flowchart illustrating an example processing method for deploying service resources of a container cluster according to an embodiment of the present application.
In this example, the following steps are included:
step 001: creating a manager;
step 002, step 003: the manager monitors the change of the resource of the Deployment and the StatefUlSet;
step 004: once there is a change, the manager triggers the coordinator to process.
Step 005: after the coordinator is triggered, all cascade resource groups defined by a user and having a cascade relation are obtained;
step 006: if no error exists in the acquisition process, circularly processing all the acquired cascade resource groups;
step 007: if the error exists, carrying out error processing;
step 008: if the cascade resources do not exist, directly returning to the coordinator, and waiting to be triggered again;
step 009: and if the error is the failure of reading the object, returning, and simultaneously returning error information to wait for the coordinator to be triggered again.
Step 010: in the process of obtaining the cascade resource group cyclically in step 006, determining whether the received monitored target resource (delivery or stateful set) is in the cascade resource group;
step 011: if not, directly returning to enter the next cycle;
step 012: if the monitored resource (the delivery or the stateful set) is in the cascade resource group, acquiring the copy number of Level 0 (namely, the root resource) of the cascade resource group;
step 013: then obtaining the Level1 of the cascade resource group (namely, the cascade resource of the next Level of the root resource);
step 014: if the Level1 is not obtained, it indicates that the Level1 resource does not exist, and directly returns to step 006 to enter the next cycle to cycle other cascade resource groups.
Step 015: if the Level1 resource of the cascade resource exists, the state of the Level 0 of the cascade resource group is updated, that is, the parameter corresponding to the root current copy number segment in the corresponding cascade resource state data is updated according to the copy number of the Level 0 acquired in the step 012;
step 016: then obtaining the Level1 of the next Level of the cascade resource group, wherein the cascade resource of the Level1 of the next Level is a list array (corresponding to the list 15 of fig. 2) according to the previously defined data structure;
step 017: then, circulating the resources of the next Level1 of the cascade resource group;
step 018: according to the monitored resource change condition, obtaining the number of copies expected by the cascade resource of Level1, namely the number of copies needing to be updated,
step 019 to step 022: and acquiring the cascade strategy corresponding to the cascade resource of the Level1 through a strategy field in cascade resource relation data correspondingly defined by the cascade resource group, and calculating the copy number according to the selected cascade strategy.
Step 023: if the copy range is set, namely the maximum and minimum copy ranges, the method enters the copy number range control and limits the maximum copy number and/or the minimum copy number.
And 024: updating the copy number of the Delpoyment or StatefUSe resource corresponding to the level;
step 025: acquiring a non-cached copy of a Delployment or StatefUSe resource corresponding to the hierarchy to determine the number of copies actually updated after the update operation is executed in the step 024;
step 026: updating the state of the cascade resources of the hierarchy according to the non-cache copy of the resources obtained in the step 025, namely updating the parameters corresponding to the current copy number field in the cascade resource state data corresponding to the cascade resources;
step 027: obtaining the cascade of the next Level of the cascade resource, such as the cascade resource of Level 2, if the cascade resource does not exist, continuing to circulate the next Level resource corresponding to the other cascade resource of the resource cascade Level 1;
step 028: and if so, acquiring the next Level 2 of the cascade resource to perform relevant cycle processing again until the cycle is ended.
Step 027 and step 028 above are for a case where there are multiple cascading resources at a certain level in the same cascading resource group, and each cascading resource may have a cascading resource at the next level or not. Through the above loop steps, the copy number of all cascade resources in the cascade resource group and the state parameter of the cascade resource state data can be updated.
In the embodiment of the application, monitoring deployment service resources of a container cluster, wherein the deployment service resources of the container cluster comprise at least one set of cascading resource groups with a cascading relationship, each cascading resource group comprises a root resource and cascading resources of each level to which the root resource belongs, the type of the deployment service resources comprises independent resources and the cascading resource groups, when the changed target deployment service resources exist in the container cluster, acquiring cascade resource relation data and cascade resource state data corresponding to at least one group of cascade resource groups with a cascade relation, wherein the cascade resource relation data describes the relation between the root resources of the cascade resource groups and cascade resources of all levels to which the cascade resource groups belong, and a capacity expansion and contraction strategy of the Pod managed by the cascade resource groups of all levels, and the cascade resource state data records the copy number of the root resources and cascade resources of all levels to which the root resources belong.
Therefore, by monitoring the change of the deployment service resources of the container cluster, when the changed target deployment service resources exist, the number of copies corresponding to other deployment service resources establishing a cascade relationship with the changed target deployment service resources is correspondingly updated according to the capacity expansion and contraction strategy of the corresponding Pod, so as to realize the automatic adjustment of the correspondingly managed Pod capacity.
Therefore, the cascade relation is established by the depolymenet or the stateful set which has the dependency relation or the cascade relation in the service calling, and when one of the deployed service resources changes, the other corresponding cascade resources correspondingly update the copy number to expand and contract the corresponding Pod capacity, so that the dynamic cascade linkage between the linked deployed service resources can be realized, and the safety of providing service by deploying the service resources by the container cluster is improved.
Optionally, an embodiment of the present application further provides a processing apparatus for deploying service resources of a container cluster, and fig. 6 is a schematic structural diagram of the processing apparatus for deploying service resources of the container cluster according to the embodiment of the present application.
As shown in fig. 6, the apparatus 2000 includes a memory 2200 and a processor 2400 electrically connected to the memory 2200, where the memory 2200 stores a computer program that can be executed by the processor 2400, and when the computer program is executed by the processor 2400, the processes of any one of the above embodiments of the method for processing a deployed service resource of a container cluster are implemented, and the same technical effect can be achieved, and therefore, for avoiding repetition, no further description is provided here.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements each process of the above-mentioned processing method for deploying service resources for a container cluster, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A processing method for deploying service resources of a container cluster is characterized by comprising the following steps:
monitoring deployment service resources of a container cluster, wherein the deployment service resources of the container cluster comprise at least one group of cascade resource groups with cascade relation, each cascade resource group comprises a root resource and cascade resources of each level to which the root resource belongs, and the type of the deployment service resources comprises independent resources and the cascade resource groups;
when a changed target deployment service resource exists in the container cluster, acquiring cascade resource relation data and cascade resource state data corresponding to at least one group of cascade resource groups with a cascade relation, wherein the cascade resource relation data describes the relation between a root resource of the cascade resource group and cascade resources of all levels to which the root resource belongs, and a capacity expansion and contraction strategy of a Pod (Pod) managed by the cascade resources of all levels, and the cascade resource state data records the copy number of the root resource and the cascade resources of all levels to which the root resource belongs;
if the target deployment service resource belongs to the target cascade resource group in the at least one group of cascade resource groups with the cascade relation, updating the copy number of each level of cascade resources in the target cascade resource group according to the change condition of the target deployment service resource and the capacity scaling strategy of the Pod managed by each level of cascade resources in the target cascade resource group; and
and adjusting the capacity of the Pod correspondingly managed by each level of cascade resource in the target cascade resource group according to the updated copy number.
2. The method of claim 1, wherein the updating the number of copies corresponding to each level of cascading resources in the target set of cascading resources according to the change condition of the target deployment service resource and a capacity scaling policy of a Pod for managing each level of cascading resources in the target set of cascading resources comprises:
when the change condition of the target deployment service resource is the change of the copy number of the root resource of the target cascade resource group, updating the root resource in the target cascade resource group and the copy number of the cascade resource at each level to which the root resource belongs according to a capacity expansion and contraction strategy of the Pod managed by the cascade resources at each level in the target cascade resource group;
when the change condition of the target deployment service resource is the change of the capacity expansion and contraction strategy of the Pod managed by the target deployment service resource described in the cascade resource relation data, updating the target deployment service resource and the copy number of the cascade resource at each level to which the target deployment service resource belongs according to the capacity expansion and contraction strategy of the Pod managed by each level of cascade resource in the target cascade resource group.
3. The method of claim 2,
updating the root resources in the target cascade resource group and the copy number of the cascade resources at each level to which the root resources belong, wherein the updating comprises the following steps:
updating the copy number of the deployment service resources corresponding to the root resources in the target cascade resource group and the copy number of the deployment service resources corresponding to each level of cascade resources in the target cascade resource group; correspondingly updating the copy quantity of the root resource and all levels of cascade resources in the cascade resource state data according to the updated copy quantity of each deployed service resource;
updating the copy number of the target deployment service resource and the cascade resources of each level to which the target deployment service resource belongs, wherein the updating comprises the following steps:
updating the copy number of the target deployment service resource and the copy number of the deployment service resource corresponding to each level of cascade resource to which the target deployment service resource belongs; and correspondingly updating the target deployment service resources and the copy number of the cascade resources at each level to which the target deployment service resources belong in the cascade resource state data according to the updated copy number of each deployment service resource.
4. The method of claim 1, wherein the cascading resource relationship data includes first description data defining a root resource of the cascading resource set and second description data defining a first cascading resource corresponding to a next level of the root resource of the cascading resource set, wherein,
the first description data comprises a first field, the first field pointing to the second description data;
the second description data includes a capacity scaling policy of the Pod managed by the first cascading resource and at least one of a type, a name, an application program interface, and a namespace of the first cascading resource.
5. The method of claim 4, wherein the cascading resource relationship data further includes third description data defining a second cascading resource corresponding to a next level of the first cascading resource, wherein,
the third description data further includes a second field storing a list of the third description data, the third description data being the same as the second description data.
6. The method of any of claims 1 to 5, wherein the capacity scaling policy comprises at least one of a policy type and a range of copy numbers, wherein,
the range of copy numbers includes a maximum copy number and/or a minimum copy number.
7. The method of claim 1, wherein the cascading resource status data includes first status data defining a root resource of the cascading resource set and second status data defining a first cascading resource corresponding to a next level of the root resource of the cascading resource set, wherein,
the first state data comprises a number of copies of a root resource of the cascaded resource group and a third field, the third field pointing to the second state data;
the second state data includes a number of copies of the first cascaded resource and at least one of a type, a name, an application program interface, and a namespace of the first cascaded resource.
8. The method of claim 7, wherein the cascading resource status data further includes third status data defining a second cascading resource corresponding to a next level of the first cascading resource, wherein,
the third status data further includes a fourth field storing a list of the third description data, the third description data being the same as the second description data.
9. A processing apparatus for deploying service resources for a container cluster, comprising: a memory and a processor electrically connected to the memory, the memory storing a computer program executable on the processor, the computer program, when executed by the processor, implementing the steps of the method of processing deployment service resources of a container cluster according to any of claims 1 to 8.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, realizes the steps of the processing method of deploying service resources of a container cluster according to any one of claims 1 to 8.
CN202010942114.3A 2020-09-09 2020-09-09 Processing method and device for deployment service resources of container cluster and storage medium Active CN112162817B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010942114.3A CN112162817B (en) 2020-09-09 2020-09-09 Processing method and device for deployment service resources of container cluster and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010942114.3A CN112162817B (en) 2020-09-09 2020-09-09 Processing method and device for deployment service resources of container cluster and storage medium

Publications (2)

Publication Number Publication Date
CN112162817A true CN112162817A (en) 2021-01-01
CN112162817B CN112162817B (en) 2023-09-26

Family

ID=73859256

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010942114.3A Active CN112162817B (en) 2020-09-09 2020-09-09 Processing method and device for deployment service resources of container cluster and storage medium

Country Status (1)

Country Link
CN (1) CN112162817B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806097A (en) * 2021-09-29 2021-12-17 杭州网易云音乐科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114327892A (en) * 2021-12-28 2022-04-12 武汉天喻信息产业股份有限公司 FLASH resource management method, storage medium, electronic equipment and device
CN114443311A (en) * 2022-04-07 2022-05-06 北京天维信通科技有限公司 Third-party service configuration method and device and electronic equipment
CN114691125A (en) * 2022-04-01 2022-07-01 上海道客网络科技有限公司 Method, system, medium and electronic device for mapping and converting application resources

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170339196A1 (en) * 2016-05-17 2017-11-23 Amazon Technologies, Inc. Versatile autoscaling
KR101807806B1 (en) * 2017-05-02 2017-12-11 나무기술 주식회사 Application containerization method on cloud platform
CN109697153A (en) * 2018-12-28 2019-04-30 浙江省公众信息产业有限公司 Monitoring method, monitoring system and computer readable storage medium
CN110262899A (en) * 2019-06-20 2019-09-20 无锡华云数据技术服务有限公司 Monitor component elastic telescopic method, apparatus and controlled terminal based on Kubernetes cluster
CN110297641A (en) * 2019-06-25 2019-10-01 四川长虹电器股份有限公司 Layout dispositions method is applied based on kubernetes
CN110333877A (en) * 2019-07-09 2019-10-15 西安点告网络科技有限公司 Visualized container configuring management method, apparatus and system based on application
CN111355606A (en) * 2020-02-10 2020-06-30 天津大学 Web application-oriented container cluster self-adaptive expansion and contraction system and method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170339196A1 (en) * 2016-05-17 2017-11-23 Amazon Technologies, Inc. Versatile autoscaling
KR101807806B1 (en) * 2017-05-02 2017-12-11 나무기술 주식회사 Application containerization method on cloud platform
CN109697153A (en) * 2018-12-28 2019-04-30 浙江省公众信息产业有限公司 Monitoring method, monitoring system and computer readable storage medium
CN110262899A (en) * 2019-06-20 2019-09-20 无锡华云数据技术服务有限公司 Monitor component elastic telescopic method, apparatus and controlled terminal based on Kubernetes cluster
CN110297641A (en) * 2019-06-25 2019-10-01 四川长虹电器股份有限公司 Layout dispositions method is applied based on kubernetes
CN110333877A (en) * 2019-07-09 2019-10-15 西安点告网络科技有限公司 Visualized container configuring management method, apparatus and system based on application
CN111355606A (en) * 2020-02-10 2020-06-30 天津大学 Web application-oriented container cluster self-adaptive expansion and contraction system and method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806097A (en) * 2021-09-29 2021-12-17 杭州网易云音乐科技有限公司 Data processing method and device, electronic equipment and storage medium
CN114327892A (en) * 2021-12-28 2022-04-12 武汉天喻信息产业股份有限公司 FLASH resource management method, storage medium, electronic equipment and device
CN114327892B (en) * 2021-12-28 2024-05-03 武汉天喻信息产业股份有限公司 FLASH resource management method, storage medium, electronic equipment and device
CN114691125A (en) * 2022-04-01 2022-07-01 上海道客网络科技有限公司 Method, system, medium and electronic device for mapping and converting application resources
CN114443311A (en) * 2022-04-07 2022-05-06 北京天维信通科技有限公司 Third-party service configuration method and device and electronic equipment
CN114443311B (en) * 2022-04-07 2022-08-05 北京天维信通科技有限公司 Third-party service configuration method and device and electronic equipment

Also Published As

Publication number Publication date
CN112162817B (en) 2023-09-26

Similar Documents

Publication Publication Date Title
CN112162817A (en) Processing method and device for deploying service resources of container cluster and storage medium
CN111880936B (en) Resource scheduling method, device, container cluster, computer equipment and storage medium
CN103152390B (en) The node configuration method of distributed memory system, device, node and system
CN109968352B (en) Robot control method, robot and device with storage function
CN105183768B (en) A kind of file management method, device and terminal device
CN109344006A (en) A kind of mirror image management method and mirror image management module
CN112463043B (en) Storage cluster capacity expansion method, system and related device
CN105515872A (en) Method, apparatus and system for updating configuration information
CN101552976A (en) Multi-service form file processing system and method
CN113094183B (en) Training task creating method, device, system and medium of AI (Artificial Intelligence) training platform
US20150127798A1 (en) Object version management
CN110674102A (en) Method, system, device and storage medium for distributed file system directory quota
CN111782666B (en) Cache service system
CN116048800A (en) Data processing method and device, storage medium and electronic equipment
CN112214288A (en) Pod scheduling method, device, equipment and medium based on Kubernetes cluster
CN110413427B (en) Subscription data pulling method, device, equipment and storage medium
CN112269758B (en) File migration method based on file classification and related device
CN113258679B (en) Power grid monitoring system channel distribution method based on server instance capacity reduction
CN114780177A (en) Transaction execution method and device, storage medium and electronic device
CN110543357A (en) Method, related device and system for managing application program object
CN104199741A (en) Virtual data management method for cloud computing environment
CN114416371A (en) Grid space management method, storage medium and electronic device
CN114546591A (en) Mirror image file sharing method, container cluster management system and related equipment
CN113093995A (en) Cloud disk data migration method and system
CN112925852B (en) Distributed database designated node capacity reduction 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
TA01 Transfer of patent application right

Effective date of registration: 20230309

Address after: Room 501-502, 5/F, Sina Headquarters Scientific Research Building, Block N-1 and N-2, Zhongguancun Software Park, Dongbei Wangxi Road, Haidian District, Beijing, 100193

Applicant after: Sina Technology (China) Co.,Ltd.

Address before: 100193 7th floor, scientific research building, Sina headquarters, plot n-1, n-2, Zhongguancun Software Park, Dongbei Wangxi Road, Haidian District, Beijing, 100193

Applicant before: Sina.com Technology (China) Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant