Application instance construction method, apparatus and device

By unifying the orchestration and scheduling of virtual machines and containers in a distributed system, and utilizing custom resource objects and affinity configurations, the problem of high scheduling complexity of containers and virtual machines is solved, achieving efficient application service response and communication stability.

CN114675940BActive Publication Date: 2026-07-14INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2022-04-28
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

In distributed systems, the management and scheduling of containers and virtual machines are highly complex and cannot be uniformly orchestrated, leading to increased system complexity.

Method used

By defining runtime definition blocks for virtual machines and containers using custom resource objects, a mapping relationship between target virtual machines and container instances is generated, and orchestration and scheduling management are performed under the same template. Affinity configuration information is set to achieve load balancing and high availability.

Benefits of technology

It reduces the complexity of system scheduling and management, improves the response rate and communication efficiency of application services, and achieves high availability and load balancing for virtual machines and containers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114675940B_ABST
    Figure CN114675940B_ABST
Patent Text Reader

Abstract

The application instance construction method, device and equipment provided in the application can be used in the field of cloud computing technology or other fields, and the method comprises the following steps: obtaining first instance information comprising a virtual machine running definition block and a container running definition block defined according to the same mechanism; creating a target virtual machine instance according to the virtual machine running definition block in the first instance information; creating a target container instance according to the container running definition block in the first instance information; generating a mapping relationship between the target virtual machine instance and the target container instance; and constructing an application instance comprising the target virtual machine instance and the target container instance according to the mapping relationship. Since the self-defined resource object is used, the container instance and the virtual machine instance are uniformly scheduled under the same template, and the affinity management of the container instance and the virtual machine instance on the working node is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to cloud computing technology, and more particularly to a method, apparatus, and device for constructing application instances. Background Technology

[0002] With the development and promotion of container technology, most stateless services have begun to be deployed in containers. Although the use of virtual machines has been relatively reduced, the role of virtual machines is still irreplaceable in many business scenarios. Therefore, virtual machines will continue to exist for a long time in the future.

[0003] Currently, when it is necessary to use both containers and virtual machines to run application instances in a distributed system, a dedicated virtual machine scheduling system (such as the "OpenStack" virtual machine scheduling system) is used to create and schedule virtual machine instances, and a dedicated container scheduling system (such as the "Kubernetes" container scheduling system) is used to create and schedule container instances.

[0004] With the development of distributed systems, they are becoming increasingly complex, and the management and scheduling of various components within them are also becoming more and more complicated.

[0005] Therefore, how to reduce the management and scheduling complexity of distributed systems has become an urgent problem to be solved. Summary of the Invention

[0006] This application provides an application instance construction method, apparatus, and device to solve the technical problem that containers and virtual machines cannot be uniformly orchestrated and scheduled in the prior art.

[0007] In a first aspect, this application provides an application instance construction method, comprising: obtaining first instance information, the first instance information including a virtual machine runtime definition block and a container runtime definition block, the contents of the virtual machine runtime definition block and the container runtime definition block being defined according to the same mechanism; creating a target virtual machine instance based on the virtual machine runtime definition block in the first instance information; creating a target container instance based on the container runtime definition block in the first instance information; generating a mapping relationship between the target virtual machine instance and the target container instance; and constructing an application instance containing the target virtual machine instance and the target container instance based on the mapping relationship.

[0008] The application instance construction method provided in this application enables orchestration and scheduling management of virtual machines and containers under the same template by defining a custom resource object containing virtual machine definition templates and container definition templates. This effectively reduces operation and maintenance costs, lowers the complexity of scheduling and managing containers and virtual machines in the system, and allows for affinity configuration of containers and virtual machines under the same template, enabling a corresponding mapping relationship between virtual machines and containers. By improving communication efficiency, this effectively improves the response rate of application services.

