CN112162817B - Processing method and device for deployment service resources of container cluster and storage medium - Google Patents

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

Info

Publication number
CN112162817B
CN112162817B CN202010942114.3A CN202010942114A CN112162817B CN 112162817 B CN112162817 B CN 112162817B CN 202010942114 A CN202010942114 A CN 202010942114A CN 112162817 B CN112162817 B CN 112162817B
Authority
CN
China
Prior art keywords
resource
cascade
resources
target
deployment service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010942114.3A
Other languages
Chinese (zh)
Other versions
CN112162817A (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

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 cascade resource group 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 cascade resource 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 Pod corresponding to each cascade resource in the target cascade resource group; and according to the updated copy number, adjusting the capacity of the Pod corresponding to the management of each cascade resource in the target cascade resource group. The application can realize the automatic expansion and contraction 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 deployment 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 apparatus for processing a deployment service resource of a container cluster, and a computer readable storage medium.
Background
K8S is a container-based cluster management platform, which is commonly known as kubernetes. In Kubernetes resources and functions, deployment (depoyment) and stateful set (StatefulSet) are two independent resources. I.e. at cluster level k8S layer, there is no direct correlation between the two. In addition, there is no necessary correlation between the deployments and the deployments, and between StatefulSet and StatefulSet. However, there may be dependencies or cascading relationships between the deployments and deployments, between StatefulSet and StatefulSet for the service level. Thus, the Deployment or StatefulSet with the dependency relationship or cascade relationship in some service calls cannot directly perform the association operation. Such as: the service of the depoyment A depends on the service of the depoyment B, and when the service of the depoyment A expands the Pod of the depoyment A due to the increase of the traffic, the service of the depoyment B cannot sense and directly collapses the traffic of the depoyment B.
Therefore, it is needed to propose a solution to solve the problem that the Pod capacity corresponding to the deployment service resource with the dependency relationship cannot be scaled according to the service requirement due to the lack of the association between the independent resources.
Disclosure of Invention
The embodiment of the application aims to provide a processing method and device for deploying service resources of a container cluster and a computer readable storage medium, which are used for solving the problem that Pod capacity corresponding to the deploying service resources with a dependency relationship cannot be expanded and contracted according to service requirements.
In order to solve the technical problems, the application is realized as follows:
in a first aspect, a method for processing a deployment service resource 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 relations, each cascade resource group comprises a root resource and cascade resources belonging to the root resource, and the types of the deployment service resources comprise independent resources and cascade resource groups; when a changed target deployment service resource exists in the container cluster, cascade resource relation data and cascade resource state data corresponding to at least one cascade resource group with cascade relation are obtained, the cascade resource relation data describe the relation of root resources of the cascade resource group and cascade resources of all levels to which the root resources belong and the capacity expansion and contraction strategy of 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; if the target deployment service resource belongs to a target cascade resource group in the at least one cascade resource group with cascade relation, updating the copy number of each cascade resource 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 Pod managed by each cascade resource in the target cascade resource group; and according to the updated copy number, adjusting the capacity of Pod corresponding to management of each cascade resource in the target cascade resource group.
Optionally, the updating the copy number corresponding to each cascade resource in the target cascade resource group according to the change condition of the target deployment service resource and the capacity expansion and contraction policy of the Pod managed by each cascade resource in the target cascade resource group includes: when the change condition of the target deployment service resource is that the number of copies of the root resource of the target cascade resource group is changed, updating the root resource in the target cascade resource group and the number of copies of cascade resources belonging to each stage of cascade resource according to the capacity expansion and contraction strategy of Pod managed by each stage of cascade resource 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 copy number of the target deployment service resource and the cascade resources belonging to the target deployment service resource according to the capacity expansion and contraction strategy of the Pod managed by the cascade resources of each level in the target cascade resource group.
Optionally, updating the number of copies of the root resource and the cascade resources belonging to each level 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 the cascade resources at all levels in the target cascade resource group; according to the updated copy number of each deployment service resource, correspondingly updating the copy number of the root resource and each cascade resource in the cascade resource state data;
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, including: updating the copy number of the target deployment service resource and the copy number of the deployment service resource corresponding to each cascade resource to which the target deployment service resource belongs; and correspondingly updating the target deployment service resource and the copy number of each cascade resource to which the target deployment service resource belongs in the cascade resource state data according to the updated copy number of each deployment service resource.
Optionally, the cascade resource relation 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, wherein 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 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 relation 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 expansion and contraction 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 status data includes first status data defining a root resource of the cascade resource group and second status data defining a first cascade resource corresponding to a next level of the root resource of the cascade resource group, where the first status data includes a number of copies of the root resource of the cascade resource group and a third field, and the third field points to the second status 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, the fourth field stores a list of the third status data, and the third status data is the same as the second status data.
In a second aspect, there is provided a processing device for deploying service resources of a container cluster, comprising a processor and a processor electrically connected to said memory, said memory storing a computer program executable by said processor, which computer program, when executed by the processor, implements the steps of the method according to the first aspect.
In a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method according to the first aspect.
In the embodiment of the application, the deployment service resources of a container cluster are monitored, when the target deployment service resources which change exist in the container cluster, cascade resource relation data and cascade resource state data corresponding to at least one cascade resource group with cascade relation in the deployment service resources of the container cluster are obtained, the cascade resource relation data describe the relation of root resources of the cascade resource group and cascade resources of all levels to which the root resources belong and capacity expansion and contraction strategies of Pods managed by the cascade resources of all levels, and the cascade resource state data records 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 change target deployment service resources exist, the corresponding number of the copies corresponding to other deployment service resources which have cascade relations with the changed target deployment service resources is updated correspondingly according to the capacity expansion and contraction strategy of the corresponding Pod, so that the corresponding managed Pod capacity can be automatically adjusted.
In this way, by establishing a cascade relationship between the deployments or StatefulSet with a dependency relationship or a cascade relationship in the service call, and correspondingly updating the copy number of other corresponding cascade resources to expand and contract the corresponding Pod capacity when one of the Deployment service resources changes, dynamic cascade linkage between the linked Deployment service resources can be realized, and the security of the service provided by the container cluster Deployment service resources 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 specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a flow chart of a method for processing a deployment service resource of a container cluster according to an embodiment of the present application.
FIG. 2 is a schematic diagram of a hierarchy of cascaded resource sets with a cascading relationship according to an embodiment of the present application.
FIG. 3 is a diagram of a cascaded resource relationship data structure corresponding to a cascaded resource group according to an embodiment of the present application.
Fig. 4 is a diagram of a cascaded resource status data structure corresponding to a cascaded resource group according to an embodiment of the present application.
Fig. 5 is an example flow chart of a method of processing a deployment service resource of a container cluster in accordance with an embodiment of the 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 following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application. The reference numerals 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 controls the description 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 deployment service resource of a container cluster, as shown in fig. 1, including the following steps:
step 102: monitoring deployment service resources of the container cluster. The deployment service resources of the container cluster comprise at least one cascade resource group with cascade relation, each cascade resource group comprises a root resource and cascade resources of all levels to which the root resource belongs, and the types of the deployment service resources comprise independent resources and cascade resource groups. For example, in the Kubernetes container cluster, deployment service resources include Deployment (depoyment) and stateful set (StatefulSet). The monitoring of Deployment service resources is to discover which of the depoyment and StatefulSet resources in the container have changed and what has changed. 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 there is + -changed target deployment service resource in the container cluster, acquiring cascade resource relation data and cascade resource state data corresponding to at least one cascade resource group with cascade relation, wherein the cascade resource relation data describes the relation of root resources and cascade resources of all levels of cascade resource groups, and capacity expansion and contraction strategies of Pod managed by all levels of cascade resource groups, and the cascade resource state data records the copy number of the root resources and cascade resources of all levels of cascade resource groups.
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 cascade resource 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 Pod for each cascade resource management in the target cascade resource group; and
step 108: and according to the updated copy number, adjusting the capacity of the Pod corresponding to the management of each cascade resource in the target cascade resource group.
The cascade resource groups are sets 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 resource at each level have a cascade relation of upper and lower levels. For example, referring to fig. 2, fig. 2 is a schematic diagram of a hierarchical structure of cascaded resource sets having a cascade relationship according to an embodiment of the present application.
As shown in fig. 2, the top hierarchical level 0 in a certain cascade resource group corresponds to a root resource, namely, a deployment a, and each cascade resource corresponding to the next hierarchical level of the deployment a has a deployment B, a deployment C, a stateful set D and a deployment E. Deployment B and deployment C are the level1 directly corresponding to the next level of deployment A of the root resource, stateful set D is the level 2 directly corresponding to the next level of deployment C, and deployment E is the level 3 directly corresponding to the next level of stateful set D. The cascade resources of the corresponding level of each layer in the cascade resource group can be one or a plurality of cascade resources, and the cascade resources are determined according to the relevance among the deployment service resources. Likewise, the number of hierarchical layers of the cascaded resources in the cascaded resource group is at least two or more layers including the root resource, and is determined specifically according to the relevance between the deployed service resources.
In one embodiment, the target Deployment service resource may be a Deployment service resource that is currently modified by the user, and the user may modify the configuration of the depoyment or StatefulSet resource such that the target Deployment service resource changes.
Optionally, the change condition of the target deployment service resource is a change of 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 of a capacity expansion and contraction policy of the Pod of the target deployment service resource management described in the cascade resource relation data.
The cascade resource relationship data describes the relationship between the root resource of the cascade resource group and cascade resources of each level to which the root resource belongs, for example, the cascade relationship between the root resource and cascade resources of each corresponding level shown in fig. 2, and describes the capacity expansion and contraction policy of Pod of each deployment service resource management corresponding to the corresponding cascade resource group. The capacity expansion and contraction policy of the Pod is used for configuring the strategy according to which the Pod corresponding to each deployment service resource is to be expanded or contracted. Optionally, the capacity scaling policy of the Pod includes at least one of a policy type and a copy number range.
Optionally, the policy type includes at least one of a synchronization, a percentage, more than a number of copies and less than a number of copies, the synchronization indicating that a cascading resource of a layer and a copy of a previous layer of the cascading remain synchronized, the percentage indicating that the cascading resource of the layer and a previous layer of the cascading copy remain a certain percentage, the more than a number of copies indicating that the cascading resource of the layer is a certain number more than a previous layer of the cascading copy, and the less than a number of copies indicating that the cascading resource of the layer is a certain number less than a previous layer of the cascading copy. The copy number range includes the maximum copy number and/or the minimum copy number, and the range of the copy number corresponding to a certain cascade resource is limited. That is, the maximum number of copies corresponding to a cascade resource cannot be exceeded, and/or the minimum number of copies cannot be exceeded or reduced.
Thus, by expanding or shrinking the copy number policy and the copy number range corresponding to the cascade resource, the copy corresponding to the cascade resource can be adjusted, and the capacity of the Pod corresponding to the management of the copy can be adjusted.
The cascade resource state data records the number of copies of the root resource and cascade resources of each level to which the root resource belongs, and updates the number of copies of the cascade resource according to the capacity expansion and contraction strategy of the Pod.
In order to solve the problems in the prior art, at least one cascade resource group with cascade relation in the deployment service resources of the container cluster is customized, so that dynamic cascade linkage is achieved by setting the cascade relation and the cascade strategy.
Optionally, the cascade resource relation 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, wherein the first description data includes a first field pointing to the second description data; the second description data includes a capacity scaling policy of the Pod managed by 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.
The above data structure represents a cascading resource group having a layer of root resources and a layer of cascading resources that is the next level of root resources. Alternatively, a cascaded resource that is the next level of root resources may correspond to a cascaded resource having the next level. The number of root resources is one, and the number of cascade resources of each hierarchy may be at least one.
Namely, the cascade resource relation data further comprises third description data defining a second cascade resource corresponding to the next level of the first cascade resource, wherein the third description data further comprises a second field, the second field stores a list of the third description data, and the third description data is identical to the second description data.
Thus, a cascade relation between the root resource and each cascade resource of the cascade resource group is established.
Optionally, the cascade resource status data includes first status data defining a root resource of the cascade resource group and second status data defining a first cascade resource corresponding to a next level of the root resource of the cascade resource group, where the first status data includes a copy number of the root resource of the cascade resource group and a third field, and the third field points to the second status 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, the fourth field stores a list of the third status data, and the third status data is the same as the second status data.
In this way, the state of the cascaded resources of the hierarchy of the entire set of cascaded resources can be concatenated.
In the following, in connection with fig. 3 and 4, a group of cascade resource groups having a cascade relationship is taken as an example, and cascade resource relationship data and cascade resource status data corresponding to the cascade resource groups in the embodiment of the present application are described in an unfolding manner.
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 deployment service resources that have 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 cascaded Pod native scaling capacity specification 11 defines a Deployment or StatefulSet object of the root resource, and the root reference field type of the cascaded Pod native scaling capacity specification is the structure of the slave reference 12. That is, the root reference field points to the structure from reference 12.
The Deployment or StatefulSet object of the first hierarchical resource is defined from the structure body of reference 12, and includes a type field, a name field, an interface version field of an application, and a namespace field of the Deployment or StatefulSet resource, which are used to uniquely identify the Deployment or StatefulSet resource in the Kubernetes container cluster, as shown in FIG. 3.
The policy field in the structure of reference 12 is used to determine the capacity scaling policy of the Pod managed by this Deployment or StatefulSet, and the policy field corresponds to the structure of policy 13.
The policy type in the structure of policy 13 defines the scaling capacity specific policy type of the Pod for the Deployment or StatefulSet resource management. Specific policy types include, for example: synchronization, percentage, more than the number of copies, less than the number of copies.
The structure body of the range field corresponding to the number of copies in the structure body of the policy 13 corresponds to the range 14, and is used for defining the upper limit and the lower limit of the capacity expansion and contraction policy of the Pod, namely, the maximum copy number and the minimum copy number, and is used for restricting the number of pods managed by the first cascade resource correspondingly.
From the structure of reference 12, from the reference field, is a list 15, the structure stored in list 15 is: the structure composed of the structure corresponding to the reference 16, the structure corresponding to the policy 17, and the structure corresponding to the scope 18 is the same as the structure composed of the structure corresponding to the reference 12, the structure corresponding to the policy 13, and the structure corresponding to the scope 14. That is, the next level cascade of Deployment or StateFulSet resources will be able to concatenate the entire cascade hierarchy of the cascade resource group through the slave reference fields in the structure of the slave reference 12.
As shown in fig. 4, the cascade resource status data may also be obtained by creating a plurality of data structures to record the status of each deployment service resource with an associated or dependent relationship, including a structure corresponding to the cascade Pod auto-expansion status 21 of the root resource, a structure corresponding to the case 22 of the first cascade resource, and a structure corresponding to the case 24 of the second cascade resource.
The structure of the concatenated Pod auto-scaling state 21 includes three fields for defining the scaling time of the last Pod, for defining the current copy number of the root resource's Deployment or StatefulSet resource, and for defining the root condition of the concatenated resource state of the root resource's Deployment or StatefulSet resource, respectively.
The root case field points to the structure corresponding to case 22, and the structure of case 22 is used to define a specific state, including a current copy number segment of the Deployment or StatefulSet resource representing the first cascaded resource, a type field of the resource, a name field, an interface version field of the application, and a namespace field, and is used to uniquely determine the depoyment or StatefulSet resource.
The case field in the structure of case 12 is a list 23, and the structure stored in the list 23 is a structure composed of the corresponding structures of case 24, and the structure of case 24 and the structure of case 22 are identical. That is, the next hierarchical state of the Deployment or StateFulSet resource will be concatenated out of the state of the entire hierarchy of the cascade resource group by the case field in the structure of case 22.
In step 106, updating the copy number corresponding to each cascade resource in the target cascade resource group according to the change condition of the target deployment service resource and the capacity expansion and contraction policy of the Pod corresponding to each cascade resource in the target cascade resource group, including:
when the change condition of the target deployment service resource is that the number of copies of the root resource of the target cascade resource group is changed, updating the root resource in the target cascade resource group and the number of copies of cascade resources belonging to each stage of cascade resource according to the capacity expansion and contraction strategy of Pod managed by each stage of cascade resource 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 copy number of the target deployment service resource and the cascade resources belonging to the target deployment service resource according to the capacity expansion and contraction strategy of the Pod managed by the cascade resources of each level in the target cascade resource group.
When the change condition of the target deployment service resource is that the number of copies of the root resource of the target cascade resource group is changed, according to the capacity expansion and contraction strategy of Pod managed by cascade resources at all levels in the target cascade resource group, updating the number of copies of the root resource and cascade resources at all levels belonging to the root resource in the target cascade resource group, and taking fig. 2 as an example for illustration as follows: if the number of the actual updated copies of the deployment A of the root resource of the level 0 is 10, the number of the updated copies of the deployment B of the cascade resource of the level1 of the next level is 10 according to the strategy type 'synchronization'; deployment C updates the number of copies in the state data to (10-3) =7, based on the policy type "less than the number of copies" and less than the number of copies to 3. The level 2 resource, i.e., the number of copies of the stateful set D, is updated according to the deployment C of level1 of the level above it. In the case where the deployment C updates the copy number to 7, the copy of the stateful set D may be updated to the copy number of (7+1) =8 according to the policy type "more than copy number" and more than copy number to 3. Similarly, according to the state set D of the level 2, the number of updated copies is 8, and the number of copies of the updated deployment E is 6 in combination with the policy type "synchronization" and the scope "maximum copy number is 6" and "minimum copy number is 2" corresponding to the deployment E of the level 3.
When the change condition of the target deployment service resource is the change of the capacity expansion and contraction policy of the Pod managed by the target deployment service resource described in the cascade resource relation data, updating the copy number of the target deployment service resource and the cascade resources belonging to each stage according to the capacity expansion and contraction policy of the Pod managed by the cascade resource of each stage in the target cascade resource group, and taking fig. 2 as an example for illustration as follows: if the cascade resource of the level1 is changed in the deployment C, for example, the policy type is updated from "less than the number of copies to 3" shown in fig. 2 to "synchronous", the number of copies is updated to 10 according to 10 actual copies of the deployment a of the previous level. Correspondingly, in the case that the state set D of the level 2 of the next level is not changed, the copy number needs to be updated to (10+1) =11 according to the policy type. According to the cascade relation, the number of copies of deployment E of the level 3 is still kept to be 6 according to 11 copies of the stateful set D of the level 2 and the policy type and copy number range corresponding to the deployment E.
Optionally, updating the number of copies of the root resource and the cascade resources belonging to each level 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 the cascade resources at all levels in the target cascade resource group; and correspondingly updating the root resource and the copy number of each cascade resource according to the updated copy number of each deployment service resource.
That is, the updating includes two steps, the first step is to execute the corresponding increase and decrease of the copy number according to the change of the root resource copy number of the monitored target deployment service resource; then, the number of non-cached copies of the target deployment service resource is requested again to determine the number of copies actually completed by the copy increasing operation. For example, monitoring that the number of copies of the target deployment service resource changed by the user is 11, updating the number of copies of the root resource according to the change, obtaining the number of non-cached copies of the target deployment service resource, determining that the update operation is to actually modify the number of copies of the root resource to be 10, and updating the number of copies in the cascade resource state data corresponding to the target deployment service resource to be 10 according to the actually updated number of copies of 10.
Optionally, updating the copy number of the target deployment service resource and the cascade resources belonging to the target deployment service resource includes: updating the copy number of the target deployment service resource and the copy number of the deployment service resource corresponding to each cascade resource to which the target deployment service resource belongs; and correspondingly updating the target deployment service resource and the copy number of each cascade resource to which the target deployment service resource belongs 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 an exemplary flowchart of a method of processing a deployment service resource of a container cluster in accordance with 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 changes of the Deployment and the statefull resources;
step 004: once there is a change, the manager triggers the coordinator to process.
Step 005: after the coordinator is triggered, acquiring all cascade resource groups with cascade relations defined by a user;
step 006: if no error exists in the acquisition process, starting to circularly process all the acquired cascade resource groups;
step 007: if the error exists, performing error processing;
step 008: if the cascade resource has no error, directly returning to the coordinator, and waiting to be triggered again;
step 009: if the error is the failure of the read object, returning, and simultaneously returning error information, and waiting for the coordinator to be triggered again.
Step 010: in the process of circularly acquiring the cascade resource group in step 006, judging whether the received monitored target resource (reployment or StatefulSet) is in the cascade resource group;
step 011: if not, directly returning to enter the next cycle;
step 012: if the monitored resource (Deployment or StateFulSet) is in the cascaded resource group, obtaining the copy number of Level 0 (i.e. root resource) of the cascaded resource group;
step 013: then, obtaining Level1 of the cascade resource group (namely, cascade resource of the next Level of root resource);
step 014: if Level1 is not obtained, the method indicates that the resources of Level1 do not exist, and then the method directly returns to step 006 to enter the next cycle and circulate other cascade resource groups.
Step 015: if the Level1 resource of the cascade resource exists, starting to update the state of the Level 0 of the cascade resource group, namely updating the parameters corresponding to the root current copy digital segment in the corresponding cascade resource state data according to the copy number of the Level 0 acquired in the step 012;
step 016: then, acquiring 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 data structure defined before;
step 017: then starting to circulate the resources of the next Level1 of the cascade resource group;
step 018: acquiring the expected number of the cascaded resource of Level1, namely the number of the required updated copies,
steps 019 to 022: and acquiring a cascade strategy corresponding to the cascade resource of Level1 through a strategy field in cascade resource relation data correspondingly defined by the cascade resource group, and calculating the number of the copies according to the selected cascade strategy.
Step 023: if the copy ranges, i.e., the maximum and minimum copy ranges, are set, then copy number range control is entered, and maximum copy number and/or minimum copy number limitations are made.
Step 024: updating the copy number of the Deployment or StateFulSe resource corresponding to the hierarchy;
step 025: obtaining non-cached copies of the Deployment or StateFulSe resources corresponding to the hierarchy to determine the number of copies actually updated after the update operation is executed in the step 024;
step 026: according to the non-cached copy of the resource obtained in step 025, updating the state of the cascade resource of the hierarchy, that is, updating the parameters corresponding to the current copy digital segment in the cascade resource state data corresponding to the cascade resource;
step 027: acquiring a cascade of a next Level of the cascade resource, for example, a cascade resource of Level 2, and if the cascade resource does not exist, continuing to cycle resources of the next Level corresponding to other cascade resources of Level 1;
step 028: if so, acquiring the next Level 2 of the cascade resource to perform relevant cyclic processing again until the cyclic is finished.
Steps 027 and 028 are described above for the case where a hierarchy in the same set of cascaded resources has multiple cascaded resources, each of which may or may not have a next hierarchy of cascaded resources. Through the above-mentioned loop steps, the copy numbers of all the cascade resources in the cascade resource group and the state parameters of the cascade resource state data can be updated.
In the embodiment of the application, a deployment service resource of a container cluster is monitored, the deployment service resource of the container cluster comprises at least one cascade resource group with cascade relation, each cascade resource group comprises a root resource and cascade resources of all levels to which the root resource belongs, the type of the deployment service resource comprises an independent resource and the cascade resource group, when a changed target deployment service resource exists in the container cluster, cascade resource relation data and cascade resource state data corresponding to the cascade resource group with cascade relation are acquired, the cascade resource relation data describe the relation of the root resource of the cascade resource group and cascade resources of all levels to which the root resource belongs, and the capacity expansion and contraction strategy of Pod managed by the cascade resource group 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.
Therefore, by monitoring the change of the deployment service resources of the container cluster, when the changed target deployment service resources exist, the corresponding number of copies of other deployment service resources which have cascade relations with the changed target deployment service resources is correspondingly updated according to the capacity expansion and contraction strategy of the corresponding Pod, so that the corresponding managed Pod capacity can be automatically adjusted.
In this way, by establishing a cascade relationship between the deployments or StatefulSet with a dependency relationship or a cascade relationship in the service call, and correspondingly updating the copy number of other corresponding cascade resources to expand and contract the corresponding Pod capacity when one of the Deployment service resources changes, dynamic cascade linkage between the linked Deployment service resources can be realized, and the security of the service provided by the container cluster Deployment service resources is improved.
Optionally, the embodiment of the present application further provides a device for processing the deployment service resource of the container cluster, and fig. 6 is a schematic structural diagram of the device for processing the deployment service resource of the container cluster in 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 the computer program implements the processes of any one of the foregoing embodiments of the method for deploying service resources of a container cluster when executed by the processor 2400, and can achieve the same technical effects, so that repetition is avoided and no further description is given herein.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements each process of the above-mentioned method embodiment for deploying service resources of any container cluster, and can achieve the same technical effect, so that repetition is avoided, and no further description is given here. Wherein the computer readable storage medium is selected from Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are to be protected by the present application.

Claims (10)

1. A method for processing a deployment service resource of a container cluster, comprising:
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 relations, each cascade resource group comprises a root resource and cascade resources belonging to the root resource, and the types of the deployment service resources comprise independent resources and cascade resource groups;
when a changed target deployment service resource exists in the container cluster, cascade resource relation data and cascade resource state data corresponding to at least one cascade resource group with cascade relation are obtained, the cascade resource relation data describe the relation of root resources of the cascade resource group and cascade resources of all levels to which the root resources belong and the capacity expansion and contraction strategy of 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;
if the target deployment service resource belongs to a target cascade resource group in the at least one cascade resource group with cascade relation, updating the copy number of each cascade resource 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 Pod managed by each cascade resource in the target cascade resource group; and
and according to the updated copy number, adjusting the capacity of the Pod corresponding to the management of each cascade resource in the target cascade resource group.
2. The method of claim 1, wherein updating the number of copies corresponding to each level of cascaded resources in the target cascaded resource group according to the change condition of the target deployment service resource and the capacity scaling policy of the Pod for each level of cascaded resource management in the target cascaded resource group comprises:
when the change condition of the target deployment service resource is that the number of copies of the root resource of the target cascade resource group is changed, updating the root resource in the target cascade resource group and the number of copies of cascade resources belonging to each stage of cascade resource according to the capacity expansion and contraction strategy of Pod managed by each stage of cascade resource 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 copy number of the target deployment service resource and the cascade resources belonging to the target deployment service resource according to the capacity expansion and contraction strategy of the Pod managed by the cascade resources of each level in the target cascade resource group.
3. The method of claim 2, wherein,
updating the copy number of the root resource and the cascade resources of each level of the root resource in the target cascade resource group, comprising:
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 the cascade resources at all levels in the target cascade resource group; according to the updated copy number of each deployment service resource, correspondingly updating the copy number of the root resource and each cascade resource in the cascade resource state data;
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, including:
updating the copy number of the target deployment service resource and the copy number of the deployment service resource corresponding to each cascade resource to which the target deployment service resource belongs; and correspondingly updating the target deployment service resource and the copy number of each cascade resource to which the target deployment service resource belongs 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 cascaded resource relationship data comprises first description data defining a root resource of the cascaded resource group and second description data defining a first cascaded resource corresponding to a next level of the root resource of the cascaded resource group, wherein,
the first description data includes a first field pointing to the second description data;
the second description data includes a capacity scaling policy of the Pod managed by 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.
5. The method of claim 4, wherein the cascaded resource relationship data further comprises third description data defining a second cascaded resource corresponding to a next level of the first cascaded resource, wherein,
the third description data further includes a second field storing a list of the third description data, the third description data being identical to the second description data.
6. The method of any one of claim 1 to 5, wherein the capacity scaling policy comprises at least one of a policy type and a copy number range, 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 cascaded resource status data comprises first status data defining a root resource of the cascaded resource group and second status data defining a first cascaded resource corresponding to a next level of the root resource of the cascaded resource group, wherein,
the first state data includes 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 cascaded resource status data further comprises third status data defining a second cascaded resource corresponding to a next level of the first cascaded resource, wherein,
the third state data further includes a fourth field storing a list of the third state data, the third state data being identical to the second state data.
9. A processing apparatus for deploying service resources of a container cluster, comprising: a memory and a processor electrically connected to the memory, the memory storing a computer program executable by the processor, the computer program implementing the steps of the method of deploying service resources of a container cluster according to any one of claims 1 to 8 when executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which when being executed by a processor implements the steps of the method for processing a deployment service resource of a container cluster according to any 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 CN112162817A (en) 2021-01-01
CN112162817B true 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)

