Stateful application containerized deployment method and device

By defining the general model and user configuration files of stateful applications and combining with Kubernetes Operator technology, containerized automatic deployment of stateful applications such as ElasticSearch is realized, solving the problems of complex operation and maintenance and difficulty in scaling in the existing technology, and achieving rapid deployment , elastic expansion and simplified operation and maintenance.

CN112783646BActive Publication Date: 2025-02-18INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110042809.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-13
Publication Date
2025-02-18
Estimated Expiration
2041-01-13

AI Technical Summary

Technical Problem

It is difficult for the existing technology to realize basic operation and maintenance deployment operations such as rapid construction, expansion, reduction and upgrading of stateful applications such as ElasticSearch, especially in containerized deployment environments.

Method used

By defining a common model and user profile for stateful applications, combined with Kubernetes Operator technology, containerized automatic deployment of stateful application instances is achieved. This method includes obtaining user configuration files, obtaining common models, setting instance configuration information, and automatically deploying with Kubernetes Operator.

Benefits of technology

It realizes rapid containerized deployment of stateful applications such as ElasticSearch, supports elastic capacity expansion and one-click upgrades, simplifies operation and maintenance operations, and allows a single server to deploy multiple stateful application nodes when resources are sufficient.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112783646B_ABST
    Figure CN112783646B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for containerized deployment of stateful applications, which can be used in the field of cloud computing technology. The method comprises: if it is learned from the acquired user configuration file that the stateful application instance corresponding to the user configuration file is not deployed, then the general model of the stateful application corresponding to the user configuration file is acquired; wherein the user configuration file includes the stateful application instance name and the general model name of the stateful application instance; and according to the user configuration file and its corresponding general model of the stateful application, the stateful application instance is containerized and deployed using Kubernetes Operator technology. The present invention performs containerized deployment of stateful applications based on Kubernetes Operator, and realizes automatic containerized deployment of stateful applications by defining a general model of stateful applications and combining user configuration files.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a method and device for containerized deployment of stateful applications. Background Art

[0002] Stateful applications, such as ElasticSearch, as a distributed, highly scalable, and highly real-time search and data analysis engine, have excellent performance in indexing, searching, data analysis, and storage. Taking full advantage of the horizontal scalability of ElasticSearch can make data more valuable in the production environment, which requires the deployment of a large number of ElasticSearch clusters to meet the needs. However, the structure of the ElasticSeacrch cluster itself is relatively complex, requiring at least three types of components: master nodes, client nodes, and data nodes, and has high requirements for machine resources. The current production environment is deployed in a traditional way, and can only deploy a single ElasticSearch cluster node on a single machine. Different nodes need to manually change the configuration file, and the current machine operating system must be installed uniformly. Similar more complex applications such as Solr and Zookeeper that have storage status and topology status requirements all face similar problems as ElasticSearch.

[0003] With the development of cloud platform technology, more and more applications, such as common web apps or mobile backend programs, are integrated into the PaaS cloud based on the Kubernetes platform to achieve containerized deployment. Containerized deployment allows applications to enjoy one-click construction, one-click scaling, and one-click upgrades. Applications do not even need to worry about whether the deployed server has the operating system required for application installation. In addition, if a single server has sufficient resources, multiple nodes can be deployed to fully utilize the machine's resources. Developers do not even need to fully understand Kubernetes to use basic unit models such as Deployment and Service to build their own application topology and expose services.

[0004] However, the main applications for rapid container deployment are all stateless applications. The characteristics of stateless applications support their deployment, migration, and upgrade at any time, and can enjoy the benefits of rapid launch and elastic expansion brought by PaaS cloud. However, as an application that provides distributed system middleware support capabilities, ElasticSearch cannot directly use stateless applications in PaaS cloud solutions due to its complex orchestration relationship of stateful applications and the need to support persistent storage.

[0005] As the scale of clusters grows, how to quickly build, expand, shrink, and upgrade stateful applications such as ElasticSearch is an urgent problem to be solved in this field. Summary of the invention