[0009] In one possible implementation, the first instance information further includes a first replica number, which indicates a first number of virtual machine instances to be generated; creating a target virtual machine instance based on the virtual machine runtime definition block in the first instance information includes: creating a first number of target virtual machine instances based on the virtual machine runtime definition block in the first instance information.

[0010] The application instance construction method provided in this application generates virtual machine instances with the same number of replicas as a predefined number. When one virtual machine instance is used, it can call other idle virtual machine instances to provide services, thereby achieving application load balancing and improving the response efficiency of application services.

[0011] In one possible implementation, the virtual machine runtime definition block includes first affinity configuration information for indicating multiple worker nodes; correspondingly, at least two of the first number of target virtual machine instances are deployed on different worker nodes among the multiple worker nodes.

[0012] The application instance construction method provided in this application manages the affinity of multiple generated virtual machine instances by setting affinity configuration information. Without this affinity configuration, multiple virtual machine instances might be deployed on the same worker node. If this worker node fails, all virtual machine instances running on that node will be unable to provide services. Therefore, by distributing the generated virtual machine instances across different worker nodes using the first affinity configuration information, high availability of the application is achieved.

[0013] In one possible implementation, the first instance information further includes a second number of replicas, which indicates a second number of container instances to be generated; creating a target container instance based on the container runtime definition block in the first instance information includes: creating a second number of target container instances based on the container runtime definition block in the first instance information.

[0014] The application instance construction method provided in this application generates container instances with the same number of replicas as a predefined number. When one container instance is used, it can call other idle container instances to provide services, thereby achieving application load balancing and improving the response efficiency of application services.

[0015] In one possible implementation, the container runtime definition block includes second affinity configuration information for indicating multiple worker nodes; correspondingly, at least two of the second number of target container instances are deployed on different worker nodes among the multiple worker nodes.

[0016] The application instance construction method provided in this application manages the affinity of multiple generated container instances by setting affinity configuration information. Without this affinity configuration, multiple container instances might be deployed on the same worker node. If this worker node fails, all container instances running on that node will be unable to provide services. Therefore, by distributing the produced container instances across different worker nodes using the first affinity configuration information, high availability of the application is achieved.

[0017] In one possible implementation, the first instance information also includes third affinity configuration information, which is used to indicate the working node where the target virtual machine instance or the target container instance is located; accordingly, the target virtual machine instance and the target container instance are deployed on the same working node according to the third affinity configuration information.

[0018] The application instance construction method provided in this application enables the deployment of virtual machine instances and container instances on the same node by setting affinity configuration information. When virtual machine instances and container instances are deployed on the same worker node, they can use the communication channel of the worker node itself for high-speed communication, effectively avoiding disconnection problems caused by network communication failures or delays, improving communication stability and speed, and further enhancing the instantaneous response speed of application services.

[0019] Secondly, this application provides an application instance construction apparatus, comprising: an acquisition module for acquiring first instance information, the first instance information including a virtual machine runtime definition block and a container runtime definition block, the contents of the virtual machine runtime definition block and the container runtime definition block being defined according to the same mechanism; a virtual machine creation module for creating a target virtual machine instance based on the virtual machine runtime definition block in the first instance information; a container creation module for creating a target container instance based on the container runtime definition block in the first instance information; and a construction module for generating a mapping relationship between the target virtual machine instance and the target container instance; and constructing an application instance containing the target virtual machine instance and the target container instance based on the mapping relationship.

[0020] Thirdly, this application provides an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the application instance construction method of the first aspect.

[0021] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the application instance construction method of the first aspect.

[0022] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the application instance construction method of the first aspect.

[0023] This application provides an application instance construction method, apparatus, and device, which involves: obtaining first instance information including a virtual machine runtime definition block and a container runtime definition block defined according to the same mechanism; creating a target virtual machine instance based on the virtual machine runtime definition block in the first instance information; creating a target container instance based on the container runtime definition block in the first instance information; generating a mapping relationship between the target virtual machine instance and the target container instance; and constructing an application instance containing the target virtual machine instance and the target container instance based on the mapping relationship. By utilizing custom resource objects, not only are container instances and virtual machine instances uniformly scheduled under the same template, but affinity management of container instances and virtual machine instances on worker nodes is also achieved. Attached Figure Description

