CN112783646A - Stateful application containerization deployment method and device - Google Patents

Stateful application containerization deployment method and device Download PDF

Info

Publication number
CN112783646A
CN112783646A CN202110042809.0A CN202110042809A CN112783646A CN 112783646 A CN112783646 A CN 112783646A CN 202110042809 A CN202110042809 A CN 202110042809A CN 112783646 A CN112783646 A CN 112783646A
Authority
CN
China
Prior art keywords
stateful application
configuration file
user configuration
stateful
instance
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110042809.0A
Other languages
Chinese (zh)
Inventor
齐颀
郑杰
任政
白佳乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110042809.0A priority Critical patent/CN112783646A/en
Publication of CN112783646A publication Critical patent/CN112783646A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Abstract

The invention provides a containerized deployment method and device for stateful applications, which can be used in the technical field of cloud computing. The method comprises the following steps: if the situation that the stateful application instance corresponding to the user configuration file is not deployed is known according to the obtained user configuration file, a stateful application general model corresponding to the user configuration file is obtained; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance; and performing containerized deployment on the stateful application example by utilizing a Kubernetes Operator technology according to the user configuration file and the corresponding stateful application general model. The invention carries out containerized deployment of the stateful application based on the Kubernetes Operator, and realizes containerized automatic deployment of the stateful application by defining a universal model of the stateful application and combining a user configuration file.

Description