[0006] In view of the problems existing in the prior art, the main purpose of the embodiments of the present invention is to provide a method and device for containerized deployment of stateful applications, so as to realize containerized deployment of stateful applications such as ElasticSearch.

[0007] In order to achieve the above object, an embodiment of the present invention provides a method for containerized deployment of stateful applications, the method comprising:

[0008] If it is learned from the acquired user configuration file that the stateful application instance corresponding to the user configuration file is not deployed, then the stateful application universal model corresponding to the user configuration file is acquired; wherein the user configuration file includes the stateful application instance name and the stateful application instance universal model name;

[0009] According to the user configuration file and its corresponding general model of stateful application, the Kubernetes Operator technology is used to perform containerized deployment of stateful application instances.

[0010] Optionally, in one embodiment of the present invention, the method further includes: if it is learned from the acquired user profile that the stateful application instance corresponding to the user profile has been deployed, then comparing the user profile with the deployed stateful application instance to obtain a comparison result; and updating the deployed stateful application instance based on the comparison result.

[0011] Optionally, in one embodiment of the present invention, updating the deployed stateful application instance according to the comparison result includes: performing at least one of three update operations of modifying the instance name, modifying the instance quantity, and modifying the node quantity on the deployed stateful application instance according to the comparison result.

[0012] Optionally, in one embodiment of the present invention, the general model of the stateful application includes general elements and instance configuration information, and the general elements are pre-set.

[0013] Optionally, in one embodiment of the present invention, the containerized deployment of stateful application instances using Kubernetes Operator technology based on the user configuration file and its corresponding stateful application general model includes: setting corresponding instance configuration information in the stateful application general model according to the user configuration file to obtain the stateful application instance corresponding to the user configuration file; and automatically deploying the stateful application instance corresponding to the user configuration file in a containerized manner using Kubernetes Operator technology according to preset node orchestration objects, network access methods, and node startup order.

[0014] Optionally, in an embodiment of the present invention, the method further includes: monitoring the running state of the stateful application instance corresponding to the user configuration file, and if it is learned that the running state is abnormal, stopping the running of the stateful application instance corresponding to the user configuration file.

[0015] Optionally, in an embodiment of the present invention, the method further includes: dynamically storing the stateful application instance corresponding to the user configuration file by using a local volume storage method.

[0016] An embodiment of the present invention further provides a stateful application container deployment device, the device comprising:

[0017] A general model module, for obtaining a general model of a stateful application corresponding to the user configuration file if it is learned from the obtained user configuration file that the stateful application instance corresponding to the user configuration file is not deployed; wherein the user configuration file includes a stateful application instance name and a stateful application instance general model name;

[0018] The containerized deployment module is used to perform containerized deployment of stateful application instances using Kubernetes Operator technology according to the user configuration file and its corresponding general model of stateful applications.

[0019] Optionally, in one embodiment of the present invention, the device further includes: a comparison module, for comparing the user configuration file with the deployed stateful application instance to obtain a comparison result if it is learned from the acquired user configuration file that the stateful application instance corresponding to the user configuration file has been deployed; and an update module, for updating the deployed stateful application instance according to the comparison result.

[0020] Optionally, in one embodiment of the present invention, the update module is further used to: perform at least one of three update operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance according to the comparison result.

[0021] Optionally, in one embodiment of the present invention, the general model of the stateful application includes general elements and instance configuration information, and the general elements are pre-set.

[0022] Optionally, in one embodiment of the present invention, the containerized deployment module includes: an application instance unit, used to set corresponding instance configuration information in the stateful application general model according to the user configuration file, and obtain the stateful application instance corresponding to the user configuration file; an automatic deployment unit, used to use Kubernetes Operator technology to automatically deploy the stateful application instance corresponding to the user configuration file in a container according to preset node orchestration objects, network access methods and node startup order.

[0023] Optionally, in one embodiment of the present invention, the device further includes: a monitoring module, configured to monitor the running status of the stateful application instance corresponding to the user configuration file, and if it is learned that the running status is abnormal, stopping the running of the stateful application instance corresponding to the user configuration file.