[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0025] Figure 1 A schematic diagram illustrating a scenario for an application instance construction method provided in an embodiment of this application;

[0026] Figure 2 A flowchart illustrating an application instance construction method provided in an embodiment of this application;

[0027] Figure 3 A schematic diagram of the architecture for constructing a virtual machine instance provided in an embodiment of this application;

[0028] Figure 4 A schematic diagram illustrating the principle of an application example provided in an embodiment of this application;

[0029] Figure 5 This is a schematic diagram of the structure of an application example construction device provided in an embodiment of this application;

[0030] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0031] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0032] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0033] Before describing the various embodiments shown in this application, the concepts involved in this application will be introduced first.

[0034] 1) "Kubernetes"

[0035] Kubernetes, or K8s for short, is an open-source application used to manage containerized applications across multiple hosts in a cloud platform. The goal of Kubernetes is to make deploying containerized applications simple and efficient. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.

[0036] 2) Custom Resource Definition (CRD)

[0037] CRD is a resource in Kubernetes that allows users to define new resource types. CRDs allow users to extend cluster capabilities based on existing Kubernetes resources, such as Deployments and Configmaps, or to define a complete set of specifications.

[0038] 3) Application Programming Interface Service

[0039] The Application Programming Interface Service (API Server) is the core of the Kubernetes cluster. It is responsible for communication between various functional modules in the cluster. Each functional module in the cluster stores information in etcd through the API Server. When it is necessary to retrieve and manipulate this data, it is done through the REST interface provided by the API Server using the GET, LIST, and WATCH methods, thereby realizing information exchange between modules.

[0040] Figure 1 This is a schematic diagram illustrating an application scenario of an embodiment of this application. For example... Figure 1The scenario shown in the diagram is an application instance whose architecture includes a cluster 110, a management node 120, worker nodes 130, storage nodes 140, an application programming service interface (API Server) 150, a container 160, a command-line tool 170, a web user interface 180, and a virtual machine 190.

[0041] The management node 120 includes an application programming service interface 150, which serves as the communication hub for the cluster 110. Through the application programming service interface 150, the cluster 110 can receive first instance information defined by the "CRD" mechanism based on "Kubernetes" from the command-line tool 170 or the web user interface 180, and store this information in the storage node 140. When the worker node 130 obtains this information, it creates a virtual machine instance 190 and a container instance 160 based on the virtual machine runtime definition block and container runtime definition block in the information, respectively. The two instances communicate with each other or call each other to jointly implement application services.

[0042] Optionally, cluster 110 creates multiple container instances 160 and virtual machine instances 190 based on the first instance information. The multiple container instances 160 can be distributed and deployed on different worker nodes 130 through anti-affinity configuration, and the multiple virtual machine instances 190 can be distributed and deployed on different worker nodes 130 through anti-affinity configuration.

[0043] Optionally, the virtual machine instance 190 and container instance 160 described above can be deployed on the same worker node through affinity configuration.

[0044] Alternatively, the command-line tool can be "kubectl," the command-line interface (CLI) for Kubernetes, an essential management tool for Kubernetes users and administrators. "kubectl" provides a large number of subcommands to facilitate the management of various functions within a Kubernetes cluster. For example, "kubectl -h" displays a list of subcommands, "kubectl options" displays global options, and so on. <command> "--help" displays help for subcommands; "kubectl [command][PARAMS] –o = <format>"" sets the output format (such as "json", "yaml", "jsonpath", etc.), and "kubectl explain[RESOURCE]" displays the definition of the resource.