Stateful application containerization deployment method and device
Technical Field
The invention relates to the technical field of cloud computing, in particular to a containerized deployment method and device for stateful applications.
Background
Stateful applications, such as elastic search, as a distributed, highly extended, highly real-time search and data analysis engine, have very good performance in establishing indexes, searching, data analysis, storage, and the like. Taking full advantage of the horizontal scalability of the ElasticSearch enables data to become more valuable in a production environment, which requires a large deployment of ElasticSearch clusters for demand. However, the constitution of the ElasticSeach cluster is complex, at least three components including a master node, a client node and a data node are required, and the requirement on machine resources is high. The current production environment is deployed in a traditional mode, single elastic search cluster node deployment can be carried out only through a single machine, different nodes need to manually change configuration files, and the current machine operating systems need to be installed in a unified mode. Similarly, more complex applications such as solr and zookeeper with storage state and topology state requirements all face similar problems as the ElasticSearch.
With the development of cloud platform technology, more and more applications such as common web apps or mobile end background programs enter the PaaS cloud based on a Kubernetes platform, and containerization deployment is realized. The containerized deployment can enable the application to enjoy the benefits of one-key construction, one-key expansion and contraction, one-key upgrading and the like, even the application does not need to care whether the deployed server is an operating system required by application installation, and a single server can deploy a plurality of nodes under the condition of sufficient resources, so that the resources of the machine are fully utilized. Developers can construct own application topology and expose services by using basic unit models such as Deployment, Service and the like without even knowing Kubernets.
However, the main applications of the above fast containerization deployment are stateless applications. The characteristics of the stateless application support the operation of deployment, migration, upgrading and the like at any time, and can enjoy the red benefits of quick online and elastic capacity expansion brought by the PaaS cloud. However, as the application providing the middleware support capability of the distributed system, the elastic search cannot directly use the stateless application-to-PaaS cloud scheme because of the complex arrangement relationship of stateful applications and the need to support persistent storage.
With the increasing huge cluster scale, how to realize basic operation and maintenance deployment operations such as rapid construction, capacity expansion, capacity reduction, upgrading and the like of stateful applications such as elastic search and the like is a problem to be solved urgently in the field.
Disclosure of Invention
Aiming at the problems in the prior art, embodiments of the present invention mainly aim to provide a method and an apparatus for containerized deployment of stateful applications, so as to implement containerized deployment of stateful applications such as elastic search.
In order to achieve the above object, an embodiment of the present invention provides a stateful application containerization deployment method, where the method includes:
if the situation that the stateful application instance corresponding to the user configuration file is not deployed is known according to the obtained user configuration file, a stateful application general model corresponding to the user configuration file is obtained; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance;
and performing containerized deployment on the stateful application example by utilizing a Kubernetes Operator technology according to the user configuration file and the corresponding stateful application general model.
Optionally, in an embodiment of the present invention, the method further includes: if the situation that the stateful application instance corresponding to the user configuration file is deployed is known according to the obtained user configuration file, comparing the user configuration file with the deployed stateful application instance to obtain a comparison result; and updating the deployed stateful application instances according to the comparison result.
Optionally, in an embodiment of the present invention, the updating the deployed stateful application instance according to the comparison result includes: and according to the comparison result, performing at least one of three updating operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance.
Optionally, in an embodiment of the present invention, the stateful application general model includes a general element and instance configuration information, and the general element is preset.
Optionally, in an embodiment of the present invention, the performing stateful application instance containerization deployment by using a kubernets Operator technology according to the user profile and the corresponding stateful application general model includes: setting corresponding instance configuration information in a state application general model according to the user configuration file to obtain a state application instance corresponding to the user configuration file; and utilizing a Kubernetes Operator technology, arranging an object, a network access mode and a node starting sequence according to preset nodes, and carrying out containerization automatic deployment on the stateful application examples corresponding to the user configuration files.
Optionally, in an embodiment of the present invention, the method further includes: and monitoring the running state of the stateful application instance corresponding to the user configuration file, and stopping running of the stateful application instance corresponding to the user configuration file if the running state is not normal.
Optionally, in an embodiment of the present invention, the method further includes: and dynamically storing the stateful application instances corresponding to the user configuration files by using a local volume storage mode.
An embodiment of the present invention further provides a stateful application containerization deployment apparatus, where the apparatus includes:
the universal model module is used for acquiring a stateful application universal model corresponding to the user configuration file if the fact that the stateful application instance corresponding to the user configuration file is not deployed is known according to the acquired user configuration file; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance;
and the containerization deployment module is used for carrying out containerization deployment on the stateful application examples by utilizing a Kubernet Operator technology according to the user configuration file and the corresponding stateful application general model.
Optionally, in an embodiment of the present invention, the apparatus further includes: the comparison module is used for comparing the user configuration file with the deployed stateful application examples to obtain a comparison result if the obtained user configuration file is known to have deployed the stateful application examples corresponding to the user configuration file; and the updating module is used for updating the deployed stateful application examples according to the comparison result.
Optionally, in an embodiment of the present invention, the update module is further configured to: and according to the comparison result, performing at least one of three updating operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance.
Optionally, in an embodiment of the present invention, the stateful application general model includes a general element and instance configuration information, and the general element is preset.
Optionally, in an embodiment of the present invention, the containerization deployment module includes: the application instance unit is used for setting corresponding instance configuration information in a state application general model according to the user configuration file to obtain a state application instance corresponding to the user configuration file; and the automatic deployment unit is used for performing containerization automatic deployment on the stateful application examples corresponding to the user configuration files according to a preset node arrangement object, a network access mode and a node starting sequence by using a Kubernets Operator technology.
Optionally, in an embodiment of the present invention, the apparatus further includes: and the monitoring module is used for monitoring the running state of the stateful application instance corresponding to the user configuration file, and stopping the running of the stateful application instance corresponding to the user configuration file if the running state is not normal.
Optionally, in an embodiment of the present invention, the apparatus further includes: and the dynamic storage module is used for dynamically storing the stateful application instances corresponding to the user configuration files by using a local volume storage mode.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
The invention carries out containerized deployment of the stateful application based on the Kubernetes Operator, and realizes containerized automatic deployment of the stateful application by defining a universal model of the stateful application and combining a user configuration file.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is a flowchart of a stateful application containerization deployment method according to an embodiment of the present invention;
FIG. 2 is a flow chart of stateful application instance updates in an embodiment of the present invention;
FIG. 3 is a flow chart of containerization deployment in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a node start-up sequence according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a system applying a stateful application containerization deployment method according to an embodiment of the present invention;
FIG. 6 is a block diagram of a stateful application model definition module according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an automatic control module according to an embodiment of the present invention;
FIG. 8 is a block diagram of a stateful application instance deployment module according to an embodiment of the present invention;
FIG. 9 is a flowchart of the operation of a system applying the stateful application containerization deployment method in an embodiment of the present invention;
FIG. 10 is a diagram illustrating network connections in accordance with an embodiment of the present invention;
FIG. 11 is a schematic structural diagram of a stateful application containerization deployment device according to an embodiment of the present invention;
FIG. 12 is a schematic structural diagram of a containerized deployment module of an embodiment of the present invention;
fig. 13 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The embodiment of the invention provides a containerized deployment method and device for stateful applications, which can be used in the technical field of cloud computing.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The executing body of the stateful application containerization deployment method provided by the embodiment of the invention comprises but is not limited to a computer. The stateful application containerization deployment method based on the Kubernet Operator provided by the embodiment of the invention can solve various operation and maintenance difficulties encountered in the deployment process of stateful applications such as elastic search in a traditional mode, and comprises the following steps: the method has the advantages that the node building is complex, the capacity expansion is difficult, the upgrading workload is large, only a single node can be deployed by a single server, and the like, the state application of the ElasticSearch and the like is realized to enter the PaaS cloud, the maintenance of the topological state and the storage state of the state application is supported, the automatic deployment with the whole state application cluster of the ElasticSearch and the like as a unit is provided, the one-key capacity expansion and one-key upgrading are realized through the updating of the configuration file, and in addition, the node deployment of multiple ElasticSearch instances can be supported by the single server under the condition of sufficient resources.
Fig. 1 is a flowchart of a stateful application containerization deployment method according to an embodiment of the present invention, where the method includes:
step S1, if it is known that the stateful application instance corresponding to the user configuration file is not deployed according to the obtained user configuration file, obtaining a stateful application general model corresponding to the user configuration file; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance.
Taking stateful application of ElasticSearch as an example, the configuration file provided by the user is obtained, and the user configuration file may be a yaml file. And comparing the name of the stateful application instance recorded in the user configuration file with the name of the deployed stateful application instance, and judging whether the stateful application instance recorded in the user configuration file is deployed or not. And if not, acquiring a preset universal model of the stateful application instance according to the name of the stateful application instance universal model recorded in the user configuration file.
Furthermore, the general model of the stateful application instance is preset, which may also be referred to as stateful application instance general model definition, and mainly defines general elements and instance configuration information in the general model. The stateful application instance comprises a plurality of types of nodes, and the general elements mainly refer to the types of the nodes, the number of the nodes and the number of the instances in the stateful application instance. Taking stateful application of elastic search (abbreviated ES) as an example, the general model is shown in table 1, and the example configuration information is shown in table 2. The Kibana node is a Web interface for providing log analysis for the ES node by an elastic official network, and can be used for carrying out various operations such as efficient searching, visualization, analysis and the like on the log. The Cerebro node is a common cluster monitoring tool in the industry, and can be used for monitoring various indexes of the ES cluster.
TABLE 1
Figure BDA0002895937650000061
TABLE 2
Figure BDA0002895937650000062
And step S2, according to the user configuration file and the corresponding universal model of the stateful application, performing stateful application instance containerization deployment by utilizing a Kubernetes Operator technology.
Here, using stateful application ElasticSearch as an example, the user-configurable yaml file, i.e., the user configuration file, is shown in table 3. The stateful application instance generic model may be set based on a user profile provided by a user, and specifically, the value part in table 2 is mainly set by using the user profile.
TABLE 3
Figure BDA0002895937650000071
Furthermore, after the user configuration file is provided with the general model of the state application, the construction of the state application instance corresponding to the user configuration file is completed. And (3) utilizing a Kubernetes Operator technology to automatically perform containerized deployment on the constructed stateful application examples. The Kubernetes Operator technology is a controller for managing specific application programs, supports configuration and arrangement of various types of native resource objects of Kubernetes, and achieves creation, configuration and management of complex stateful application instances in a software mode by expanding Kubernetes API.
Specifically, taking an example of stateful application, in order to maintain a topological state of stateful application, each node and service of stateful application are sequentially established through a kubernets Operator technology, and a node starting sequence is shown in fig. 4.
As an embodiment of the present invention, as shown in fig. 2, the method further includes:
step S21, if it is known that the stateful application instance corresponding to the user profile is deployed according to the obtained user profile, comparing the user profile with the deployed stateful application instance to obtain a comparison result.
And comparing the name of the stateful application instance recorded in the user configuration file with the deployed stateful application instance, and judging whether the stateful application instance recorded in the user configuration file is deployed or not. And if the deployment is carried out, comparing the user configuration file with the name of the deployed stateful application example to obtain a comparison result. Specifically, if the number of instances in the user profile is two more than the number of deployed stateful application instances, the comparison result is to increase two instances.
And step S22, updating the deployed stateful application instances according to the comparison result.
Specifically, the comparison result may include one or more of increasing the number of instances, modifying the name of the instances, increasing the number of nodes, and the like. And according to the comparison result, correspondingly updating the deployed stateful application instance.
In this embodiment, according to the comparison result, updating the deployed stateful application instance includes: and according to the comparison result, performing at least one of three updating operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance.
As one embodiment of the invention, the stateful application general model comprises general elements and instance configuration information, wherein the general elements are preset.
The general elements mainly refer to the node types, the number of various nodes and the number of instances included in the stateful application instances. Taking the stateful application of elastic search (abbreviated ES or ES) as an example, the example configuration information is shown in table 2.
In this embodiment, as shown in fig. 3, performing stateful application instance containerization deployment by using a kubernets Operator technology according to the user profile and the corresponding stateful application general model includes:
and step S31, setting corresponding instance configuration information in the general model of the state application according to the user configuration file, and obtaining a state application instance corresponding to the user configuration file.
And step S32, utilizing Kubernets Operator technology, arranging objects, network access modes and node starting sequences according to preset nodes, and carrying out containerization automatic deployment on the stateful application examples corresponding to the user configuration files.
Taking stateful application ElasticSearch as an example, a user-configurable yaml file, that is, a user configuration file is shown in table 3, a stateful application instance general model is shown in table 1, and instance configuration information is shown in table 2. The stateful application instance generic model may be set based on a user profile provided by a user, and specifically, the value part in table 2 is mainly set by using the user profile.
Further, in order to maintain the topological state of the stateful application, the stateful application nodes and services are sequentially established through the kubernets Operator technology, and the node starting sequence is shown in fig. 4. In addition, when the kubernets Operator technology is used for containerization deployment, deployment is carried out according to a preset node arrangement object and a network access mode. Taking stateful application of ElasticSearch as an example, the node arrangement object and the network access mode are shown in table 4.
TABLE 4
Figure BDA0002895937650000091
In this embodiment, the method further includes: and monitoring the running state of the stateful application instance corresponding to the user configuration file, and stopping running of the stateful application instance corresponding to the user configuration file if the running state is not normal.
The method comprises the steps of monitoring the running state of a stateful application instance by taking a stateful application ElasticSearch as an example and utilizing a Kubernets Operator technology according to preset general elements and ES topological state. And when the running state is abnormal, stopping running the stateful application instance.
In this embodiment, the method further includes: and dynamically storing the stateful application instances corresponding to the user configuration files by using a local volume storage mode.
Wherein, a local-volume storage mode is adopted to realize the dynamic storage of the stateful application instance.
Fig. 5 is a schematic diagram of a system structure applying the stateful application containerization deployment method in the embodiment of the present invention, where the stateful application model definition module 1, the automatic control module 2, the stateful application instance deployment module 3, and the stateful application model definition module 1 are connected to the automatic control module 2; the automatic control module 2 is connected with the stateful application instance deployment module 3; the stateful application model definition module 1 is connected to the stateful application instance deployment module 3.
The stateful application model definition module 1 is used for a user to define the configuration of a stateful application model, establish which necessary elements are needed for a stateful application cluster, and define the number of instances that are desired to be established, such as establishing several elastic search clusters and how many nodes in each elastic search cluster are established, and the storage amount. The relevant definition information is saved to the project configuration file.
The automatic control module 2 reads configuration information from the stateful application model definition module 1, mainly including general elements and instance configuration information, and then the execution module correspondingly adopts execution logic. The user initiates the requests of creation/updating, capacity expansion and the like to the module to be analyzed, and the module can ensure that the requests are automatically executed and monitor whether the requests reach the expected value in real time.
The stateful application instance deployment module 3 reads configuration from the stateful application model definition module 1 according to the command of the automatic control module 2, and creates a stateful application instance according to the command, wherein the stateful application instance is expected to meet the requirements, and the stateful application instance comprises nodes, networks, storage, external exposed services and data monitoring of the stateful application instance.
Fig. 9 is a flowchart of a system applying the stateful application containerization deployment method, and a specific working process of the system is described as follows in combination with each model structure in the system. As shown in fig. 6, which is a schematic diagram of the internal structure of the stateful application model definition module 1, 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, where:
the generic element configuration unit 11 is used to define which basic elements are needed by a stateful application cluster, which nodes mainly contain which kind of nodes and what the Kubernetes orchestration object used by the nodes is.
The instance configuration unit 12 is used for defining the number of each node according to the general element configuration unit 11, and defining the number of instances, namely, how many stateful application instances are created.
The state maintenance unit 13 is used for stateful applications that need to maintain topology states and storage states, and needs to use stateful set and PV/PVC models of a Kubernets platform, and Kubernets Operator technology to orderly create different ES cluster nodes. Stateful set, is a standard orchestration object introduced by kubernets to solve stateful service problems. Pod is the minimum unit level managed by kubernets, and is a combination of one or more containers. The Pod managed by the StateUfSet has a fixed name and a start-stop sequence; the Stateful set can maintain the storage state of the application in combination with the PV/PVC, and the binding relationship between the Pod and the PV can be kept unchanged along with restart or migration. PV refers to a Persistent Volume, is a block of storage space in a storage system, and has persistence and a life cycle independent of Pod. PVC refers to Persistent Volume Claim, which is an application description for PV, i.e., a request for storage by a user. Configuring a Stateful set into each Pod binding special PV based on a PVC storage application, and maintaining a binding relationship unchanged; the node network persistence can be further realized by combining StatefUlSet with Headless Service. The general Service (refer to kubernets Service, an application program running on a group of Pods is disclosed as an abstract method of network Service, a label selector is used for identifying a group of Pods.) only can automatically load access to a certain node at the back end, and the Headless Service (a type of kubernets Service, refer to Headless Service, does not allocate a specific cluster IP, but resolves the node IP through a domain name) can return to a full address list of the back end node when being accessed, can accurately access to a specific Pod by combining the Pod name, and can realize stable access through the characteristic that the Pod name managed by the stateful set is not changed.
The states include: 1) network persistence: in order to realize internal stable communication, when the Pod is migrated or restarted, the Pod access address needs to be kept unchanged; 2) and (3) storage persistence: persistent storage needs to be realized in the Pod, and the storage content cannot be lost under the conditions of Pod migration or restart and the like; 3) topological state, node creation needs ordering: for example, the priority order of the elastic search is master node, data node and client node.
The StateUfSet editing object is a node which needs to maintain the state information of the application, and has the requirements of network and storage persistence; the Deployment object (which is a standard Deployment object introduced by kubernets for solving the problem of stateless service) does not need to maintain the state, and can be started and stopped on different machines at will. The ElasticSearch cluster has a requirement reservation of a topological state, and each node and service are sequentially established through a kubernets Operator technology, as shown in fig. 4.
As shown in fig. 7, which is a schematic diagram of 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:
the request parsing unit 21 is configured to parse a request of a user, where the user only needs to change the configuration yaml file, parse the request into a comparison with a deployed instance on a current machine, and parse the request into a created instance, an upgraded instance, an extended node, and the like. Specifically, if the cluster names are different, a new ES cluster is created, if the images are different, the corresponding node images are upgraded, and if the number of nodes is different, the corresponding nodes are expanded.
The policy execution unit 22 is configured to determine, according to the request, that the currently deployed stateful application ElasticSearch instance is different from the configuration file updated by the user, start the upgrade policy if there is a mirror image difference, start the capacity expansion node policy if there is a quantity difference, and create a new ElasticSearch instance if there is an es cluster name difference.
The monitoring management unit 23 is configured to design, based on kubernets Operator technology, an ES-Operator created according to the general element configuration unit 11 and the defined ES topology state for monitoring and life cycle management of instance creation, monitor whether all created containers are in a healthy operating state, and display a current state. When the container is deployed, the container is automatically allocated and deployed according to the resource required by the container and the specification of the server, the allocation and deployment are sequentially established according to the sequence, if the resource is insufficient, a Pending state is displayed, and the reason why the CPU or the memory or the storage is insufficient is displayed, so that a user is informed to expand the server as required.
Fig. 8 is a schematic diagram illustrating an internal structure of the stateful application instance deployment module 3, where the stateful application instance deployment module 3 includes a node deployment unit 31, a dynamic storage unit 32, and a network connection unit 33. Wherein:
the node deployment unit 31 is used for deploying the stateful application container instance according to the generic element configuration unit 11 of the stateful application model definition module 1 and the policy execution unit 22 of the automatic control module 2.
The dynamic storage unit 32 is mainly oriented to the master and data nodes needing persistent storage, and adopts a local-volume storage mode of a local disk, so as to prevent storage resource waste caused by creating PV in advance, when a container is deployed on a corresponding host, PV with a required size is dynamically created according to local disk resources of the host, wherein the master and data nodes can generate required storage statements, namely PVC, binding of PVC and PV is realized, and dynamic storage connection is realized.
In order to ensure that the created stateful application cluster can expose the service to the outside, the network connection unit 33 needs to execute a load balancing policy, and the ElasticSearch needs to apply for a corresponding ES domain name. External access of services in the ES cluster is realized by an Ingress scheme commonly used in the industry, and SLB (Server Load Balancer) Load balancing is realized by further combining Load balancers such as F5: deploying an Ingress container (Ingress is an HTTP or HTTPs route for exposing services from outside the cluster to inside the cluster) on each host of a k8s (kubernets) cluster, and implementing external traffic access in a Node port (a Node port, an external access manner of kubernets, where a Node refers to a virtual machine or a physical machine in the kubernets cluster) manner by specifying a port on the host; a routing rule is appointed in the Ingress container, and the traffic is routed to a corresponding Service in the cluster according to the domain name; and in the form of yaml configuration, online adjustment of the routing rule is supported, and dynamic effect is achieved. Taking an elastic search as an example, it is specifically shown in fig. 10.
According to the invention, after a configuration file input command (such as a kubecect application-f + file name) is executed by self-defining a general element of a stateful application cluster and a stateful application instance configuration file, an Operator technology realizes life cycle management according to the difference between a comparison expected value and a comparison current value, a stateful application container is automatically deployed on a server, and storage persistence support and network external service are provided. The application basic topology is constructed through a Stateful model and a PV model of Kubernetes, and the characteristics of corresponding persistent storage, sequential deployment, sequential capacity expansion, sequential rolling update and the like are facilitated. Its advantages are as follows: realizing the rapid online construction of the stateful application; supporting the elastic expansion of the state application nodes; one-key upgrading of the application nodes with the states is supported; automatic life cycle management is supported, and operation and maintenance operations are simplified; under the condition that server resources are sufficient, a plurality of stateful application nodes can be deployed on one machine, and resources are fully utilized.
Fig. 11 is a schematic structural diagram of a stateful application containerization deployment apparatus according to an embodiment of the present invention, where the apparatus includes:
a general model module 10, configured to, if it is known that a stateful application instance corresponding to the user profile is not deployed according to the obtained user profile, obtain a stateful application general model corresponding to the user profile; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance.
Taking stateful application of ElasticSearch as an example, the configuration file provided by the user is obtained, and the user configuration file may be a yaml file. And comparing the name of the stateful application instance recorded in the user configuration file with the deployed stateful application instance, and judging whether the stateful application instance recorded in the user configuration file is deployed or not. And if not, acquiring a preset universal model of the stateful application instance according to the name of the stateful application instance universal model recorded in the user configuration file.
Furthermore, the general model of the stateful application instance is preset, which may also be referred to as stateful application instance general model definition, and mainly defines general elements and instance configuration information in the general model. The stateful application instance comprises a plurality of types of nodes, and the general elements mainly refer to the types of the nodes, the number of the nodes and the number of the instances in the stateful application instance.
And the containerization deployment module 20 is configured to perform containerization deployment of the stateful application instance by using a kubernets Operator technology according to the user configuration file and the corresponding stateful application general model.
In which, taking stateful application ElasticSearch as an example, yaml file, i.e. user configuration file, is configurable by the user. The stateful application instance generic model may be set up based on a user profile provided by a user.
As an embodiment of the present invention, the apparatus further comprises: the comparison module is used for comparing the user configuration file with the deployed stateful application examples to obtain a comparison result if the obtained user configuration file is known to have deployed the stateful application examples corresponding to the user configuration file; and the updating module is used for updating the deployed stateful application examples according to the comparison result.
In this embodiment, the update module is further configured to: and according to the comparison result, performing at least one of three updating operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance.
As one embodiment of the invention, the stateful application general model comprises general elements and instance configuration information, wherein the general elements are preset.
In this embodiment, as shown in fig. 12, the containerization deployment module includes:
the application instance unit is used for setting corresponding instance configuration information in a state application general model according to the user configuration file to obtain a state application instance corresponding to the user configuration file;
and the automatic deployment unit is used for performing containerization automatic deployment on the stateful application examples corresponding to the user configuration files according to a preset node arrangement object, a network access mode and a node starting sequence by using a Kubernets Operator technology.
In this embodiment, the apparatus further comprises: and the monitoring module is used for monitoring the running state of the stateful application instance corresponding to the user configuration file, and stopping the running of the stateful application instance corresponding to the user configuration file if the running state is not normal.
In this embodiment, the apparatus further comprises: and the dynamic storage module is used for dynamically storing the stateful application instances corresponding to the user configuration files by using a local volume storage mode.
Based on the same application concept as the stateful application containerization deployment method, the invention also provides the stateful application containerization deployment device. Because the principle of solving the problem of the stateful application containerization deployment device is similar to that of a stateful application containerization deployment method, the implementation of the stateful application containerization deployment device can refer to the implementation of the stateful application containerization deployment method, and repeated parts are not described again.
The invention carries out containerized deployment of the stateful application based on the Kubernetes Operator, and realizes containerized automatic deployment of the stateful application by defining a universal model of the stateful application and combining a user configuration file.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
As shown in fig. 13, the electronic device 600 may further include: communication module 110, input unit 120, audio processing unit 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in FIG. 13; furthermore, the electronic device 600 may also comprise components not shown in fig. 13, which may be referred to in the prior art.
As shown in fig. 13, the central processor 100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
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 an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage portion 144 of the memory 140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging application, address book application, etc.).
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 an input signal and receive an output signal, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, so that recording on the local can be enabled through a microphone 132, and so that sound stored on the local can be played through a speaker 131.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A stateful application containerized deployment method, the method comprising:
if the situation that the stateful application instance corresponding to the user configuration file is not deployed is known according to the obtained user configuration file, a stateful application general model corresponding to the user configuration file is obtained; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance;
and performing containerized deployment on the stateful application example by utilizing a Kubernetes Operator technology according to the user configuration file and the corresponding stateful application general model.
2. The method of claim 1, further comprising:
if the situation that the stateful application instance corresponding to the user configuration file is deployed is known according to the obtained user configuration file, comparing the user configuration file with the deployed stateful application instance to obtain a comparison result;
and updating the deployed stateful application instances according to the comparison result.
3. The method of claim 2, wherein updating the deployed stateful application instance according to the comparison comprises: and according to the comparison result, performing at least one of three updating operations of instance name modification, instance quantity modification and node quantity modification on the deployed stateful application instance.
4. The method of claim 1, wherein the stateful application generic model comprises generic elements and instance configuration information, and wherein the generic elements are pre-configured.
5. The method according to claim 4, wherein the performing stateful application instance containerized deployment using a Kubernetes Operator technique according to the user profile and its corresponding stateful application generic model comprises:
setting corresponding instance configuration information in a state application general model according to the user configuration file to obtain a state application instance corresponding to the user configuration file;
and utilizing a Kubernetes Operator technology, arranging an object, a network access mode and a node starting sequence according to preset nodes, and carrying out containerization automatic deployment on the stateful application examples corresponding to the user configuration files.
6. The method of claim 5, further comprising: and monitoring the running state of the stateful application instance corresponding to the user configuration file, and stopping running of the stateful application instance corresponding to the user configuration file if the running state is not normal.
7. The method of claim 5, further comprising: and dynamically storing the stateful application instances corresponding to the user configuration files by using a local volume storage mode.
8. A stateful application containerized deployment apparatus, the apparatus comprising:
the universal model module is used for acquiring a stateful application universal model corresponding to the user configuration file if the fact that the stateful application instance corresponding to the user configuration file is not deployed is known according to the acquired user configuration file; the user configuration file comprises a name of a stateful application instance and a name of a universal model of the stateful application instance;
and the containerization deployment module is used for carrying out containerization deployment on the stateful application examples by utilizing a Kubernet Operator technology according to the user configuration file and the corresponding stateful application general model.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 7.
CN202110042809.0A 2021-01-13 2021-01-13 Stateful application containerization deployment method and device Pending CN112783646A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110042809.0A CN112783646A (en) 2021-01-13 2021-01-13 Stateful application containerization deployment method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110042809.0A CN112783646A (en) 2021-01-13 2021-01-13 Stateful application containerization deployment method and device