[0024] Optionally, in an embodiment of the present invention, the device further includes: a dynamic storage module, configured to dynamically store the stateful application instance corresponding to the user configuration file by using a local volume storage method.

[0025] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the program.

[0026] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.

[0027] The present invention performs containerized deployment of stateful applications based on Kubernetes Operator, defines a general model of stateful applications, and combines user configuration files to achieve automatic containerized deployment of stateful applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 A flowchart of a method for containerized deployment of stateful applications according to an embodiment of the present invention;

[0030] Figure 2A flowchart of stateful application instance update in an embodiment of the present invention;

[0031] Figure 3 This is a flow chart of containerized deployment in an embodiment of the present invention;

[0032] Figure 4 This is a schematic diagram of the node startup sequence in an embodiment of the present invention;

[0033] Figure 5 A schematic diagram of the system structure of a method for deploying stateful application containerization in an embodiment of the present invention;

[0034] Figure 6 A schematic diagram of the structure of a stateful application model definition module in an embodiment of the present invention;

[0035] Figure 7 This is a schematic diagram of the structure of the automatic control module in an embodiment of the present invention;

[0036] Figure 8 This is a schematic diagram of the structure of a stateful application instance deployment module in an embodiment of the present invention;

[0037] Fig. 9 A flowchart of a system for applying a stateful application containerized deployment method in an embodiment of the present invention;

[0038] Fig.10 This is a schematic diagram of network connection in an embodiment of the present invention;

[0039] Fig.11 A schematic diagram of the structure of a stateful application container deployment device according to an embodiment of the present invention;

[0040] Fig.12 This is a schematic diagram of the containerized deployment module structure in an embodiment of the present invention;

[0041] Fig.13 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The embodiments of the present invention provide a method and device for containerized deployment of stateful applications, which can be used in the field of cloud computing technology.

[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0044] The execution subject of the stateful application containerized deployment method provided by the embodiment of the present invention includes but is not limited to a computer. The stateful application containerized deployment method based on Kubernetes Operator provided by the embodiment of the present invention can solve various operation and maintenance difficulties encountered in the process of deploying stateful applications such as ElasticSearch through traditional methods, including: complex node construction, difficult capacity expansion, large upgrade workload, and a single server can only deploy a single node, etc., to realize the stateful application such as ElasticSearch into the PaaS cloud, support the maintenance of its topological state and storage state, provide automatic deployment based on the entire ElasticSearch and other stateful application clusters, realize one-click expansion and one-click upgrade through the update of configuration files, and in the case of sufficient resources, a single server can support the node deployment of multiple ElasticSearch instances.

[0045] like Figure 1 The flowchart of a method for containerized deployment of a stateful application according to an embodiment of the present invention is shown. The method shown in the figure includes:

[0046] Step S1, if it is learned from the obtained user configuration file that the stateful application instance corresponding to the user configuration file is not deployed, then obtain the stateful application general model corresponding to the user configuration file; wherein the user configuration file includes the stateful application instance name and the stateful application instance general model name.

[0047] Taking the stateful application ElasticSearch as an example, obtain the configuration file provided by the user, which can be a yaml file. Compare the stateful application instance name recorded in the user configuration file with the name of the deployed stateful application instance to determine whether the stateful application instance recorded in the user configuration file has been deployed. If not, obtain the pre-set stateful application instance general model according to the stateful application instance general model name recorded in the user configuration file.

[0048] Furthermore, the general model of the stateful application instance is pre-set, which can also be called the general model definition of the stateful application instance, which mainly defines the general elements and instance configuration information in the general model. The stateful application instance includes various types of nodes, and the general elements mainly refer to the types of nodes, the number of each type of nodes, and the number of instances included in the stateful application instance. Taking the stateful application ElasticSearch (abbreviated as ES) as an example, the general model is shown in Table 1, and the instance configuration information is shown in Table 2. Among them, the Kibana node is the web interface for log analysis provided by the elastic official website for ES nodes. It can be used to perform efficient search, visualization, analysis and other operations on logs. Cerebro node is a general cluster monitoring tool in the industry, which can be used to monitor various indicators of the ES cluster.