[0045] Alternatively, the web-based user interface can be at least one of "Kubernetes dashboard", "Rancher", or "Kuboard". Users can manage the cluster intuitively and conveniently through the web-based user interface described above.

[0046] Alternatively, the storage node can be a distributed consistent key-value storage system (etcd), which is primarily used in "Kubernetes" to store data that needs to be persisted.

[0047] It should be noted that the application instance construction method, apparatus, and device disclosed in this application can be used in the field of cloud computing technology. It can also be used in any field other than cloud computing technology. The application fields of the application instance construction method, apparatus, and device disclosed in this application are not limited.

[0048] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0049] Figure 2 This is a flowchart illustrating an application instance construction method according to an embodiment of this application. Figure 2 As shown, the method of an embodiment of this application may include S210 to S250.

[0050] This method can be used for Figure 1 The application instance is constructed in the application scenario shown. This embodiment of the application can be constructed by... Figure 1 The work node shown will be executed.

[0051] S210, Obtain first instance information, which includes virtual machine runtime definition block and container runtime definition block. The contents of the virtual machine runtime definition block and container runtime definition block are defined according to the same mechanism.

[0052] As an example, a virtual machine runtime definition block may include one or more of the following: memory, CPU resource requirements, mounted device descriptions, and mounted volume descriptions; where mounted device descriptions include hard drives, network interfaces, etc., and mounted volume descriptions include virtual machine image volumes, data volumes, etc. A container runtime definition block includes memory, CPU resource requirements, mounted device descriptions, and mounted volume descriptions.

[0053] Optionally, the virtual machine runtime definition block and the container runtime definition block can be customized according to the requirements of the "CRD" mechanism of "K8s".

[0054] Optionally, the first instance information can be configured using the "Kubernetes webhook" specification.

[0055] Optionally, the first instance information may include at least one of the following: number of replicas, namespace, and version.

[0056] In one possible implementation, worker nodes obtain a custom "UniCRD" object based on the "CRD" mechanism of "Kubernetes". This "UniCRD" object includes a virtual machine runtime definition block and a container runtime definition block. Worker nodes deploy a "UniCRD" controller based on the "UniCRD" object. This controller is used to generate a first definition template for defining virtual machine instances and a second definition template for defining container instances. The virtual machine runtime definition block may not define a "pod" affinity definition, and the container runtime definition block may not require a "pod" affinity definition.

[0057] As an example, such as Figure 3 As shown, cluster 300 may include management node 310, worker nodes 320, and command-line tool 311. Among them, management node 310 may include application service interface 340, storage node 350, and virtual machine controller 360; worker node 320 may include "pod" component 330, virtual machine initiator 380, and virtual machine 390, and "pod" component 330 may include virtual machine operator 370.

[0058] Application service interface 340 receives the first instance information containing the virtual machine runtime definition block with the custom name "UniCRD" from command line tool 311, and stores it in storage node 350. After the virtual machine controller 360 listens to the first instance information of storage node 350, it obtains the first instance information.

[0059] S220, Create the target virtual machine instance based on the virtual machine runtime definition block in the first instance information.

[0060] As an example, creating a target virtual machine instance based on the virtual machine runtime definition block in the first instance information may include: generating a first definition template for defining the virtual machine instance based on the virtual machine runtime definition block in the first instance information, and creating a template virtual machine instance based on the first definition template.

[0061] As an example, the first definition template is a custom template defined according to Kubernetes' CRD mechanism, used to generate virtual machine instances. Subsequently, the deployment controller in Kubernetes generates corresponding "pod" instances that can perform lifecycle management of virtual machines based on this custom template.

[0062] For example, the first definition template can be a template containing the "KubeVirt" definition configuration, or it can be a template containing the "Virtlet" definition configuration. "KubeVirt" and "Virtlet" are projects used to implement "Kubernetes" for managing virtual machines.

[0063] Optionally, the first instance information includes the number of replicas, which is equal to the number of first definition templates generated based on the virtual machine runtime definition block.

