Application deployment method, cluster system, device and storage medium
By transforming the application packages in the Kubernetes cluster and using custom resources and controllers, application deployment automation and management in a multi-cluster environment are realized, resource shortages and deployment problems are solved, and deployment efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411104518.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-08-13
AI Technical Summary
In a Kubernetes cluster, when there are multiple business clusters, it is difficult to deploy and manage specific applications. Especially when resources are insufficient, how to efficiently deploy applications and perform cluster-level operations is a challenge.
By modifying the application package, adding description information of application capabilities, creating custom capability objects and instance objects based on the capability resource information and instance resource information on the control cluster, and using capability controllers and instance controllers to automatically complete application capabilities and instances Deployment to achieve cluster-level application deployment and management.
It realizes the automation of the application deployment process, improves deployment efficiency, ensures the accuracy and refinement of deployment, and manages applications through custom objects, solving the problems of application deployment and management under multi-cluster deployment.
Smart Images

Figure CN118626212B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an application deployment method, a cluster system, a device, and a storage medium. Background Art
[0002] An operations and maintenance platform can be built on a Kubernetes (an open-source container management platform, Kubernetes) cluster. A Kubernetes cluster can include a control cluster and a business cluster, with the operations and maintenance platform running in the control cluster. The operations and maintenance platform can also manage specific applications, such as MySQL and Redis, that provide external services. These specific applications can run in the business cluster. Specific applications are typically deployed using corresponding application packages, which contain the resources required by the specific application.
[0003] Kubernetes clusters may face resource constraints when deploying specific applications that require a large number of resources. In this case, you can expand the business cluster by adding clusters, thereby forming multiple business clusters. When there are multiple business clusters, how to deploy and manage specific applications is a challenge worth addressing. Summary of the Invention
[0004] The purpose of this application is to address the deficiencies in the above-mentioned prior art and provide an application deployment method, cluster system, device and storage medium to solve the problem in the prior art that it is difficult to deploy and manage specific applications when there are multiple business clusters.
[0005] To achieve the above objectives, the technical solutions adopted in this application are as follows:
[0006] In a first aspect, the present application provides an application deployment method, the method comprising:
[0007] Deploy capability resource information and instance resource information corresponding to the target application in the control cluster of the Kubernetes cluster system, wherein the capability resource information includes: custom capability resources and capability controllers, and the instance resource information includes: custom instance resources and instance controllers;
[0008] Creating a custom capability object based on the custom capability resource, wherein attribute information of the custom capability object is used to indicate deployment information of the target application, the deployment information including: an application package of the target application, an identifier of a target deployment cluster of the target application, and configuration parameters of the target application;
[0009] Performing a first-stage deployment of the target application according to the custom capability object and the capability controller;
[0010] Creating a custom instance object according to the custom instance resource, wherein the attribute information of the custom instance object is used to indicate the deployment information of the target application;
[0011] The second phase deployment of the target application is performed according to the custom instance object and the instance controller.
[0012] As an optional implementation, creating a custom capability object according to the custom capability resource includes:
[0013] In response to a first creation instruction from an administrator, obtaining the deployment information of the target application;
[0014] The custom capability object is created according to the structure information of the custom capability resource and the deployment information.
[0015] As an optional implementation, performing the first phase deployment of the target application according to the custom capability object and the capability controller includes:
[0016] The capability controller is run, and when the capability controller detects the custom capability object, the capability controller performs a first-stage deployment of the target application according to the attribute information of the custom capability object.
[0017] As an optional implementation, performing the first phase deployment of the target application according to the attribute information of the custom capability object includes:
[0018] Deploying first-layer resources of the target application in the control cluster according to the application package of the target application;
[0019] The second layer resources of the target application are deployed in the target deployment cluster according to the identifier of the target deployment cluster, the application package, and the configuration parameters of the target application.
[0020] As an optional implementation, deploying the second-layer resources of the target application in the target deployment cluster according to the identifier, application package version, and configuration parameters of the target deployment cluster of the target application includes:
[0021] A first deployment instruction is executed according to the identifier of the target deployment cluster of the target application, the application package, and the configuration parameters, so as to deploy the second-layer resources of the target application in the target deployment cluster through the first deployment instruction.
[0022] As an optional implementation, creating a custom instance object according to the custom instance resource includes:
[0023] Rendering and displaying a visualization interface of the target application on a display interface of the control cluster according to the first layer resources;
[0024] In response to a second creation instruction input by a user through the visual interface, obtaining the deployment information of the target application;
[0025] The custom instance object is created according to the structure information of the custom instance resource and the deployment information.
[0026] As an optional implementation, performing the second-stage deployment of the target application according to the custom instance object and the instance controller includes:
[0027] The instance controller is run, and when the instance controller detects the custom instance object, the instance controller performs a second-stage deployment of the target application according to the attribute information of the custom instance object.
[0028] As an optional implementation, performing the second-stage deployment of the target application according to the attribute information of the custom instance object includes:
[0029] A second deployment instruction is executed according to the identifier of the target deployment cluster, the application package, and the configuration parameters of the target application, so as to deploy the third layer resources of the target application in the target deployment cluster through the second deployment instruction.
[0030] In a second aspect, the present application provides a Kubernetes cluster system, wherein the Kubernetes cluster includes a control cluster and multiple business clusters, and an operation and maintenance platform is deployed in the control cluster, and the operation and maintenance platform is used to execute the steps of the application deployment method described in any one of the first aspects.
[0031] In a third aspect, an embodiment of the present application further provides an electronic device comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the application deployment method as described in any one of the first aspects.
[0032] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the application deployment method as described in any one of the first aspects are executed.
[0033] The beneficial effects of this application are: by modifying the application package of the target application, adding description information of the application capability, and creating a custom capability object based on the capability resource information and instance resource information deployed on the control cluster, the capability controller detects the custom capability object and automatically completes the deployment of the application capability, and the instance controller detects the custom instance object and automatically completes the deployment of the application instance, the automation of the application deployment process can be achieved, and the efficiency of application deployment can be improved. And because the description of the application capability is added in this application and the deployment of the application capability is completed in the first phase of deployment, the cluster can be determined by the application capability to operate the application, and the attribute information of the custom capability object and the custom instance object can make the application deployment accurate to the cluster level, and refine the level and configuration of the application deployment. The custom capability object and the custom instance object correspond to the target application, and after the deployment is completed, the application can also be managed through the custom capability object and the custom instance object.
[0034] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 A schematic diagram of the architecture of a Kubernetes cluster system provided in an embodiment of the present application is shown;
[0037] Figure 2 A flowchart of an application deployment method provided by an embodiment of the present application is shown;
[0038] Figure 3 A flowchart of creating a custom capability object provided by an embodiment of the present application is shown;
[0039] Figure 4 A flowchart of a first-stage deployment provided by an embodiment of the present application is shown;
[0040] Figure 5 A flowchart of creating a custom instance object provided by an embodiment of the present application is shown;
[0041] Figure 6 A schematic diagram of the structure of an application deployment device provided in an embodiment of the present application is shown;
[0042] Figure 7 A schematic structural diagram of an electronic device 70 provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application.
[0044] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0045] Kubernetes clusters may face resource constraints when deploying specific applications that require a large number of resources. In this case, you can expand the business cluster by adding clusters, thereby forming multiple business clusters. When there are multiple business clusters, how to deploy and manage specific applications is a challenge worth addressing.
[0046] Specifically, when an application is deployed in multiple clusters, it is difficult to implement cluster-level application deployment and management. Cluster-level operations can include: deploying a fixed specific application in a specified cluster, removing the deployment permission of a cluster to install a specific application, controlling the multi-version control of a specific application on a cluster, and controlling the resources that a specific application can occupy in a cluster.
[0047] Based on this, this application proposes an application deployment method, which realizes cluster-level application deployment and application management by transforming the application package and based on the application capabilities deployed in Kubernetes and the resources and controllers of the application instances, thereby solving the problem of difficulty in realizing cluster-level application deployment and management when the application adopts multi-cluster deployment.
[0048] The method of the present application can be applied to Figure 1 In the Kubernetes cluster system shown, refer to Figure 1A Kubernetes cluster system consists of a control cluster and multiple business clusters. The control cluster hosts the operations and maintenance platform, allowing users to manage the entire Kubernetes cluster system. The control cluster can be the cluster that runs the resources required by the operations and maintenance platform, while the business cluster is where business resources are deployed. The control cluster can also serve as a business cluster to deploy business resources.
[0049] First, the application package used in this application is described. The application package in this application may be a modified application package that has been enhanced with descriptions of application capabilities. This modification may be implemented, for example, using Helm. Application capabilities can be used to describe the operational permissions a cluster has on an application instance, such as the cluster's ability to create application instances or to allocate resources to them. Cluster A can only create an application instance of the current application if the application package indicates that cluster A has the ability to create the current application instance.
[0050] An application package can include three layers, each describing different resources within the package. The first layer describes template resources, which describe the application package and the interface after the current version of the application's front-end page is rendered. The second layer describes capability resources, representing the resources required to install the application's capabilities into the corresponding cluster. The third layer describes instance resources, representing the resources required to install the application instance into the corresponding cluster.
[0051] Figure 2 This is a flow chart of an application deployment method given in an embodiment of the present application. Figure 2 , the application deployment method of this application is described, which can be applied to Figure 1 In the Kubernetes cluster system shown, refer to Figure 2 , the method comprising:
[0052] S201. Deploy capability resource information and instance resource information corresponding to a target application in a control cluster of a Kubernetes cluster system. The capability resource information includes: custom capability resources and capability controllers. The instance resource information includes: custom instance resources and instance controllers.
[0053] Reference Figure 1 A Kubernetes cluster system includes multiple Kubernetes clusters. The control cluster can be the cluster in the Kubernetes cluster system where the operation and maintenance platform is deployed. Users can deploy and manage the control cluster and business cluster applications in the Kubernetes cluster system by entering commands on the operation and maintenance platform.
[0054] Before deploying an application, you can prepare the target application package, capability resource information, and instance resource information in the control cluster. The target application package can be the three-tier application package based on the helm package mentioned above.
[0055] The capability resource information includes custom capability resources and capability controllers, and the instance resource information includes custom instance resources and instance controllers. Each target application to be deployed corresponds to a capability resource information and an instance resource information.
[0056] Capability resource information and instance resource information can be defined based on Custom Resource Definition (CRD) in Kubernetes. CRD definitions include custom resource definitions and controllers. Custom resource definitions can include custom capability resources and custom instance resources, and controllers can include capability controllers and instance controllers.
[0057] Custom capability resources and custom instance resources can be a kind of resource template customized in the Kubernetes cluster system, which describes the structure, attributes and business logic of custom resources. Business logic can be the operations and behaviors performed on custom resources. Among them, the attributes of custom capability resources and custom instance resources can include multiple fields, each field is used to describe the application capabilities of the application package and the deployment information of the application instance. Custom capability resources can be custom resources for deploying the application capabilities of the target application, and the attribute fields are used to describe the deployment information of the application capabilities. Custom instance resources can be custom resources for deploying the application instance of the target application, and the attribute fields include the cluster to be deployed of the application instance, the corresponding path of the application instance in the application package, and the configuration parameters when the application is deployed.
[0058] It should be noted that when deploying the same target application, the deployment clusters for custom capability resources and custom instance resources, as well as the configuration parameters for application deployment, can be the same. However, the paths corresponding to application capabilities and application instances in the application package are different. Specifically, the paths corresponding to application capabilities in the application package can point to the second-tier structure of the application package, while the paths corresponding to application instances in the application package can point to the third-tier structure of the application package.
[0059] Capability controllers and instance controllers are custom controllers running in a Kubernetes cluster, responsible for handling the lifecycle and business logic of their corresponding custom resources. Specifically, capability controllers handle the lifecycle and behavior of custom capability resources, while instance controllers handle the lifecycle and behavior of custom instance resources.
[0060] As a possible implementation, CRDs for capability resource information and instance resource information can be predefined based on Kubernetes. For example, a YAML file can be defined to describe the structure and properties of custom resources. The YAML file specifies the API version, resource name, scope (namespace or cluster level), and resource field definitions. After the CRD definition is completed, the capability resource information and instance resource information are obtained. Then, using Kubernetes command-line tools or APIs, the capability resource information CRD and instance resource information CRD can be registered with the Kubernetes control cluster, creating a new Restful API endpoint and deploying the capability resource information and instance resource information corresponding to the target application on the control cluster.
[0061] S202: Create a custom capability object based on the custom capability resource. The attribute information of the custom capability object is used to indicate the deployment information of the target application. The deployment information includes: the application package of the target application, the identifier of the target deployment cluster of the target application, and the configuration parameters of the target application.
[0062] A custom capability object is an instantiation of a custom capability resource in the control cluster. After defining the custom capability resource's CRD, the control cluster creates a custom capability object (CR1) based on the values corresponding to the fields in the user-entered attribute information. It then operates on the custom capability object to deploy the application package's capabilities on the target deployment cluster.
[0063] Among them, the deployment information of the custom capability object includes the identifier of the target deployment cluster of the application capability, the application package corresponding to the application capability, and the configuration parameters during application deployment, etc. Furthermore, the deployment information of the custom capability object can also further indicate the path of the resource of the application capability in the application package.
[0064] The attribute information of the custom capability object includes attribute fields and attribute values, and the attribute fields and attribute information together indicate the deployment information of the target application. The attribute information of the custom capability object may include the following fields: cluster, artifact, and configurations. Among them, the value of the cluster field may be the identifier of the target deployment cluster, which is used to indicate the target deployment cluster of the application. The value of the artifact field may be the repository where the application package is located, the application package version, and the resource index file of the application package, which is used to describe the application package used for application deployment and indicate the resource path of the application capability in the application package. The value of the configurations field may be the configuration parameters when the application is deployed.
[0065] Optionally, the configuration parameters of the target application may be parameter settings for target application deployment, such as the total resources that the target application can occupy in the cluster, the workload of the target application, and the like.
[0066] S203: Perform the first phase deployment of the target application based on the customized capability object and the capability controller.
[0067] The capability controller can monitor various events of the custom capability object CR1 in the Kubernetes API server, including the creation, update, and deletion of CR1, and then perform corresponding operations according to the pre-defined business logic to achieve CR1 lifecycle management and business logic automation.
[0068] As a possible implementation, after monitoring the creation of the custom capability object, the capability controller may perform the first phase deployment of the target application on the target deployment cluster based on the application package pre-prepared on the control cluster.
[0069] Optionally, the first stage deployment may be to deploy resources of the application capability of the target application on the target deployment cluster.
[0070] S204: Create a custom instance object according to the custom instance resource. The attribute information of the custom instance object is used to indicate the deployment information of the target application.
[0071] A custom instance object can be an instantiation of a custom instance resource in the control cluster. The control cluster can create a custom instance object CR2 based on the values corresponding to the fields of the attribute information entered by the user, and deploy the resources corresponding to the application instance of the application package on the target deployment cluster by operating on the custom instance object.
[0072] Among them, the deployment information of the custom instance object includes the identifier of the target deployment cluster of the application instance, the application package corresponding to the application instance, and the configuration parameters during application deployment, etc. Furthermore, the deployment information of the custom instance object can further indicate the resource path of the application instance in the application package.
[0073] The attribute information of a custom instance object includes attribute fields and attribute values. The attribute fields and attribute information together indicate the deployment information of the target application. The attribute information of a custom instance object may include the following fields: cluster, artifact, and configurations. Among them, the value of the cluster field may be the identifier of the target deployment cluster of the application, the value of the artifact field may be the repository where the application package is located, the application package version, and the resource index file of the application package, which is used to describe the application package used for application deployment. The resource index file of the application package is used to indicate the resource path of the application instance in the application package, and the value of the configurations field may be the configuration parameters when the application is deployed, etc.
[0074] S205: Perform the second phase deployment of the target application based on the customized instance object and the instance controller.
[0075] The instance controller can monitor various events of the custom instance object CR2 in the Kubernetes API server, including the creation, update, and deletion of CR2, and then perform corresponding operations according to the pre-defined business logic to achieve CR2 lifecycle management and business logic automation.
[0076] As a possible implementation, after monitoring the creation of the custom instance object, the instance controller may perform a second-stage deployment of the target application on the target deployment cluster based on the application package pre-prepared on the control cluster.
[0077] Optionally, the second stage of deployment may be to deploy resources of the application instance of the target application on the target deployment cluster.
[0078] It should be noted that after application deployment is complete, cluster-level operations can be performed on the application by operating on the custom capability object. For example, if a user wants to remove cluster A's deployment permissions for installing the target application, they can delete cluster A's corresponding custom capability object for the target application. If a user wants to control the resources occupied by the target application in cluster A, they can also do so by changing the configuration parameters in cluster A's custom capability object corresponding to the target application. After changing the configuration parameters, the custom capability object can pass the modified configuration parameters to the target application deployed on cluster A to control the total resources that the target application can occupy on cluster A.
[0079] In an embodiment of the present application, capability resource information and instance resource information corresponding to the target application are deployed in the control cluster of the Kubernetes cluster system. The capability resource information includes: custom capability resources and capability controllers. The instance resource information includes: custom instance resources and instance controllers. Based on the custom capability resources, a custom capability object is created. The attribute information of the custom capability object is used to indicate the deployment information of the target application. The deployment information includes: the application package of the target application, the identifier of the target deployment cluster of the target application, and the configuration parameters of the target application. Based on the custom capability object and the capability controller, the first phase of deployment of the target application is performed. Based on the custom instance resources, a custom instance object is created. The attribute information of the custom instance object is used to indicate the deployment information of the target application. Based on the custom instance object and the instance controller, the second phase of deployment of the target application is performed.
[0080] By modifying the application package of the target application, adding descriptive information of the application capability, and creating a custom capability object based on the capability resource information and instance resource information deployed on the control cluster, the custom capability object is detected by the capability controller and the deployment of the application capability is automatically completed, and the custom instance object is detected by the instance controller and the deployment of the application instance is automatically completed, the efficiency of application deployment can be improved. And because the description of the application capability is added in this application and the deployment of the application capability is completed in the first phase of deployment, the cluster can be determined by the application capability to operate the application. Even if there are multiple business clusters, the application deployment can be accurately deployed to the cluster level through the attribute information of the custom capability object and the custom instance object, which refines the level and configuration of the application deployment. The custom capability object and the custom instance object correspond to the target application. After the deployment is completed, the application can also be managed through the custom capability object and the custom instance object.
[0081] Next, we will explain the steps of creating a custom capability object based on the custom capability resource. Figure 3 As shown, the above step S202 includes:
[0082] S301: Respond to the administrator's first creation instruction and obtain deployment information of the target application.
[0083] The operation and maintenance platform is deployed on the control cluster. Administrators can use it to create custom capability objects. Specifically, administrators can call custom capability resources in the control cluster and enter the values of the attribute fields of the custom capability resources as the deployment information of the target application.
[0084] As a possible implementation method, the value of the attribute field includes the identifier of the target deployment cluster of the target application, the application package information of the target application, and the configuration parameters of the target application. Among them, the application package information of the target application includes the version of the application package, the warehouse to which the application package belongs, and the index file of the application package. The warehouse to which the application package belongs can store multiple application packages of the same type but different versions. After determining the warehouse to which the application package belongs, the application package that needs to be deployed for the target application can be determined based on the version of the application package. The index file of the application package can indicate the resources stored in each layer of the application package. The structure of the application package can be the aforementioned three-layer structure. Based on the index file, the resources of the application capabilities in the second-layer structure of the application package can be obtained.
[0085] S302: Create a custom capability object according to the structure information and deployment information of the custom capability resource.
[0086] After obtaining the deployment information, it can be used as the value of each field in the custom capability resource and a custom capability object can be generated on the control cluster. The capability controller detects and controls the custom capability object, and the resources in the second layer structure of the application package, namely the application capability, can be deployed on the target deployment cluster.
[0087] As an example, a custom capability object is created based on deployment information and custom capability resources. If the cluster field of the custom capability object points to cluster A, it means that the target deployment cluster is cluster A, the configuration parameters are in the configurations field, and the value of the artifact field of the custom object includes MySQL2.3.0, indicating that the target application to be deployed is MySQL, and the application package is version 2.3.0 of the application package. The custom capability object can deploy the capability resources in the second-layer structure of this version of the application package in cluster A.
[0088] Next, the steps of performing the first phase deployment of the target application based on the custom capability object and the capability controller are described. The step S203 includes:
[0089] The capability controller is run. When the capability controller detects the custom capability object, it performs the first phase deployment of the target application according to the attribute information of the custom capability object.
[0090] It is worth noting that the capability controller and custom capability resources belong to the capability resource information of the target application. When the administrator creates a custom capability object by calling a custom resource, the control cluster also starts running the capability controller corresponding to the custom capability resource, that is, the capability controller of the target application. The capability controller of the target application is used to handle the life cycle and behavior of the custom capability resources of the target application.
[0091] The capability controller can continuously detect the custom capability objects of the target application in the control cluster. When it detects that the custom capability object is created successfully, it can perform the first phase deployment of the target application based on the attribute information of the custom capability object and deploy the application capabilities of the target application on the target deployment cluster.
[0092] Application packages can be implemented based on helm packages. The structure of an application package consists of three layers: the first layer stores the description information and template resources of the application package, the second layer stores the capability resources of the application package, and the third layer stores the instance resources of the application package. As an example, the structure of an application package can be represented by the following code:
[0093] helm / #First layer structure
[0094] Chart.yaml
[0095] README.md
[0096] values.yaml
[0097] charts /
[0098] operator / #Second layer structure
[0099] templates /
[0100] Chart.yaml
[0101] charts /
[0102] cr / #The third layer structure
[0103] templates /
[0104] Chart.yaml
[0105] templates /
[0106] Among them, Chart.yaml represents the pre-configured installation package resources, operator is used to describe the controller corresponding to the application package, including capability controller and instance controller, and cr is used to describe the custom objects corresponding to the application package, including custom capability objects and custom instance objects.
[0107] The following describes the first phase of target application deployment based on the attribute information of the custom capability object, combined with the above-mentioned application package structure example. Figure 4 As shown, the process includes:
[0108] S401 : Deploy the first layer resources of the target application in the control cluster according to the application package of the target application.
[0109] The first-tier resources can include application description information and a rendering template for the application's front-end page. Application description information includes the application name and version. In this step, the first-tier resources for the target application deployed in the control cluster can be the rendering template for the application's front-end page. After the control cluster renders the rendering template for the target application, it can generate a visual interactive interface for the target application.
[0110] S402: Deploy the second-layer resources of the target application in the target deployment cluster according to the identifier of the target deployment cluster, the application package, and the configuration parameters of the target application.
[0111] Optionally, the second-layer resources can be the resources of the application capabilities of the target application. The second-layer structure in the application package of the target application is used to store the resources required to install the application capabilities into the target deployment cluster, including the total resource limit that can be created under the target deployment cluster, custom capability resources, and capability controllers, etc.
[0112] The target deployment cluster can be determined based on the identifier of the target deployment cluster, and the second-tier resources of the target application's application package to be deployed can be determined based on the target application's application package. The control cluster can use instructions to deploy the target application's application capability resources on the target deployment cluster and pass configuration parameters to the second-tier resources deployed in the target deployment cluster. As can be seen from the preceding description, the second-tier resources include capability controllers. In this case, the capability controllers in the target deployment cluster can deploy application capabilities based on the configuration parameters.
[0113] Furthermore, the step of deploying the second-layer resources of the target application in the target deployment cluster according to the identifier of the target deployment cluster, the application package version, and the configuration parameters of the target application includes:
[0114] The first deployment instruction is executed according to the identifier of the target deployment cluster, the application package, and the configuration parameters of the target application, so as to deploy the second-layer resources of the target application in the target deployment cluster through the first deployment instruction.
[0115] Optionally, the first deployment instruction may be an instruction for controlling the cluster to deploy the application capability resources of the target application on the target deployment cluster. After detecting the custom capability object, the capability controller may automatically generate the first deployment instruction, take the name of the second-tier resource as a parameter, and execute the first deployment instruction to deploy the second-tier resource on the target deployment cluster.
[0116] For example, if the application package is a Helm package, the first deployment instruction can be the Helm insta11 command. After detecting the successful creation of the custom capability object, the capability controller can automatically execute the Helm insta11 command to deploy the second-tier resources of the application package on the target deployment cluster and distribute the configuration parameters to the second-tier resources. This allows the target deployment cluster to deploy the second-tier resources based on the configuration parameters, thus completing the deployment of the application capability.
[0117] Furthermore, the second-tier resources include a capability controller. When deploying the second-tier resources on the target deployment cluster, the application package's configuration parameters can also be sent to the capability controller, enabling the capability controller to perform control actions based on the configuration parameters. For example, the total resources available to the target application in the target deployment cluster can be controlled based on the application package configuration parameters. Furthermore, by sending the application package's configuration parameters to the capability controller, users can be prevented from skipping the interactive page and experiencing a black screen when subsequently deploying the application.
[0118] It should be noted that the administrator can create custom capability objects on the operation and maintenance platform in advance, and deploy the first-tier resources of the target application in the control cluster, and deploy the second-tier resources of the target application in the target deployment cluster. After completing the deployment of the first-tier resources and the second-tier resources, ordinary users can log in to the operation and maintenance platform and deploy the application instance resources of the target application on the target deployment cluster through the operation and maintenance platform. After completing the deployment of the application instance resources, the target deployment cluster can schedule the application instance resources and run the application, thereby completing the deployment of the application on the target deployment cluster.
[0119] The following is a further explanation of creating a custom instance object based on the custom instance resource. Figure 5 As shown, the above step S204 includes:
[0120] S501 : Render and display a visual interface of a target application on a display interface of a control cluster according to first-layer resources.
[0121] When an ordinary user logs in to the operation and maintenance platform to prepare to deploy the target application, the capability controller in the control cluster can detect the custom capability object. If there is only one custom capability object, the control cluster can directly determine the application package of the target application based on the custom capability object, and render the first layer of resources in the application package to obtain and display the visual interface of the target application on the display interface of the control cluster.
[0122] When there are multiple custom capability objects, the control cluster can display the target application and the version of the target application corresponding to the custom capability object on the display interface, and based on the user's selection of the custom capability object on the display interface, render the visual interface of the custom capability object selected by the user on the display interface.
[0123] S502 : Responding to a second creation instruction input by the user through the visual interface, obtaining deployment information of the target application.
[0124] Users can configure parameters for the target application through a rendered visual interface. The parameters configured in the visual interface can be values corresponding to attribute fields of custom instance resources. Specifically, after receiving the user-entered values, the control cluster uses them as deployment information for the target application instance.
[0125] It's worth noting that the attribute fields of custom instance resources can be the same as those of custom capability resources, so we won't go into detail here. The difference between the two lies in the values corresponding to the application package's index file. The application package index file in a custom instance resource points to the application package's third-level structure, while the application package index file in a custom capability resource points to the application package's second-level structure.
[0126] S503: Create a custom instance object according to the structure information and deployment information of the custom instance resource.
[0127] After obtaining the deployment information, it can be used as the value of each field in the custom instance resource and a custom instance object can be generated on the control cluster. The instance controller detects and controls the custom instance object, and the resources in the third layer of the application package, namely the application instance, can be deployed on the target deployment cluster.
[0128] As an example, a custom instance object is created based on deployment information and custom instance resources. If the cluster field of the custom instance object points to cluster A, it means that the target deployment cluster is cluster A, the configuration parameters are in the configurations field, and the value of the artifact field of the custom object includes MySQL2.3.0, indicating that the target application to be deployed is MySQL, and the application package is version 2.3.0. The custom instance object can deploy the instance resources in the third-layer structure of this version of the application package in cluster A.
[0129] After the user creates a custom instance object, the instance controller automatically performs the second phase of deployment of the target application based on the custom instance object. This process includes:
[0130] The instance controller is run. When the instance controller detects the custom instance object, it performs the second phase deployment of the target application according to the attribute information of the custom instance object.
[0131] The instance controller and custom instance resources both belong to the instance resource information of the target application. When the user enters parameters in the visual interface and successfully creates a custom instance object, the control cluster also starts running the instance controller corresponding to the custom instance resource, that is, the instance controller of the target application. The instance controller of the target application is used to handle the lifecycle and behavior of the custom instance resources of the target application.
[0132] The instance controller can continuously detect the custom instance objects of the target application in the control cluster. When it is detected that the custom instance object is created successfully, the second phase of the target application deployment can be performed according to the attribute information of the custom instance object, and the application instance of the target application is deployed on the target deployment cluster.
[0133] The following is a further explanation of the second phase of deploying the target application based on the attribute information of the custom instance object, including:
[0134] The second deployment instruction is executed according to the identifier of the target deployment cluster of the target application, the application package, and the configuration parameters, so as to deploy the third layer resources of the target application in the target deployment cluster through the second deployment instruction.
[0135] The third-layer resources may be resources included in the third-layer structure of the application package of the target application, including workloads corresponding to the application instance, storage volumes required by the application instance, and other resources required by the application instance.
[0136] The second deployment instruction may be an instruction for controlling the cluster to deploy the application instance resources of the target application on the target deployment cluster. After detecting the custom instance object, the instance controller may automatically generate the second deployment instruction, take the name of the third-layer resource as a parameter, and execute the second deployment instruction to deploy the third-layer resource on the target deployment cluster.
[0137] For example, if the application package is a helm package, the second deployment instruction can be the helm insta11 command. After detecting that the custom instance object has been successfully created, the instance controller can automatically execute the helm insta11 command to create the application instance object on the target deployment cluster and send the configuration parameters to the application instance object.
[0138] Next, an example is used to illustrate how to implement cluster-level application operations based on the method of this application.
[0139] In the first example, a fixed application is installed on a specific cluster. For example, if there are clusters A and B, and you want to control cluster A to only install MySQL and cluster B to only install Oracle, you only need to create a custom capability object for MySQL (with the Cluster field pointing to cluster A) and a custom capability object for Oracle (with the Cluster field pointing to cluster B). Then, you can use the above deployment process to deploy the applications.
[0140] In the second example, you remove the deployment permission for a cluster to install an application. For example, if cluster A exists and you want to stop installing MySQL, you only need to delete the custom capability object corresponding to cluster A.
[0141] The third example implements multi-version control for an application on a cluster. For example, if there are clusters A and B, and you want to install MySQL versions 5.6 and 8.0 on cluster A and 5.6 on cluster B, you can prepare two versions of the application package. The first version of the application package renders the page with options 5.6 and 8.0, and sets the corresponding parameters in the configurations field. The package is then sent to the capability controller. The second version of the application package renders the page with only option 5.6, and sets the corresponding parameters in the configurations field.
[0142] In the fourth example, you can control the resources that an application can occupy within a cluster. You fill in the configurations field of a custom capability object with the corresponding parameters. After deploying the second-tier resources on the target deployment cluster, you can send the configurations field to the capability controller corresponding to the second-tier resources to control the total resources that the application can occupy within the cluster.
[0143] Based on the same inventive concept, the embodiment of the present application also provides an application deployment device corresponding to the application deployment method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned application deployment method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated. Figure 1 The Kubernetes cluster system shown is on the operation and maintenance platform for controlling the cluster.
[0144] Figure 6 A schematic diagram of the structure of an application deployment device provided in an embodiment of the present application is shown. Figure 6 The application deployment device includes: a resource deployment module 601, a first creation module 602, a first deployment module 603, a second creation module 604 and a second deployment module 605.
[0145] Resource deployment module 601 is used to deploy capability resource information and instance resource information corresponding to the target application in the control cluster of the Kubernetes cluster system. The capability resource information includes: custom capability resources and capability controllers; the instance resource information includes: custom instance resources and instance controllers;
[0146] A first creation module 602 is configured to create a custom capability object based on the custom capability resource. The attribute information of the custom capability object is used to indicate the deployment information of the target application. The deployment information includes: an application package of the target application, an identifier of a target deployment cluster of the target application, and configuration parameters of the target application.
[0147] A first deployment module 603 is used to perform a first-stage deployment of a target application based on the custom capability object and the capability controller;
[0148] The second creation module 604 is used to create a custom instance object according to the custom instance resource, wherein the attribute information of the custom instance object is used to indicate the deployment information of the target application;
[0149] The second deployment module 605 is used to perform the second phase deployment of the target application according to the customized instance object and the instance controller.
[0150] As an optional implementation, the first creation module 602 is specifically configured to:
[0151] Responding to the administrator's first creation instruction, obtaining deployment information of the target application;
[0152] Create a custom capability object based on the structure information and deployment information of the custom capability resource.
[0153] As an optional implementation, the first deployment module 603 is specifically configured to:
[0154] The capability controller is run. When the capability controller detects the custom capability object, it performs the first phase deployment of the target application according to the attribute information of the custom capability object.
[0155] As an optional implementation, the first deployment module 603 is specifically configured to:
[0156] Deploy the first-tier resources of the target application in the control cluster based on the application package of the target application;
[0157] Deploy the second-tier resources of the target application in the target deployment cluster according to the identifier, application package, and configuration parameters of the target application.
[0158] As an optional implementation, the first deployment module 603 is specifically configured to:
[0159] The first deployment instruction is executed according to the identifier of the target deployment cluster, the application package, and the configuration parameters of the target application, so as to deploy the second-layer resources of the target application in the target deployment cluster through the first deployment instruction.
[0160] As an optional implementation, the first creation module 604 is specifically configured to:
[0161] Based on the first-tier resources, the visualization interface of the target application is rendered and displayed on the display interface of the control cluster;
[0162] In response to a second creation instruction input by the user through the visual interface, obtaining deployment information of the target application;
[0163] Create a custom instance object based on the structure information and deployment information of the custom instance resource.
[0164] As an optional implementation, the second deployment module 605 is specifically configured to:
[0165] The instance controller is run. When the instance controller detects the custom instance object, it performs the second phase deployment of the target application according to the attribute information of the custom instance object.
[0166] As an optional implementation, the second deployment module 605 is specifically configured to:
[0167] The second deployment instruction is executed according to the identifier of the target deployment cluster of the target application, the application package, and the configuration parameters, so as to deploy the third layer resources of the target application in the target deployment cluster through the second deployment instruction.
[0168] The embodiment of the present application modifies the application package of the target application, adds description information of the application capability, and creates a custom capability object based on the capability resource information and instance resource information deployed on the control cluster. The capability controller detects the custom capability object and automatically completes the deployment of the application capability, and the instance controller detects the custom instance object and automatically completes the deployment of the application instance, thereby automating the application deployment process and improving the efficiency of application deployment. In addition, since the description of the application capability is added in the present application and the deployment of the application capability is completed in the first phase of deployment, the cluster can be determined by the application capability to operate the application, and the attribute information of the custom capability object and the custom instance object can make the application deployment accurate to the cluster level, and refine the level and configuration of the application deployment. The custom capability object and the custom instance object correspond to the target application, and after the deployment is completed, the application can also be managed through the custom capability object and the custom instance object.
[0169] Figure 7 The structure diagram of an electronic device 70 provided in an embodiment of the present application is shown, including: a processor 701, a storage medium 702 and a bus 703. The storage medium 702 stores machine-readable instructions executable by the processor 701. When the electronic device runs the application deployment method in the embodiment, the processor 701 communicates with the storage medium 702 via the bus 703, and the processor 701 executes the machine-readable instructions and the preamble of the method item of the processor 701 to execute the steps in the above-mentioned application deployment method. Among them, the electronic device can be a computer device or server deployed with an operation and maintenance platform in the control cluster of the Kubernetes cluster system.
[0170] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program is executed when a processor is running, and the processor executes the steps in the above-mentioned application deployment method.
[0171] In the embodiment of the present application, the computer program can also execute other machine-readable instructions when run by the processor to execute other methods described in the embodiment. For the specific execution method steps and principles, please refer to the description of the embodiment and will not be repeated here.
[0172] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0173] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0174] In addition, each functional unit in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0175] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
[0176] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.
[0177] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The scope of protection of the present application is not limited thereto. Although the present application has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present application, or make equivalent replacements for some of the technical features thereof. However, these modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should all be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An application deployment method, It is characterized in that The method comprises: Deploy the capability resource information and instance resource information corresponding to the target application in the control cluster of the Kubernetes cluster system, wherein the capability resource information includes: a custom capability resource and a capability controller, and the instance resource information includes: a custom instance resource and an instance controller. The custom capability resource is used to deploy the application capability of the target application, and the application capability is the operation authority of the cluster on the target application; Creating a custom capability object according to the custom capability resource, wherein the attribute information of the custom capability object is used to indicate the deployment information of the target application, the deployment information including: an application package of the target application, an identifier of a target deployment cluster of the target application, and configuration parameters of the target application; Performing a first-stage deployment of the target application according to the custom capability object and the capability controller; Creating a custom instance object according to the custom instance resource, wherein the attribute information of the custom instance object is used to indicate the deployment information of the target application; The second phase deployment of the target application is performed according to the custom instance object and the instance controller.
2. The method according to claim 1, It is characterized in that The step of creating a custom capability object according to the custom capability resource includes: In response to a first creation instruction of an administrator, acquiring the deployment information of the target application; The custom capability object is created according to the structure information of the custom capability resource and the deployment information.
3. The method according to claim 1, It is characterized in that The performing the first phase deployment of the target application according to the custom capability object and the capability controller includes: The capability controller is run, and when the capability controller detects the custom capability object, the capability controller performs the first phase deployment of the target application according to the attribute information of the custom capability object.
4. The method according to claim 3, It is characterized in that The performing the first phase deployment of the target application according to the attribute information of the custom capability object includes: Deploying first-layer resources of the target application in the control cluster according to the application package of the target application; The second layer resources of the target application are deployed in the target deployment cluster according to the identifier of the target deployment cluster, the application package, and the configuration parameters of the target application.
5. The method according to claim 4, It is characterized in that The deploying the second layer resources of the target application in the target deployment cluster according to the identifier of the target deployment cluster, the application package version, and the configuration parameters of the target application includes: A first deployment instruction is executed according to the identifier of the target deployment cluster of the target application, the application package, and the configuration parameters, so as to deploy the second layer resources of the target application in the target deployment cluster through the first deployment instruction.
6. The method according to claim 4, It is characterized in that The step of creating a custom instance object according to the custom instance resource includes: Rendering and displaying a visualization interface of the target application on a display interface of the control cluster according to the first layer of resources; In response to a second creation instruction input by a user through the visual interface, acquiring the deployment information of the target application; The custom instance object is created according to the structure information of the custom instance resource and the deployment information.
7. The method according to claim 1, It is characterized in that The performing the second phase deployment of the target application according to the custom instance object and the instance controller includes: The instance controller is run, and when the instance controller detects the custom instance object, the instance controller performs the second phase deployment of the target application according to the attribute information of the custom instance object.
8. The method according to claim 7, It is characterized in that The performing the second phase deployment of the target application according to the attribute information of the custom instance object includes: A second deployment instruction is executed according to the identifier of the target deployment cluster of the target application, the application package, and the configuration parameters, so as to deploy the third layer resources of the target application in the target deployment cluster through the second deployment instruction.
9. A Kubernetes cluster system, It is characterized in that The Kubernetes cluster includes a control cluster and multiple business clusters. An operation and maintenance platform is deployed in the control cluster, and the operation and maintenance platform is used to execute the steps of the application deployment method described in any one of claims 1-8.
10. An electronic device, It is characterized in that include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the application deployment method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the application deployment method according to any one of claims 1 to 8 are executed.