[0049] Table 1

[0050]

[0051] Table 2

[0052]

[0053] Step S2: Based on the user configuration file and its corresponding general model of stateful application, containerized deployment of stateful application instances is performed using Kubernetes Operator technology.

[0054] Taking the stateful application ElasticSearch as an example, the user-configurable yaml file, i.e., the user configuration file, is shown in Table 3. Based on the user configuration file provided by the user, the general model of the stateful application instance can be set. Specifically, the numerical part in Table 2 is mainly set using the user configuration file.

[0055] Table 3

[0056]

[0057] Furthermore, after setting the general model of stateful applications using the user profile, the construction of the stateful application instance corresponding to the user profile is completed. The constructed stateful application instance is automatically deployed in a container using the Kubernetes Operator technology. Among them, the Kubernetes Operator technology is a controller that manages specific applications, supports the configuration and orchestration of various native resource objects of Kubernetes, and implements the creation, configuration, and management of complex stateful application instances in a software manner by extending the Kubernetes API.

[0058] Specifically, taking the stateful application ElasticSearch as an example, in order to maintain the topological state of the stateful application, the Kubernetes Operator technology is used to sequentially establish the nodes and services of the stateful application. The node startup sequence is as follows: Figure 4 shown.

[0059] As an embodiment of the present invention, Figure 2 As shown, the method also includes:

[0060] Step S21: if it is known from the obtained user configuration file that the stateful application instance corresponding to the user configuration file has been deployed, the user configuration file is compared with the deployed stateful application instance to obtain a comparison result.

[0061] The stateful application instance name recorded in the user configuration file is compared with the deployed stateful application instance to determine whether the stateful application instance recorded in the user configuration file has been deployed. If it has been deployed, the user configuration file is compared with the name of the deployed stateful application instance to obtain a comparison result. Specifically, if the number of instances in the user configuration file is two more than the number of deployed stateful application instances, the comparison result is that two instances are added.

[0062] Step S22: updating the deployed stateful application instance according to the comparison result.

[0063] Specifically, if the comparison result may include one or more of increasing the number of instances, modifying the instance name, and increasing the number of nodes, etc., the deployed stateful application instance is updated accordingly according to the comparison result.

[0064] In this embodiment, updating the deployed stateful application instance according to the comparison result includes: performing at least one of three update operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance according to the comparison result.

[0065] As an embodiment of the present invention, the general model of a stateful application includes general elements and instance configuration information, and the general elements are preset.

[0066] Among them, the common elements mainly refer to the node types, the number of each type of nodes and the number of instances included in the stateful application instance. Taking the stateful application ElasticSearch (abbreviated as ES or es) as an example, the instance configuration information is shown in Table 2.

[0067] In this embodiment, if Figure 3As shown, according to the user configuration file and its corresponding general model of stateful application, using Kubernetes Operator technology to perform containerized deployment of stateful application instances includes:

[0068] Step S31, according to the user configuration file, setting the corresponding instance configuration information in the stateful application general model, and obtaining the stateful application instance corresponding to the user configuration file.

[0069] Step S32, using Kubernetes Operator technology, according to the preset node orchestration object, network access method and node startup sequence, the stateful application instance corresponding to the user configuration file is automatically deployed in a containerized manner.

[0070] Among them, taking the stateful application ElasticSearch as an example, the user-configurable yaml file, that is, the user configuration file is shown in Table 3, the general model of the stateful application instance is shown in Table 1, and the instance configuration information is shown in Table 2. The general model of the stateful application instance can be set based on the user configuration file provided by the user. Specifically, the numerical part in Table 2 is mainly set using the user configuration file.

[0071] Furthermore, in order to maintain the topology state of the stateful application ElasticSearch, the KubernetesOperator technology is used to sequentially establish the nodes and services of the stateful application. The node startup sequence is as follows: Figure 4 In addition, when using Kubernetes Operator technology for containerized deployment, deployment is performed according to the preset node orchestration objects and network access methods. Taking the stateful application ElasticSearch as an example, the node orchestration objects and network access methods are shown in Table 4.