[0064] In one possible implementation, the "UniCRD" controller of "Kubernetes" generates a first definition template containing the "KubeVirt" definition configuration based on the contents of the virtual machine runtime definition block.

[0065] As an example, such as Figure 3 As shown, after the virtual machine controller 360 detects the first instance information of the storage node 350, it generates a first definition template based on the information of the virtual machine runtime definition block in the "UniCRD". The worker node 320 creates a virtual machine initiator 380 based on the first definition template generated by the virtual machine controller 360. When the virtual machine controller 360 detects that the virtual machine initiator 380 has been created, it updates the status information of the "UniCRD" in the storage node 350. The virtual machine operator 370 detects the change in the status information and transmits a virtual machine instance creation signal to the virtual machine initiator 380. The virtual machine initiator 380 creates the virtual machine instance and manages the lifecycle of the virtual machine instance.

[0066] As an example, the target virtual machine instance created based on the first definition template can run the "mySQL" database.

[0067] Optionally, the first instance information may also include the number of copies of the first definition template to be generated. Accordingly, the worker node generates multiple first definition templates, the number of which is equal to the number of copies indicated in the first instance information; based on these multiple first definition templates, multiple target virtual machine instances are created.

[0068] The above method generates virtual machine instances with the same number of replicas as the predefined number. When one virtual machine instance is in use, it can call other idle virtual machine instances to provide services, thereby achieving application load balancing and improving the response efficiency of application services.

[0069] Optionally, the first definition template may include affinity management configuration, which adds a tag to the target virtual machine instance during the creation process. "Kubernetes" matches the worker nodes with the corresponding tags based on the added tags, enabling the distributed deployment of multiple target virtual machine instances on different worker nodes. The worker nodes can be deployed on physical machines or host machines.

[0070] For example, using a pre-generated, automatically randomized label in Kubernetes called "RandomA", where "RandomA" randomly generates multiple different label values, such as 1, 2, 3, 4, etc., this label value can be attached to multiple different worker nodes. Simultaneously, multiple target virtual machine instances are attached with a randomly generated label and label value called "RandomB". When the label selector rule satisfies "RandomA = RandomB" (a strong anti-affinity configuration for "pod"), each target virtual machine instance with a label value attached to "RandomB" will run on the corresponding worker node with the attached "RandomA" label value, thus enabling the deployment and operation of the target virtual machine instance on different worker nodes.

[0071] The above describes affinity management for multiple generated virtual machine instances by setting affinity configuration information. Without this affinity configuration, multiple virtual machine instances might be deployed on the same worker node. If that worker node fails, all virtual machine instances running on that node will be unable to provide service. Therefore, by distributing the generated virtual machine instances across different worker nodes using the first affinity configuration information, high application availability is achieved.

[0072] S230, Create the target container instance based on the container runtime definition block in the first instance information.

[0073] As an example, creating a target container instance based on the container runtime definition block in the first instance information may include: generating a second definition template for defining the container instance based on the container runtime definition block in the first instance information, and creating the target container instance based on the second definition template.

[0074] As an example, the second definition template could be a "Deployment" that defines information about the target state of a "pod" component, where the "Deployment" controller in "Kubernetes" can create and / or update the "pod" component based on this target state information.

[0075] Optionally, the first instance information includes the number of replicas, and the number of second definition templates generated based on the container runtime definition block is equal to this number of replicas.

[0076] In one possible implementation, the "UniCRD" controller of "Kubernetes" generates a second definition template for "Deployment" based on the contents of the container runtime definition block.

[0077] As an example, the target container instance is a "pod" instance.

[0078] For example, a "web" application can run in a "pod" instance created according to the second definition template.

[0079] Optionally, the first instance information may also include the number of copies of the second definition template to be generated. Accordingly, the worker node generates multiple second definition templates, the number of which is equal to the number of copies indicated in the first instance information; based on these multiple second definition templates, multiple target container instances are created.