Publications (1)

Publication Number Publication Date
CN112783646A true CN112783646A (en) 2021-05-11

Family

ID=75755737

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110042809.0A Pending CN112783646A (en) 2021-01-13 2021-01-13 Stateful application containerization deployment method and device

Country Status (1)

Country Link
CN (1) CN112783646A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114153525A (en) * 2021-11-30 2022-03-08 国电南瑞科技股份有限公司 AI model service sharing method and system for power grid regulation and control business
CN114745378A (en) * 2022-02-14 2022-07-12 优刻得科技股份有限公司 Function module distribution method and system based on edge cloud scene
CN114756261A (en) * 2022-03-23 2022-07-15 广域铭岛数字科技有限公司 Container cluster upgrading method and system, electronic equipment and medium
CN115309400A (en) * 2022-10-10 2022-11-08 阿里巴巴(中国)有限公司 Task deployment method, service platform, deployment platform, device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190065323A1 (en) * 2017-08-25 2019-02-28 Vmware, Inc. Containerized application snapshots
CN111831394A (en) * 2020-06-30 2020-10-27 新浪网技术(中国)有限公司 Method and device for deploying stateful pod by using kubernets
CN112214330A (en) * 2020-11-04 2021-01-12 腾讯科技(深圳)有限公司 Method and device for deploying master nodes in cluster and computer-readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190065323A1 (en) * 2017-08-25 2019-02-28 Vmware, Inc. Containerized application snapshots
CN111831394A (en) * 2020-06-30 2020-10-27 新浪网技术(中国)有限公司 Method and device for deploying stateful pod by using kubernets
CN112214330A (en) * 2020-11-04 2021-01-12 腾讯科技(深圳)有限公司 Method and device for deploying master nodes in cluster and computer-readable storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114153525A (en) * 2021-11-30 2022-03-08 国电南瑞科技股份有限公司 AI model service sharing method and system for power grid regulation and control business
CN114153525B (en) * 2021-11-30 2024-01-05 国电南瑞科技股份有限公司 AI model servitization sharing method and system for power grid regulation and control service
CN114745378A (en) * 2022-02-14 2022-07-12 优刻得科技股份有限公司 Function module distribution method and system based on edge cloud scene
CN114756261A (en) * 2022-03-23 2022-07-15 广域铭岛数字科技有限公司 Container cluster upgrading method and system, electronic equipment and medium
CN115309400A (en) * 2022-10-10 2022-11-08 阿里巴巴(中国)有限公司 Task deployment method, service platform, deployment platform, device and storage medium