[0072] Table 4

[0073]

[0074] In this embodiment, the method further includes: monitoring the running state of the stateful application instance corresponding to the user configuration file, and if it is learned that the running state is abnormal, stopping the running of the stateful application instance corresponding to the user configuration file.

[0075] Taking the stateful application ElasticSearch as an example, Kubernetes Operator technology is used to monitor the running status of the stateful application instance based on the preset common elements and ES topology status. When the running status is abnormal, the running of the stateful application instance is stopped.

[0076] In this embodiment, the method further includes: dynamically storing the stateful application instance corresponding to the user configuration file by using a local volume storage method.

[0077] Among them, the local-volume storage method is adopted to realize dynamic storage of stateful application instances.

[0078] like Figure 5 As shown is a system structure diagram of the stateful application containerized deployment method applied in an embodiment of the present invention, a stateful application model definition module 1, an automatic control module 2 and a stateful application instance deployment module 3, the stateful application model definition module 1 is connected to the automatic control module 2; the automatic control module 2 is connected to the stateful application instance deployment module 3; the stateful application model definition module 1 is connected to the stateful application instance deployment module 3.

[0079] The stateful application model definition module 1 is used for users to customize the configuration of the stateful application model, what are the necessary elements to establish a stateful application cluster, and define the number of instances to be established, such as how many ElasticSearch clusters to build and how many nodes and storage capacity to build in each ElasticSearch cluster. The relevant definition information is saved in the project configuration file.

[0080] The automatic control module 2 reads the configuration information from the stateful application model definition module 1, which mainly includes common elements and instance configuration information, and then the execution module will take the execution logic accordingly. The user's request to create / update, expand capacity, etc. to this module will be parsed. This module can ensure that the request is automatically executed and monitor in real time whether it reaches the expected value.

[0081] The stateful application instance deployment module 3 reads the configuration from the stateful application model definition module 1 according to the command of the automatic control module 2, and creates an expected stateful application instance according to the command, including nodes, networks, storage, external exposure services and data monitoring of the stateful application instance.

[0082] like Fig. 9 The following is a flowchart of the system that applies the stateful application container deployment method. The specific working process of the system is described as follows in combination with the structure of each model in the system. Figure 6 The internal structure diagram of the stateful application model definition module 1 is shown. The stateful application model definition module 1 includes a general element configuration unit 11, an instance configuration unit 12 and a state maintenance unit 13, wherein:

[0083] The common element configuration unit 11 is used to define the basic elements required for a stateful application cluster, the types of nodes it mainly includes, and the Kubernetes orchestration objects used by the nodes.

[0084] The instance configuration unit 12 is used to define the number of each node and the number of instances according to the general element configuration unit 11, that is, how many stateful application instances are created.

[0085] The state maintenance unit 13 is used for stateful applications that need to maintain the topology state and storage state. It is necessary to use the StatefulSet and PV / PVC models of the Kubernetes platform and the Kubernetes Operator technology to orderly create different ES cluster nodes. StatefulSet (stateful set) is a standard orchestration object introduced by Kubernetes to solve stateful service problems. Pod is the smallest unit level managed by Kubernetes and is a combination of one or more containers. The Pod managed by StatefulSet has a fixed name and start and stop order; StatefulSet combined with PV / PVC can maintain the storage state of the application, so that the binding relationship between Pod and PV does not change with restart or migration. PV refers to persistent volume, which is a storage space in the storage system. PV is persistent and its life cycle is independent of Pod. PVC refers to persistent volume claim, which is an application description for PV, that is, a user's request for storage. StatefulSet binds a dedicated PV to each Pod based on the PVC storage application configuration and maintains the binding relationship unchanged; StatefulSet combined with Headless Service can further realize node network persistence. A general Service (referring to Kubernetes Service, which exposes an application running on a group of Pods as an abstract method of network services, using a label selector to identify a group of Pods) will only automatically load the access to a certain node on the backend, while a Headless Service (a type of Kubernetes Service, referring to a headless service, which does not allocate a specific cluster IP, but resolves the node IP through a domain name) will return a full address list of the backend node when accessed. Combined with the Pod name, the specific Pod can be accurately accessed. The unchanged Pod name managed by StatefulSet can achieve stable access.