[0080] The above method generates container instances with the same number of replicas as the predefined number. When one container instance is in use, it can call other idle container instances to provide services, thereby achieving application load balancing and improving the response efficiency of application services.

[0081] Optionally, the second definition template may include affinity management configuration, which adds a tag to the target container instance during the creation process. "Kubernetes" matches the worker nodes with the corresponding tags based on the added tags, enabling the distributed deployment of multiple target container instances on different worker nodes. The worker nodes can be deployed on physical machines or host machines.

[0082] For example, using the pre-generated, automatically randomized label "RandomA" in Kubernetes, where "RandomA" randomly generates multiple different label values ​​such as 1, 2, 3, 4, etc., this label value can be attached to multiple different worker nodes. Simultaneously, multiple target container instances are attached with a randomly generated label and label value: "RandomC". When the label selector rule satisfies "RandomA = RandomC" ("pod" strong anti-affinity configuration), each target container instance with each label value attached to "RandomC" will run on the corresponding worker node with the attached "RandomA" label value, thus enabling the deployment and operation of the target container instance on different worker nodes. The label and label value used in this example can reuse the "RandomA" label used in S230 above.

[0083] The above describes how affinity management is achieved by setting affinity configuration information for multiple generated container instances. Without this affinity configuration, multiple container instances might be deployed on the same worker node. If that worker node fails, all container instances running on that node will be unable to provide service. Therefore, by distributing the generated container instances across different worker nodes using the first affinity configuration information, high application availability is achieved.

[0084] In one possible implementation, the "API Server" of the "Kubernetes" cluster obtains information about the "UniCRD" object and deploys the "UniCRD" controller based on the "UniCRD"; the "UniCRD" controller generates a "Deployment" based on the virtual machine runtime definition block, and the "Deployment" controller creates a "pod" instance according to the state information defined in the "Deployment".

[0085] It is understood that the order of the steps of creating the target virtual machine instance in S230 and creating the target container instance in S250 is not limited to that shown in this embodiment. In actual application, the target virtual machine instance can be created first according to the first definition template, or the target container instance can be created first according to the second definition template. In addition, the target virtual machine instance and the target container instance can be created simultaneously according to the definition template.

[0086] S240 generates a mapping relationship between the target virtual machine instance and the target container instance.

[0087] As an example, the mapping relationship between the generated target virtual machine instance and target container instance can be configured through tag affinity management.

[0088] For example, after deploying the target virtual machine instance on each worker node using the tag-based distributed deployment method in the S230 example above, if the target container instance has not yet been deployed, a new tag and tag value for the target container instance are added. This tag and tag value reuse "RandomB" from the first definition template and the pre-generated "RandomA". When the tag selector rule satisfies "RandomA = RandomB" ("pod" affinity configuration), each target container instance with each tag value attached to "RandomB" will run on the corresponding worker node with the attached "RandomA" tag value. At this time, the target virtual machine instance is already running on the worker node with the corresponding "RandomA" tag value. Therefore, the corresponding deployment of each target virtual machine instance and each target container instance on the worker node can be completed in this way.

[0089] For example, after deploying the target container instance on each worker node using the tag-based distributed deployment method in the S250 example above, if the target virtual machine instance has not yet been deployed, a new tag and tag value for the target virtual machine instance are added. This tag and tag value reuse "RandomC" and the pre-generated "RandomA" in the second definition template above. When the rule of the tag selector is set to satisfy "RandomA = RandomC" ("pod" affinity configuration), each target virtual machine instance with each tag value attached to "RandomC" will run on the worker node with the corresponding tag value attached to "RandomA". At this time, the target container instance is already running on the worker node with the corresponding tag value of "RandomA". Therefore, the corresponding deployment of each target virtual machine instance and each target container instance on the worker node can be completed in this way.