Families Citing this family (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
CN114327892B (en) * 2021-12-28 2024-05-03 武汉天喻信息产业股份有限公司 FLASH resource management method, storage medium, electronic equipment and device
CN114691125B (en) * 2022-04-01 2023-05-23 上海道客网络科技有限公司 Method, system, medium and electronic equipment for applying resource mapping conversion
CN114443311B (en) * 2022-04-07 2022-08-05 北京天维信通科技有限公司 Third-party service configuration method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10135837B2 (en) * 2016-05-17 2018-11-20 Amazon Technologies, Inc. Versatile autoscaling for containers

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN112162817A (en) 2021-01-01

Similar Documents

Publication Publication Date Title
CN112162817B (en) Processing method and device for deployment service resources of container cluster and storage medium
CN111176697B (en) Service instance deployment method, data processing method and cluster federation
CN112506659A (en) Management method of edge device and related device
US10148486B2 (en) Object version management
CN113127138B (en) Virtualized network function deployment method, device and system
CN111866169A (en) Service updating method, device and system
CN111078322A (en) Server and K8S cluster-based public configuration parameter configuration method and system
CN112181049A (en) Cluster time synchronization method, device, system, equipment and readable storage medium
CN108536447B (en) Operation and maintenance management method
CN113093995B (en) Cloud disk data migration method and system
CN114546591A (en) Mirror image file sharing method, container cluster management system and related equipment
CN114130035A (en) User matching method, device, equipment and storage medium
CN102957547B (en) The installation method and device of telecom network management system
CN111756562B (en) Cluster takeover method, system and related components
CN112925852B (en) Distributed database designated node capacity reduction method
KR102662284B1 (en) Expandable network management system for tactical communication network and method for operating thereof
CN115250269B (en) File distribution method and device, storage medium and electronic equipment
CN113364871B (en) Node election method and device based on intelligent contract and electronic equipment
CN112269758B (en) File migration method based on file classification and related device
CN115469814A (en) Data storage method and device
CN117008878A (en) Rule generation method, device, equipment and storage medium
CN113615146A (en) Data consistency based reselection of network function instances
CN112165519A (en) Synchronous node implementation method and system for synchronizing data as required
CN114268540A (en) Optimization method, device and equipment of rule engine
CN114327909A (en) Data processing method, data processing device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
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