[0086] The states include: 1) Network persistence: To achieve stable internal communication, the Pod access address must remain unchanged when the Pod is migrated or restarted; 2) Storage persistence: Persistent storage must be implemented within the Pod, and the storage content must not be lost when the Pod is migrated or restarted; 3) Topology state, node creation must be orderly: for example, in ElasticSearch, the order is master (management) node, data (storage) node, and client (client) node.

[0087] The objects that are orchestrated by StatefulSet are nodes that need to maintain the state information of the application, and have the requirement of network and storage persistence; the objects that are orchestrated by Deployment (a standard orchestration object introduced by Kubernetes to solve the problem of stateless services) do not need to maintain the state and can be started and stopped on different machines at will. The ElasticSearch cluster needs to retain the topological state, and the Kubernetes Operator technology is used to establish each node and service in order, such as Figure 4 shown.

[0088] like Figure 7 The figure shows the internal structure of the automatic control module 2. The automatic control module 2 includes a request parsing unit 21, a policy execution unit 22 and a monitoring management unit 23, wherein:

[0089] The request parsing unit 21 is used to parse the user's request. The user only needs to modify the configuration of the yaml file, parse it into a comparison with the deployed instance on the current machine, parse it into creating an instance, upgrading an instance, expanding the node, etc. Specifically, if the cluster name is different, a new ES cluster is created; if the image is different, the corresponding node image is upgraded; if the number of nodes is different, the corresponding node is expanded.

[0090] The policy execution unit 22 is used to determine the difference between the currently deployed stateful application ElasticSearch instance and the configuration file updated by the user according to the request. If there is a difference in the image, the upgrade strategy is started; if there is a difference in the quantity, the node expansion strategy is started; if there is a difference in the es cluster name, a new ElasticSearch instance is created.

[0091] The monitoring management unit 23 is used to monitor and manage the lifecycle of instance creation based on the ES-operator designed and created according to the general element configuration unit 11 and the defined ES topology state based on the Kubernetes Operator technology, monitor whether the created containers are in a healthy running state, and display the current state. When deploying containers, they are automatically allocated and deployed according to the resources and server specifications required by the containers, and are established in sequence. If the resources are insufficient, the Pending state is displayed, and the reason is displayed whether the CPU, memory or storage is insufficient, and the user is notified to expand the server as needed.

[0092] like Figure 8 The figure shows the internal structure of the stateful application instance deployment module 3, which includes a node deployment unit 31, a dynamic storage unit 32 and a network connection unit 33.

[0093] The node deployment unit 31 is used to deploy the stateful application container instance according to the general element configuration unit 11 of the stateful application model definition module 1 and the policy execution unit 22 of the automatic control module 2 .

[0094] The dynamic storage unit 32 is mainly aimed at the master and data nodes that require persistent storage, and adopts the local disk local-volume storage method. In order to prevent the waste of storage resources caused by the early creation of PV, when the container is deployed on the corresponding host machine, the required size of PV is dynamically created according to the local disk resources of the host machine. The master and data nodes will generate the required storage declaration, namely PVC, to realize the binding of PVC and PV and realize dynamic storage connection.

[0095] In order to ensure that the created stateful application cluster can expose services to the outside, the network connection unit 33 needs to execute a load balancing strategy, and ElasticSearch needs to apply for the corresponding ES domain name. The industry-wide Ingress solution is used to achieve external access to services within the ES cluster, and further combined with load balancers such as F5 to achieve SLB (Server Load Balancer, referring to the load balancing of network servers) load balancing: Deploy an Ingress container on each host machine in the k8s (Kubernetes) cluster (Ingress is used to expose HTTP or HTTPS routes from outside the cluster to services within the cluster), and implement external traffic access by specifying a port on the host machine in the form of NodePort (Node node port, an external access method for kubernetes, where the Node node refers to a virtual machine or physical machine in the kubernetes cluster); specify routing rules within the Ingress container, and route traffic to the corresponding Service service in the cluster according to the domain name; support online adjustment of routing rules in the form of yaml configuration, and take effect dynamically. Taking ElasticSearch as an example, the specific details are as follows: Fig.10 shown.

[0096] The present invention applies the common elements of a custom stateful application cluster and a stateful application instance configuration file, executes the configuration file input command (such as kubectl apply-f + file name), and the Operator technology implements lifecycle management based on the difference between the expected value and the current value, automatically deploys the stateful application container on the server, and provides storage persistence support and network external services. The basic topology of the application is built through the Statefulset and PV models of Kubernetes, which helps to realize the corresponding persistent storage, sequential deployment, sequential expansion, sequential rolling update and other features. Its advantages are as follows: realize the rapid online construction of stateful applications; support the elastic expansion of stateful application nodes; support one-click upgrade of stateful application nodes; support automatic lifecycle management, simplify operation and maintenance operations; when the server resources are sufficient, multiple stateful application nodes can be deployed on one machine to make full use of resources.

[0097] like Fig.11 The figure is a schematic diagram of the structure of a stateful application container deployment device according to an embodiment of the present invention. The device shown in the figure includes:

[0098] The general model module 10 is used to obtain the stateful application general model corresponding to the user configuration file if it is learned from the obtained user configuration file that the stateful application instance corresponding to the user configuration file is not deployed; wherein the user configuration file includes the stateful application instance name and the stateful application instance general model name.

[0099] Taking the stateful application ElasticSearch as an example, obtain the configuration file provided by the user, which can be a yaml file. Compare the stateful application instance name recorded in the user configuration file with the deployed stateful application instance to determine whether the stateful application instance recorded in the user configuration file has been deployed. If not, obtain the pre-set stateful application instance general model according to the stateful application instance general model name recorded in the user configuration file.

[0100] Furthermore, the general model of the stateful application instance is pre-set, which can also be called the general model definition of the stateful application instance, and mainly defines the general elements and instance configuration information in the general model. The stateful application instance includes multiple types of nodes, and the general elements mainly refer to the types of nodes, the number of each type of nodes, and the number of instances included in the stateful application instance.

[0101] The containerized deployment module 20 is used to perform containerized deployment of stateful application instances using Kubernetes Operator technology according to the user configuration file and its corresponding general model of stateful applications.

[0102] Taking the stateful application ElasticSearch as an example, the user-configurable yaml file, i.e., the user configuration file, can be used to set the general model of the stateful application instance based on the user configuration file provided by the user.

[0103] As an embodiment of the present invention, the device also includes: a comparison module, which is used to compare the user configuration file with the deployed stateful application instance to obtain a comparison result if it is learned from the acquired user configuration file that the stateful application instance corresponding to the user configuration file has been deployed; and an update module, which is used to update the deployed stateful application instance according to the comparison result.

[0104] In this embodiment, the update module is further used to: perform at least one of the three update operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance according to the comparison result.

[0105] As an embodiment of the present invention, the general model of a stateful application includes general elements and instance configuration information, and the general elements are preset.

[0106] In this embodiment, if Fig.12 As shown in the figure, the containerized deployment module includes:

[0107] An application instance unit, configured to set corresponding instance configuration information in a stateful application general model according to the user configuration file, and obtain a stateful application instance corresponding to the user configuration file;

[0108] The automatic deployment unit is used to use Kubernetes Operator technology to automatically deploy the stateful application instance corresponding to the user configuration file in a containerized manner according to the preset node orchestration object, network access method and node startup sequence.

[0109] In this embodiment, the device further includes: a monitoring module, which is used to monitor the running state of the stateful application instance corresponding to the user configuration file, and if it is learned that the running state is abnormal, stop the running of the stateful application instance corresponding to the user configuration file.

[0110] In this embodiment, the device further includes: a dynamic storage module, which is used to dynamically store the stateful application instance corresponding to the user configuration file by using a local volume storage method.

[0111] Based on the same application concept as the above-mentioned stateful application containerized deployment method, the present invention also provides the above-mentioned stateful application containerized deployment device. Since the principle of solving the problem by the stateful application containerized deployment device is similar to that of the stateful application containerized deployment method, the implementation of the stateful application containerized deployment device can refer to the implementation of the stateful application containerized deployment method, and the repeated parts will not be repeated.

[0112] The present invention performs containerized deployment of stateful applications based on Kubernetes Operator, defines a general model of stateful applications, and combines user configuration files to achieve automatic containerized deployment of stateful applications.

[0113] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the program.

[0114] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.

[0115] like Fig.13 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processing unit 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Fig.13 In addition, the electronic device 600 may also include Fig.13 For components not shown, reference may be made to the prior art.

[0116] like Fig.13 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.

[0117] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.

[0118] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.

[0119] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.

[0120] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0121] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0122] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that the sound can be recorded on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.

[0123] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0127] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for containerized deployment of stateful applications, characterized in that: The method comprises: If it is learned from the acquired user configuration file that the stateful application instance corresponding to the user configuration file is not deployed, then the stateful application universal model corresponding to the user configuration file is acquired; wherein the user configuration file includes the stateful application instance name and the stateful application instance universal model name; According to the user configuration file and its corresponding general model of stateful application, the stateful application instance is containerized and deployed using Kubernetes Operator technology; The general model of the stateful application includes general elements and instance configuration information, and the general elements are preset; wherein the general elements include the types of nodes in the stateful application instance, the number of each type of nodes, and the number of instances; The method of using Kubernetes Operator technology to perform containerized deployment of stateful application instances according to the user configuration file and its corresponding general model of stateful applications includes: According to the user configuration file, setting the corresponding instance configuration information in the stateful application general model, and obtaining the stateful application instance corresponding to the user configuration file; Utilizing Kubernetes Operator technology, the stateful application instance corresponding to the user configuration file is automatically deployed in a containerized manner according to the preset node orchestration object, network access method, and node startup sequence.

2. The method according to claim 1, characterized in that The method further comprises: If it is known from the obtained user configuration file that the stateful application instance corresponding to the user configuration file has been deployed, then the user configuration file is compared with the deployed stateful application instance to obtain a comparison result; According to the comparison result, the deployed stateful application instance is updated.

3. The method according to claim 2, characterized in that The updating of the deployed stateful application instance according to the comparison result includes: performing at least one of three update operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance according to the comparison result.

4. The method according to claim 1, characterized in that: The method further includes: monitoring the running state of the stateful application instance corresponding to the user configuration file, and if it is learned that the running state is abnormal, stopping the running of the stateful application instance corresponding to the user configuration file.

5. The method according to claim 1, characterized in that The method further includes: dynamically storing the stateful application instance corresponding to the user configuration file by using a local volume storage method.

6. A stateful application container deployment device, characterized in that: The device comprises: A general model module, for obtaining a general model of a stateful application corresponding to the user configuration file if it is learned from the obtained user configuration file that the stateful application instance corresponding to the user configuration file is not deployed; wherein the user configuration file includes a stateful application instance name and a stateful application instance general model name; A containerized deployment module, used to perform containerized deployment of stateful application instances using Kubernetes Operator technology according to the user configuration file and its corresponding general model of stateful applications; The general model of the stateful application includes general elements and instance configuration information, and the general elements are preset; wherein the general elements include the types of nodes in the stateful application instance, the number of each type of nodes, and the number of instances; Among them, the containerized deployment module includes: an application instance unit, which is used to set the corresponding instance configuration information in the stateful application general model according to the user configuration file, and obtain the stateful application instance corresponding to the user configuration file; an automatic deployment unit, which is used to use Kubernetes Operator technology to automatically deploy the stateful application instance corresponding to the user configuration file in a containerized manner according to the preset node orchestration object, network access method and node startup sequence.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for deploying stateful pod by adopting kubernetes

    CN111831394A

  • Deployment method and device of main node in cluster and computer readable storage medium

    CN112214330A