[0090] The above describes how to deploy virtual machine instances and container instances on the same node by setting affinity configuration information. When virtual machine instances and container instances are deployed on the same worker node, they can use the worker node's own communication channel for high-speed communication, effectively avoiding disconnection issues caused by network communication failures or delays, improving communication stability and speed, and further enhancing the instantaneous response speed of application services.

[0091] It is understood that the definition of affinity management configuration is not limited to the above order; it can be defined in the first definition template, and after the container instance is created, the virtual machine instance generates a mapping relationship with the container instance based on the affinity management configuration; it can also be defined in the second definition template, and after the virtual machine instance is created, the container instance generates a mapping relationship with the virtual machine instance based on the affinity management configuration; in addition, affinity management configuration can be defined in both the first definition template and the second definition template.

[0092] In one possible implementation, a tag is added when the target virtual machine instance is created, and a tag is added when the target container instance is created. When the tags of the target virtual machine instance and the target container instance correspond, a correspondence is established between the target virtual machine instance and the target container instance, and they are deployed on the nearest host machine or physical machine. The tags can be added or removed dynamically after the target virtual machine instance and target container instance are created.

[0093] S250: Construct an application instance containing the target virtual machine instance and the target container instance based on the mapping relationship.

[0094] For example, such as Figure 4 As shown, cluster 400 includes container 410, virtual machine 420, application 430, and database 440. Application 410 is a "web" application, and database 440 is a "MySQL" database. The implementation of the "web" service requires cooperation between the "web" application and the "MySQL" database. The "MySQL" database is designed for single-process, multi-threaded operation, and running it on a virtual machine is more conducive to its performance. Therefore, the "web" application runs in a container, and the "MySQL" database runs in a virtual machine; the combination of these two enables the implementation of the "web" service.

[0095] It can be understood that the above Figure 4 This is just one application scenario disclosed in this embodiment, and the implementation of this solution is not limited to the above scenario.

[0096] In one possible implementation, the "Kubernetes" cluster in the cloud server obtains the "UniCRD" instance file sent by the terminal server. "Kubernetes" deploys the "UniCRD" controller based on the "CRD" mechanism. The "UniCRD" controller completes the creation of virtual machine instances and "pod" instances according to the "UniCRD" instance file, generates the mapping relationship between the virtual machine instance and the "pod" instance, and builds the application instance.

[0097] In summary, the application instance construction method provided in this application utilizes the "CRD" mechanism of "Kubernetes" to place the resource definitions required for running virtual machine instances and container instances into the same definition file for unified deployment. This greatly simplifies the maintenance of "Kubernetes" scheduling templates for virtual machines and containers, reducing the complexity of system scheduling and management of containers and virtual machines. Furthermore, it allows for affinity configuration of containers and virtual machines under the same template, establishing a corresponding mapping relationship between virtual machines and containers. By improving communication efficiency, this effectively enhances the response speed of application services. In actual application service implementation, applications with different characteristics often work together to implement application services, and some applications are more suitable for running on virtual machines. Therefore, by using the affinity management configuration of this application to orchestrate and coordinate containers and virtual machines, the response speed and efficiency of business services are greatly improved.

[0098] Figure 5 This is a schematic diagram of an application example construction device provided in this application embodiment. Figure 5 As shown, the application instance building apparatus 500 includes: an acquisition module 510, a virtual machine creation module 520, a container creation module 530, and a building module 540. As an example, the application instance building apparatus 500 may be... Figure 1 The physical machine where the working nodes reside can also be used in... Figure 1 The chip in the physical machine where the working node is located, or applied to Figure 1 Computer program products in the working nodes.

[0099] Application instance building device 500 can be used for Figure 2 The method in the illustrated embodiment. As an example, the acquisition module 510 is used to implement... Figure 2 S210; Virtual machine creation module 520 is used to implement Figure 2 S220 and S230 in the above; container creation module 530 is used to implement Figure 2 S240 and S250 in the example; Module 540 is used to implement Figure 2 S260 and S270 in the example.

[0100] It is understood that the application instance construction device provided in this application embodiment can be used to execute the technical solution of any of the above-described method embodiments. Its implementation principle and technical effect are similar. For details, please refer to the above method embodiments, which will not be repeated here.

[0101] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device provided in this application may include: a memory 610 and a processor 620.

[0102] Memory 610 is used to store information for implementing Figure 2 Computer applications of the methods shown in the embodiments.

[0103] Processor 620 is used to execute computer applications stored in memory 610, which, when executed by processor 620, implement as follows: Figure 2 The application instance construction method shown in the embodiment.

[0104] Alternatively, the memory 610 can be either standalone or integrated with the processor 620.

[0105] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.

[0106] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the root cause localization method as provided in any of the foregoing embodiments.

[0107] In the several embodiments provided by this invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.

[0108] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute certain steps of the methods of the various embodiments of the present invention.

[0109] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0110] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0111] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0112] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.

[0113] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0114] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0115] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0116] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0117] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.< / format>

Claims

1. A method for constructing application instances, characterized in that, include: Obtain first instance information, which includes a virtual machine runtime definition block and a container runtime definition block, the contents of which are defined according to the same mechanism; Create the target virtual machine instance based on the virtual machine runtime definition block in the first instance information; Create the target container instance based on the container runtime definition block in the first instance information; Generate a mapping relationship between the target virtual machine instance and the target container instance; Construct an application instance based on the target virtual machine instance and the target container instance according to the mapping relationship; The first instance information also includes third affinity configuration information, which is used to indicate the working node where the target virtual machine instance or the target container instance is located; Accordingly, the target virtual machine instance and the target container instance are deployed on the same worker node according to the third affinity configuration information.

2. The method according to claim 1, characterized in that, The first instance information also includes a first replica number, which indicates the first number of virtual machine instances to be generated; The step of creating a target virtual machine instance based on the virtual machine runtime definition block in the first instance information includes: The first number of target virtual machine instances are created based on the virtual machine runtime definition block in the first instance information.

3. The method according to claim 2, characterized in that, The virtual machine runtime definition block includes first affinity configuration information, which is used to indicate multiple worker nodes; Accordingly, at least two of the first number of target virtual machine instances are deployed on different worker nodes among the plurality of worker nodes.

4. The method according to claim 1, characterized in that, The first instance information also includes a second replica count, which indicates a second number of container instances that need to be generated; The step of creating a target container instance based on the container runtime definition block in the first instance information includes: The second number of target container instances are created based on the container runtime definition block in the first instance information.

5. The method according to claim 4, characterized in that, The container runtime definition block includes second affinity configuration information, which is used to indicate multiple worker nodes; Accordingly, at least two of the second number of target container instances are deployed on different worker nodes among the plurality of worker nodes.

6. An application instance construction apparatus, characterized in that, include: The acquisition module is used to acquire first instance information, which includes a virtual machine runtime definition block and a container runtime definition block. The contents of the virtual machine runtime definition block and the container runtime definition block are defined according to the same mechanism. The first instance information also includes third affinity configuration information, which is used to indicate the working node where the target virtual machine instance or the target container instance is located. Accordingly, the target virtual machine instance and the target container instance are deployed on the same working node according to the third affinity configuration information. Virtual machine creation module: used to create the target virtual machine instance based on the virtual machine runtime definition block in the first instance information; Container creation module: Used to create a target container instance based on the container runtime definition block in the first instance information; Build module: Generates the mapping relationship between the target virtual machine instance and the target container instance; builds an application instance based on the mapping relationship and the target virtual machine instance and the target container instance.

7. A computer device, comprising: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-5.

9. A computer program product comprising a computer program that, when executed by a processor, implements the method of any one of claims 1-5.