Similar Documents

Publication Publication Date Title
CN108809722B (en) Method, device and storage medium for deploying Kubernetes cluster
CN112783646A (en) Stateful application containerization deployment method and device
EP3170071B1 (en) Self-extending cloud
US7823023B2 (en) Test framework for testing an application
CN102571940B (en) Application program remote installation system, method, intelligent terminal, application server
CN108089913B (en) Virtual machine deployment method of super-fusion system
CN112506617B (en) Mirror image updating method and device for side car containers in Kubernetes cluster
CN111796838B (en) Automatic deployment method and device for MPP database
CN113778623B (en) Resource processing method and device, electronic equipment and storage medium
CN105450759A (en) System mirror image management method and device
US10901722B2 (en) Collaborative maintenance of software programs
CN113572862A (en) Cluster deployment method and device, electronic equipment and storage medium
CN111858050A (en) Server cluster mixed deployment method, cluster management node and related system
CN112468545A (en) Cloud host creation method, device, system, equipment and readable storage medium
CN106301855B (en) Network management system deployment method and device and network management system
CN114866570A (en) Information processing method and device, electronic equipment and storage medium
CN114338820A (en) Network access method, device, electronic equipment and storage medium
CN104104701A (en) Online service configuration updating method and system
CN110113217B (en) Micro-service management method, device, management platform and storage medium
CN111897565A (en) Data processing method, device and equipment based on Internet of things
CN115268951A (en) Installation method, device, equipment and storage medium of operating system
CN113157823A (en) Cluster system deployment method and device
WO2016206437A1 (en) Rom package generation method and device
CN110971665A (en) Management method, system, equipment and storage medium for interfacing multi-type storage
CN113835715A (en) Case board card, cluster system, software deployment method and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination