Container configuration method, system and device
By allocating persistent volumes (PVs) to stateless container clusters, the problem of data loss during stateless container restart is solved, and data stability of container clusters and efficient utilization of storage resources are achieved.
Patent Information
- Application Number
- CN202311545034.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2025-05-20
AI Technical Summary
Stateless containers may cause data storage to be unstable during restart, resulting in data loss, and the prior art is difficult to effectively solve this problem.
By obtaining callback requests, obtaining the information and storage information of the deployment unit, and feedbacking the storage information in response to callback requests, to allocate a persistent volume (PV) to the container cluster, ensuring that the data generated during the container runtime can be persisted and avoiding data loss.
It realizes that stateless containers can still access the previously stored data when restarting, improves the data stability of the container cluster, avoids the need to repeatedly allocate storage space, and improves the utilization rate of storage resources.
Smart Images

Figure CN120020720A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and in particular, to a container configuration method, system, and device. Background Art
[0002] Container technology is a lightweight virtualization technology that can package an application and its dependencies into a portable container for running in different environments. Containers can include stateless containers, that is, no state information is saved inside the container, so they can be replaced, extended, scaled down, etc. at will. Therefore, for stateless containers, it is usually necessary to mount a storage space to save the data generated during the container operation.
[0003] For example, when using k8s (Kubernetes) to deploy a POD (or called pod) cluster, two controllers named StatefulSet and Deployment are usually used to control the stateful container cluster and the stateless container cluster respectively. For stateless containers, when a restart occurs, data storage may be unstable. Therefore, for stateless containers, how to improve the running stability has become an urgent problem to be solved. Summary of the Invention
[0004] This application provides a container configuration method, system, and device for allocating a storage space to store data for a stateless container, which can avoid data loss caused by stateless containers.
[0005] In view of this, in a first aspect, the present application provides a container configuration method, including: First, obtain a callback request, which can be used to indicate or request the configuration of at least one container (or referred to as a container cluster). The at least one container can be implemented by one or more deployment units, or in other words, the container can run in one or more deployment units. One deployment unit can run one or more containers. Subsequently, based on the callback request, obtain information about at least one deployment unit. The information about the at least one deployment unit can specifically include the information carried in the callback request, or can also include the information assigned to the deployment unit. Subsequently, obtain the storage information corresponding to at least one deployment unit. The storage information can be the information of the pre-allocated storage space, or can also be the storage space information allocated to the at least one deployment unit after receiving the callback request. The storage information can be used to read the storage space. For example, the storage information can include information such as the index, address, or declaration of the storage space. Subsequently, in response to the callback request, feedback the storage information. The storage information is used to create (or referred to as allocate or mount, etc.) a storage space for the container cluster. The storage space is used to store the data generated when at least one container is running. The storage space can specifically include a persistent volume (PV) in the file system, so as to use the PV to replace the temporary storage space.
[0006] Therefore, in the embodiments of the present application, a PV is allocated for the container cluster to store the data generated during the operation of the container cluster. Even if the container cluster is restarted, the data can be read from the allocated storage space, avoiding data loss and improving the data stability of the container cluster. For stateless containers, it is possible to avoid repeatedly allocating storage space for stateless containers, improving the utilization rate of storage resources.
[0007] In a possible implementation manner, there is a mapping relationship between the storage information and the deployment unit. This mapping relationship can be used to obtain the storage information corresponding to at least one deployment unit when at least one deployment unit is restarted. In the embodiments of the present application, a mapping relationship between the storage space and the deployment unit is established. When the container cluster is restarted, the storage space available for the container cluster can be queried based on this mapping relationship, and historical data can be read to achieve stable data storage of the container.
[0008] In a possible implementation manner, the storage information can specifically include a persistent volume claim (PVC). The information about the at least one deployment unit includes the unique identifier of each deployment unit. When constructing the mapping relationship, specifically, a mapping relationship between the PVC and the unique identifier of each deployment unit can be constructed. This mapping relationship can specifically be a mapping table, mapping text, or mapping rule, etc. Therefore, when constructing the mapping relationship, a mapping relationship between the PVC and the unique identifier of the deployment unit can be constructed to facilitate the subsequent maintenance of the mapping relationship.
[0009] In a possible implementation manner, obtaining information about at least one deployment unit according to the container creation request described above may include: obtaining information about the instance to which at least one deployment unit belongs through the information carried in the callback request, such as the name, type, or identifier of the instance to which the deployment unit belongs; subsequently, according to the information about the instance to which the at least one deployment unit belongs, assigning a unique identifier to the at least one deployment unit, that is, the information about the at least one deployment unit includes the unique identifier of each deployment unit. In the implementation manner of this application, a unique identifier can be assigned to each deployment unit based on the instance to which each deployment unit belongs, and the information about the instance to which the deployment unit belongs can be used to determine the identifier included in the unique identifier of the deployment unit, such as determining the encoding of the unique identifier based on the instance name. Therefore, when assigning a unique identifier, a unique identifier related to the instance to which the deployment unit belongs can be assigned to the deployment unit, so that the unique identifier can identify the instance to which the deployment unit belongs.
[0010] In a possible implementation manner, assigning a unique identifier to at least one deployment unit according to the information about the instance to which the at least one deployment unit belongs may include: First, determining the number of at least one deployment unit according to the information about the instance to which the at least one deployment unit belongs; determining the number of unique identifiers to be assigned according to the number of at least one deployment unit, and assigning a unique identifier to each deployment unit. Thus, a unique identifier can be assigned to each deployment unit, so that the storage space can be allocated in units of deployment units subsequently.
[0011] In a possible implementation manner, the information about the at least one deployment unit includes the unique identifier of each deployment unit, and the method may further include: obtaining the unique identifiers of at least one unused deployment unit, such as the unique identifiers of the redundant deployment units after the container is scaled down, or the unique identifiers of the vacant deployment units after the container is restarted, etc.; if the at least one unused deployment unit meets the preset recycling conditions, recycling the at least one unused deployment unit, and the unique identifier of each deployment unit after recycling is used as the unique identifier of the new deployment unit when creating a deployment unit.
[0012] In the implementation manner of this application, when there are unused deployment units that meet the recycling conditions, the unique identifiers of these deployment units can be recycled, and when creating new deployment units subsequently, the recycled unique identifiers can be reused, realizing the recycling of unique identifiers and improving resource utilization.
[0013] In a possible implementation, the foregoing recycling conditions may include one or more of the following: the identifier of the deployment unit is added to the first list in N consecutive scan cycles, where the first list includes information on the created but unused deployment units, and N is a positive integer, which is equivalent to the unique identifier of the deployment unit not being used for a long time; or, the number of replicas of the deployment controller exceeds a preset number.
[0014] In a possible implementation, the foregoing recycling of at least one unused deployment unit may specifically include: creating a recycling container, and then migrating the data in the storage space corresponding to the at least one unused deployment unit to a preset directory through the recycling container. Generally, the data stored in the file system can be read through the container. Therefore, in this application, the data stored in the recycled container can be migrated by creating a container, thereby realizing the recycling of the container.
[0015] In a second aspect, this application provides a container configuration method, including: first, obtaining information on at least one deployment unit to be deployed, where the at least one deployment unit is used to run at least one container, and each deployment unit can run one or more containers. The container may specifically be a stateless container, and of course, it can also be applied to stateful containers; then sending a callback request, which can be used to indicate the configuration of at least one container, such as allocating storage space for the deployment unit; obtaining a callback response for the callback request, where the callback response includes storage information, and the storage information can be used to indicate the storage space; then mounting the storage space in at least one deployment unit to store the data of at least one container, and the storage space includes PV in the file system, and the file system is used to provide space for storing data.
[0016] In the implementation of this application, PV is allocated for the container cluster to store the data generated during the operation of the container. Even if the container is restarted, the data can be read from the PV allocated for the container cluster, and the data generated during the operation of the container can continue to be stored in the PV after restart, thereby improving the data stability of the container.
[0017] In a possible implementation, the foregoing obtaining information on at least one deployment unit to be deployed may include: obtaining a container creation request, which is used to request the creation of at least one deployment unit, and the information on the at least one deployment unit to be created is carried in the container creation request. Therefore, in the implementation of this application, a container cluster can be created based on the request.
[0018] In a possible implementation manner, the obtaining of information about at least one deployment unit to be deployed may include: if at least one deployment unit is restarted, obtaining information about the at least one deployment unit after restart. In the implementation manner of this application, it can be applied to the creation and restart process of a container cluster, and can be applicable to multiple scenarios, enabling the created containers to run stably.
[0019] In a third aspect, this application provides a container configuration method, including: first obtaining a deletion instruction (or also referred to as a recycling instruction), where the deletion instruction is used to indicate deleting at least one deployment unit, and the at least one deployment unit is used to run a container cluster, and the container cluster may include one or more containers, that is, the deletion instruction may also indicate deleting the container cluster; then recycling the information of each deployment unit in the at least one deployment unit, where the information of each deployment unit includes the unique identifier of each deployment unit, and the unique identifier of each deployment unit after recycling is used as the unique identifier of a new deployment unit when creating a deployment unit.
[0020] In the implementation manner of this application, when the container cluster is recycled, the unique identifier of the recycled container cluster can be reused, thereby improving the utilization rate of the identifier and also improving the utilization rate of the corresponding PV.
[0021] In a possible implementation manner, the information of each deployment unit described above includes the unique identifier of each deployment unit. Therefore, when recycling containers, specifically, the unique identifier corresponding to the deployment unit can be recycled, thereby improving the utilization rate of the unique identifier.
[0022] In a possible implementation manner, before obtaining the deletion instruction, the method may further include: obtaining a callback request, where the callback request is used to indicate configuring at least one container; obtaining information about at least one deployment unit according to the callback request, and the at least one deployment unit is used to implement at least one container; obtaining storage information corresponding to the at least one deployment unit; and in response to the callback request, feedbacking the storage information to create at least one deployment unit, where the storage information is used to create a storage space, the storage space is used to store data of at least one container, the storage space includes a persistent volume PV in the file system, and the storage space is used to mount at least one container.
[0023] In the implementation manner of this application, a PV is allocated for the container cluster to save the data generated during the operation of the container cluster. Even if the container cluster is restarted, data can be read from the allocated storage space, avoiding data loss and improving the data stability of the container cluster. For stateless containers, it is possible to avoid repeatedly allocating storage space for stateless containers, improving the utilization rate of storage resources.
[0024] In a fourth aspect, this application provides a container configuration device, including:
[0025] A transceiver module, configured to obtain a callback request, where the callback request is used to indicate the configuration of at least one container;
[0026] A processing module, configured to obtain information of at least one deployment unit according to the callback request, where the at least one deployment unit is used to implement at least one container;
[0027] The processing module is further configured to obtain storage information corresponding to the at least one deployment unit;
[0028] The transceiver module is further configured to feedback the storage information in response to the callback request, where the storage information is used to create a storage space, the storage space is used to store data of at least one container, and the storage space includes a Persistent Volume (PV) in a file system.
[0029] In a possible implementation manner, the storage information has a mapping relationship with the at least one deployment unit, and the mapping relationship is used to obtain the storage information corresponding to the at least one deployment unit when the at least one deployment unit is restarted.
[0030] In a possible implementation manner, the storage information includes a Persistent Volume Claim (PVC), and the information of the at least one deployment unit includes the unique identifier of each deployment unit; specifically, the mapping relationship includes the mapping relationship between the PVC and the unique identifier of each deployment unit.
[0031] In a possible implementation manner, the processing module is specifically configured to: obtain information of an instance to which the at least one deployment unit belongs; and assign a unique identifier to the at least one deployment unit according to the information of the instance to which the at least one deployment unit belongs, where the information of the at least one deployment unit includes the unique identifier of each deployment unit.
[0032] In a possible implementation manner, the processing module is specifically configured to: determine the number of the at least one deployment unit according to the information of the instance to which the at least one deployment unit belongs; and assign a unique identifier to each deployment unit according to the number of the at least one deployment unit.
[0033] In a possible implementation manner, the processing module is further configured to: obtain the unique identifier of at least one unused deployment unit; and if the at least one unused deployment unit meets a preset recycling condition, recycle the at least one unused deployment unit, and the unique identifier of each recycled deployment unit is used as the unique identifier of a new deployment unit when creating a deployment unit.
[0034] In a possible implementation manner, the recycling condition includes one or more of the following: the identifier of the deployment unit is added to a first list in N consecutive scan cycles, where the first list includes information of created but unused deployment units, and N is a positive integer; or, the number of replicas of the deployment controller exceeds a preset number.
[0035] In a possible implementation, the processing module is further configured to: create a recycling container; and migrate the data in the storage space corresponding to at least one unused deployment unit to a preset directory through the recycling container.
[0036] In a fifth aspect, the present application provides a container configuration device, including:
[0037] A transceiver module, configured to obtain information about at least one deployment unit to be deployed, where the at least one deployment unit is used to implement at least one container;
[0038] The transceiver module is further configured to send a callback request, where the callback request is used to indicate to configure at least one container;
[0039] The transceiver module is further configured to obtain a callback response for the callback request, where the callback response includes storage information, and the storage information is used to indicate a storage space;
[0040] A processing module, configured to mount a storage space in at least one deployment unit to store data of at least one container, where the storage space includes a persistent volume PV in a file system, and the file system is used to provide a space for storing data.
[0041] In a possible implementation, the transceiver module is specifically configured to: obtain a container creation request, where the container creation request is used to request to create at least one deployment unit, and the information about the at least one deployment unit is carried in the container creation request.
[0042] In a possible implementation, the transceiver module is specifically configured to: if at least one deployment unit is restarted, obtain the information about the at least one restarted deployment unit.
[0043] In a sixth aspect, the present application provides a container configuration device, including:
[0044] A transceiver module, configured to obtain a deletion instruction, where the deletion instruction is used to indicate to delete at least one deployment unit, and the at least one deployment unit is used to implement at least one container;
[0045] A processing module, configured to recycle the information of each deployment unit in at least one deployment unit, where the information of each deployment unit includes the unique identifier of each deployment unit, and the unique identifier of each recycled deployment unit is used as the unique identifier of a new deployment unit when creating a deployment unit.
[0046] In a possible implementation, the transceiver module is further configured to obtain a callback request before obtaining the deletion instruction, where the callback request is used to indicate to configure at least one container;
[0047] The processing module is further configured to obtain information of at least one deployment unit according to a callback request, and the at least one deployment unit is used to implement at least one container;
[0048] The processing module is further configured to obtain storage information corresponding to the at least one deployment unit;
[0049] The transceiver module is further configured to feedback the storage information in response to the callback request to create at least one deployment unit. The storage information is used to create a storage space, the storage space is used to store data of at least one container, the storage space includes a persistent volume PV in the file system, and the storage space is used to mount at least one container.
[0050] It can be understood that the beneficial effects of the fourth to sixth aspects above can be referred to the relevant descriptions in the first to third aspects above, and will not be repeated here.
[0051] In a seventh aspect, an embodiment of the present application provides a container configuration device, including: a processor and a memory. Wherein, the processor and the memory are interconnected by a line, and the processor calls program code in the memory to execute functions related to processing in the container configuration method shown in any one of the first aspects above. Optionally, the container configuration device may be a chip.
[0052] In an eighth aspect, an embodiment of the present application provides a container configuration device, including: a processor and a memory. Wherein, the processor and the memory are interconnected by a line, and the processor calls program code in the memory to execute functions related to processing in the container configuration method shown in any one of the second aspects above. Optionally, the container configuration device may be a chip.
[0053] In a ninth aspect, an embodiment of the present application provides a container configuration device, including: a processor and a memory. Wherein, the processor and the memory are interconnected by a line, and the processor calls program code in the memory to execute functions related to processing in the container configuration method shown in any one of the third aspects above. Optionally, the container configuration device may be a chip.
[0054] In a tenth aspect, an embodiment of the present application provides a container configuration system, including a server and a service network element. The service network element can be used to execute the method steps of any optional implementation manner of the first aspect or the third aspect above, and the server can be used to execute the method steps of any optional implementation manner of the second aspect or the second aspect above.
[0055] In an eleventh aspect, an embodiment of the present application provides a digital processing chip or a chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface, and the program instructions are executed by the processing unit. The processing unit is used to execute functions related to processing in any optional implementation manner of the first aspect, the second aspect, or the third aspect above.
[0056] In a twelfth aspect, an embodiment of the present application provides a computer-readable storage medium including instructions, which, when running on a computer, cause the computer to execute the method in any one of the optional embodiments of the first aspect, the second aspect, or the third aspect described above.
[0057] In a thirteenth aspect, an embodiment of the present application provides a computer program product containing computer programs / instructions, which, when executed by a processor, cause the processor to execute the method in any one of the optional embodiments of the first aspect, the second aspect, or the third aspect described above. Description of the Drawings
[0058] Figure 1 It is a schematic diagram of a system architecture provided by the present application;
[0059] Figure 2 It is a schematic diagram of the running process of k8S provided by the present application;
[0060] Figure 3 It is a schematic diagram of a storage allocation process provided by the present application;
[0061] Figure 4 It is another schematic diagram of a system architecture provided by the present application;
[0062] Figure 5 It is a schematic diagram of the process of a container configuration method provided by the present application;
[0063] Figure 6 It is a schematic diagram of the process of another container configuration method provided by the present application;
[0064] Figure 7 It is a schematic diagram of the process of another container configuration method provided by the present application;
[0065] Figure 8 It is a schematic diagram of the process of another container configuration method provided by the present application;
[0066] Figure 9 It is a schematic diagram of the process of another container configuration method provided by the present application;
[0067] Figure 10 It is a schematic diagram of the process of another container configuration method provided by the present application;
[0068] Figure 11 It is a schematic diagram of a unique identifier allocation process provided by the present application;
[0069] Figure 12 It is a schematic diagram of another unique identifier allocation process provided by the present application;
[0070] Figure 13A schematic diagram of a container recycling process provided by this application;
[0071] Figure 14 A schematic diagram of a process of another container configuration method provided by this application;
[0072] Figure 15 A schematic diagram of another container recycling process provided by this application;
[0073] Figure 16 A schematic diagram of a container creation process provided by this application;
[0074] Figure 17 A schematic diagram of the structure of a container configuration device provided by this application;
[0075] Figure 18 A schematic diagram of the structure of another container configuration device provided by this application;
[0076] Figure 19 A schematic diagram of the structure of another container configuration device provided by this application;
[0077] Figure 20 A schematic diagram of the structure of a computing device provided by this application;
[0078] Figure 21 A schematic diagram of the structure of a computing device cluster provided by this application;
[0079] Figure 22 A schematic diagram of the structure of another computing device cluster provided by this application. Detailed implementation manners
[0080] Next, the technical solutions in the embodiments of this application will be described with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the protection scope of this application.
[0081] The method provided by this application can be applied to various scenarios, such as system architectures that can perform service orchestration, such as cloud servers, server clusters, World Wide Web (web) services, or big data processing centers.
[0082] For ease of understanding, some terms related to this application will be explained first.
[0083] First, some virtualization technologies related to containers will be introduced.
[0084] (1) Container
[0085] A lightweight virtualization technology that can package an application and its dependencies into a portable container for running in different environments.
[0086] Container technology (Linux container) was initially used on the Linux operating system. In the Linux operating system, container technology is an isolation technology. Different services are encapsulated in corresponding containers through container technology, and then combined with some scripts to make these containers cooperate with each other as required. All containers share the same operating system kernel. Each container can separately limit the CPU, memory, hard disk, and network bandwidth capacity, and has an independent IP address and operating system administrator account. A container is a standard software unit that packages code and all its dependencies, so that an application can be quickly and reliably migrated from one computing environment to another. The most important value of container technology is to provide a lightweight and consistent format for application services running on different hosts; the standardization of the container format can speed up the delivery experience, allowing users to conveniently migrate workloads and avoid being limited to a single platform provider; using containers, hundreds or thousands of applications can be deployed in a short time to ensure that user applications are quickly launched; containers can simplify the configuration process, and the running environment of user applications can be directly packaged into the container and directly started when in use.
[0087] (2) Stateful POD: A type of container that stores some state information internally and still needs to read this state information to resume services after restart.
[0088] (3) Stateless POD: It does not store any state information internally, so it can be replaced, extended, scaled down, etc. at will. The containers mentioned below in this application can include stateless containers, so external storage space needs to be allocated for stateless containers to store data such as call records or log files generated during the operation of stateless containers.
[0089] Next, some terms related to k8s are introduced.
[0090] (4) K8S (kubernetes): An open-source container orchestration framework. It can be responsible for the deployment, elasticity, and management of applications, and the deployment, elasticity, management, etc. provided for applications are implemented based on containers. The embodiments of this application can be applied to K8s or other clusters of containerized applications.
[0091] For example, the architecture of K8S can be as Figure 1 shown Figure 1The following is a schematic diagram of the Kubernetes architecture, which includes a Master (main, or master node, control node) and a Node (node, or computing node, working node). The Master is the control node of the cluster and consists of four components: an application programming interface (API) server (which can be called the K8S API Server), a Scheduler, a Controller Manager, and ETCD. Among them, ETCD is a distributed data storage component, also known as the ETCD database, which is responsible for storing the configuration information of the cluster.
[0092] A Node is a computing node of the cluster, including nodes that run containerized applications. The business load of an application runs on a Node in the form of a Pod, and one or more containers can run in a Pod. Among them, the business load can be regarded as a functional unit of the application, which is used to implement one or more services.
[0093] In addition, a node on which a container is deployed can also be called the host of the container.
[0094] In some embodiments of the present application, an application deployed in a container cluster is called a containerized application. It should be understood that the present application is described with a K8s container cluster, but it does not limit that the embodiments of the present application must be used in a K8s container cluster. For example, the embodiments of the present application can also be used in container clusters with other architectures. Again, the embodiments of the present application can also be used to manage applications deployed in clusters of other computing instances (including virtual machines, containers, or bare metal servers, etc.). For example, the applications in the embodiments of the present application can be deployed in a cluster containing multiple virtual machines.
[0095] (5) POD (or called pod): It is the smallest deployable unit scheduled by K8S; it is a combination of multiple containers (Containers). Containers within the same POD share network and storage resources and run on the same host. One or more containers are encapsulated in a Pod. The creation of a Pod is achieved through the APIServer, and after the Pod is created, it needs to be scheduled to a certain Node by the Master to run.
[0096] (6) Deployment (or called deployment) is a service encapsulation of a Pod. A Deployment can contain one or more Pods. The roles of the Pods included in a Deployment are usually the same, so the system will automatically distribute requests to multiple Pods of the Deployment.
[0097] (7) Webhook: When a specific event occurs, one application can send an HTTP request to another application to trigger specific actions or transfer data. Webhooks are commonly used to implement real-time updates, automate processes, and integrate interactions between different applications.
[0098] (8) Controller: In a Kubernetes cluster, each controller is responsible for managing the lifecycle of a specific type of object. For example, the Pod Controller is responsible for managing the lifecycle of Pods, including creating, starting, scaling, or deleting Pods, etc.
[0099] The method provided in this application can be implemented based on the extension mechanism of K8S. For example, the request processing flow of K8S can be as Figure 2 shown. Its processing flow can be divided into API Handler, authentication / authorization, mutating admission controllers, object schema validation, validating admission controllers, or persistent storage (ETCD), etc. In the parts of mutating admission controllers and validating admission controllers, an external extension mechanism can be provided through the webhook method.
[0100] API Handler is mainly responsible for providing services and receiving requests.
[0101] Authentication / authorization can be used for authentication processing. If the request authentication fails, the request will be rejected and a 401 error code will be returned; if the authentication is successful, it will proceed to the authorization part.
[0102] Mutating admission controllers refer to admission controllers that can be used for change operations. The method provided in this application can be implemented by providing a webhook callback interface (Mutating Admission WebHooks) externally through mutating admission controllers. When a Pod is created or modified, K8S will send the configuration of the Pod to Mutating Admission WebHooks, and WebHooks will modify the configuration of the Pod and then return the modified configuration to K8S. K8S will use the modified configuration to create or update the Pod.
[0103] Object schema validation validates the data type of resource objects.
[0104] Validation admission controller, which executes the admission controller available for validation operations. The validation admission controller can also provide a webhook callback interface (i.e., validating admission webhooks).
[0105] ETCD, which can achieve persistent storage of resources.
[0106] (9) REST API (Representational State Transfer API): REST (Representational State Transfer) is a design style for network application programming interfaces (APIs) based on the HTTP protocol. A RESTful API is an API that conforms to the REST principles and uses methods such as GET, POST, PUT, DELETE in the HTTP protocol to perform operations on resources.
[0107] Next, introduce some terms related to storage.
[0108] (10) Volume
[0109] Kubernetes storage is managed by volumes (Volume). A Volume can declare the storage resources that can be accessed. A volume can be mounted in a Pod or at a specified path in one or more containers. Volumes can be divided into two categories: local disk storage and cloud storage (or network storage).
[0110] Local disk storage can include an empty directory (emptyDir), or a host address (HostPath), a configuration file (ConfigMap), a security-related file (Secret), etc. Among them, emptyDir is a storage type mainly used for temporary storage. Its lifecycle is the same as that of the Pod. When the Pod is deleted, the data of the Volume is also deleted at the same time. The emptyDir type of Volume is an empty directory after being mounted, and the container or Pod reads and writes files in the emptyDir.
[0111] A Volume can specifically include a persistent volume (pesistence volume, PV), and a PV can be accessed through a persistent volume claim (Pesistence Volume Claim, PVC). Usually, in order to persistently store the data generated during the container operation, K8S provides a directory on the host to the container through the PVC mechanism. The StorageProvisioner is a background program responsible for dynamically creating PVs, and PVs can be created through the StorageProvisioner.
[0112] Kubernetes abstracts PV and PVC to define and use storage resources, enabling users to be oblivious to the specific infrastructure. When storage resources are needed, simply declare the amount required, just like with CPU and memory. PV belongs to cluster-level resources. PVC is a declaration of storage resources, and it needs to describe the attributes of the requested storage resources, such as storage size, read / write permissions, etc. As Figure 3 shown, the storage space provided by PV is supplied by storage devices. When storage resources are to be used, only create a PVC and associate it with the PVC in the Pod. Since there is a one-to-one binding relationship between PVC and PV, the Pod can use the storage space provided by PV through the PVC. And during the process of deploying the storage plugin, it is necessary to register a StorageClass.
[0113] For example, the code for registering a StorageClass can be expressed as:
[0114]
[0115]
[0116] That is, a StorageClass named block-service is declared, and the corresponding provisioner is kubernetes.io / gce-pd, which is the name of a built-in GCE PD storage plugin in K8S.
[0117] During the process of creating a PVC, first, the user (which can be VolumeHook in this application) submits a request to create a PVC to K8S.
[0118] For example, the code for the PVC creation request can be expressed as:
[0119]
[0120] That is, in this PVC declaration, a storage volume of 30GB is requested to be created, and the corresponding storageClass name is block-service.
[0121] Subsequently, K8S binds the newly created PV to the PVC.
[0122] It can be expressed as:
[0123]
[0124] Subsequently, the POD uses the PVC to obtain the storage volume, which can be expressed as:
[0125]
[0126]
[0127] In the above POD declaration, the PVC: claim1 created above is used to persistently store the html file, and there is a one-to-one correspondence between a storage volume in the POD and the PVC.
[0128] In addition, some terms that may be involved are also explained.
[0129] (11) Web application
[0130] A Web application refers to an application that can be accessed via a browser using the hyper text transfer protocol (HTTP), such as various websites, internal IT systems, etc.
[0131] (12) Helm: Helm is a Kubernetes package manager that allows you to easily create, share, and install Kubernetes applications. Helm uses predefined templates called "charts" to describe the deployment and configuration of Kubernetes applications. A chart contains all the components and dependencies of the application, as well as the relationships between them. With Helm, you can easily install, upgrade, and uninstall Kubernetes applications without manually managing their dependencies and configurations. Helm also provides some other features, such as version control, rollback, and release management, making the management of Kubernetes applications simpler and more reliable.
[0132] (13) Cloud service
[0133] Services such as elastic computing, virtual network, data storage, and database that are provided based on the Internet in the form of a representational state transfer application programming interface (REST API) and meet the requirements of enterprise Internet technology (IT).
[0134] Among them, cloud services can include, for example, but are not limited to, services provided by virtual private clouds (VPCs), gateway services, firewall services, NAT services, cloud disks, elastic IP addresses (EIPs), cloud monitoring services, and various other cloud services provided by cloud providers. Cloud instances can include, for example, but are not limited to, virtual machines, containers, or bare-metal servers, etc. Among them, virtual machines, containers, or bare-metal servers are all virtual instances provided by cloud providers to tenants in the cloud providers' data centers.
[0135] When deploying a POD cluster using k8s, a Deployment controller is usually used to control a stateless container cluster. For example, in some existing solutions, if the Deployment responsible for controlling stateless containers uses the feature of the StatefulSet (the controller of the stateful container cluster) to maintain the fixed name of the POD, once the POD restarts, the original PVC cannot be reused, but a new PVC is created, which will cause waste of resources. And in some scenarios, stateless containers also need to use PVCs to apply for storage space to persistently store data generated during operation, such as call records, log files, etc.; for this requirement, Deployment has no effective solution.
[0136] Therefore, the present application provides a container configuration method that automatically allocates PVCs for a stateless container cluster to meet the requirement of stateless containers using PVCs to store data. It can also implement the function of recovering data in the idle PVs generated after the Deployment is scaled down.
[0137] The network elements or entities involved in the method provided by the present application can be divided into service network elements, API servers, and file systems, etc. As Figure 4 shown, the service network element executes the method provided by the present application. The service network element registers an interface in the API server in advance. The API server can enable the service provided by the service network element by calling this interface. The file system can be used to provide storage space for the created containers. The service network element can specifically be the Figure 1 computing node mentioned above. The API server can specifically be the API server in the control node mentioned above. The file system can be a file system connected to the control node or the file system of the host where the container needs to be deployed. Figure 1
[0138] Next, the method flow provided by the present application will be introduced in combination with the foregoing architecture.
[0139] First, the present application provides a container configuration method that can be deployed in a service network element. Next, the steps executed by the service network element will be introduced.
[0140] Refer to Figure 5 , which is a schematic flowchart of a container configuration method provided by this application.
[0141] 501. Obtain a callback request.
[0142] This callback request can be used to indicate the configuration of a container cluster, which can include one or more containers and can be implemented through one or more deployment units. Information about one or more deployment units to be created can be carried in this callback request, such as, but not limited to, the version number, name, type, etc. of the deployment unit to be created.
[0143] This container cluster can be understood as a stateless container cluster, that is, a container without its own storage space. However, stateless containers also generate data during operation, so storage space can also be allocated for stateless containers for data storage.
[0144] This deployment unit can be understood as a deployable unit in the container orchestration system architecture. For example, it can be the smallest deployable unit or a unit composed of the smallest deployable units in the container orchestration system. In different container orchestration systems, the smallest schedulable deployment unit may also be different. For example, in this application embodiment, taking the K8S system architecture as an example for exemplary introduction, the corresponding smallest deployable unit is a POD.
[0145] In different container orchestration system architectures, this callback request can be initiated by the corresponding network element that needs to configure the container, or can be generated by the service network element based on its own needs. For example, taking the API server as the K8S API server as an example, the service network element can pre-register an API with the K8S API server to provide container configuration services for the K8S API server. The K8S API server can call this interface from the server network element through this API to implement container configuration.
[0146] 502. Obtain information about at least one deployment unit according to the callback request.
[0147] After obtaining the callback request, obtain information about the one or more deployment units based on this callback request, such as the instance to which the deployment unit belongs or the unique identifier assigned to the deployment unit.
[0148] In a possible implementation, information about the instances to which at least one deployment unit belongs is obtained, such as instance name, type, or version, etc.; subsequently, based on the information about the instances to which at least one deployment unit belongs, a unique identifier can be assigned to at least one deployment unit, and the information of at least one deployment unit includes the unique identifier of each deployment unit. Therefore, the information of each deployment unit can be determined by querying the information of the instance to which the deployment unit belongs, such as the number of deployment units, the type of the belonging instance, etc., so as to assign a unique identifier to each deployment unit.
[0149] Optionally, the number of at least one deployment unit is determined according to the information about the instances to which at least one deployment unit belongs; a unique identifier is assigned to each deployment unit according to the number of at least one deployment unit. For example, the number of unique identifiers to be assigned can be determined according to the number of deployment units, and then the unique identifiers can be assigned according to this number through a preset algorithm. Specifically, a random algorithm, sequential numbering, selecting an identifier from a mapping list, or other algorithms can be used. Specifically, an appropriate algorithm can be selected according to the actual application scenario, which is not limited here.
[0150] In different systems, the deployment unit can be different deployable units. For example, in K8S, the deployment unit in this application can be a POD.
[0151] 503. Obtain the storage information corresponding to at least one deployment unit.
[0152] After determining the information of at least one deployment unit, the storage information corresponding to the at least one deployment unit can be determined. This storage information can be used to read the corresponding storage space. For example, the storage information can specifically include information such as the address, identifier, or declaration of the storage space, so as to facilitate reading the corresponding storage space.
[0153] For example, after assigning a unique identifier to each deployment unit, a corresponding storage space can be assigned to each unique identifier. And storage information for accessing this storage space is generated, so that during subsequent container runtime, data processing operations such as data access, reading, writing, or deleting can be performed based on this storage information. It is equivalent to binding the mapping relationship between the storage information and the unique identifier of the deployment unit. Even if the deployed container is restarted later, the storage space will not be lost, which can adapt to various scenarios and improve the stability of container operation.
[0154] Optionally, the storage space can include PV in the file system available to the host of the container cluster to be deployed, so that the PV that can stably store data can be used to replace the temporary storage space.
[0155] In a possible implementation, if the file system includes PVs, the corresponding storage information may include PVCs. A mapping relationship between the unique identifier of the deployment unit and the PVC can be constructed, that is, the relationship between the unique identifier of the deployment unit and the PVC is bound through this mapping relationship. When the container is restarted or the PVC is queried, the unique identifier can be used to determine the PVC corresponding to the unique identifier based on this mapping relationship.
[0156] 504. Respond to the callback request and feedback the storage information.
[0157] After the storage information is generated, it can be responded to based on the callback request to feedback the storage information of the at least one deployment unit. Subsequently, the storage space corresponding to the storage information can be mounted in the created deployment unit. Thus, when the container is running, it can run based on the allocated storage space.
[0158] Therefore, in the embodiments of the present application, for stateless containers, a bound storage space can be allocated so that the container can use the allocated storage space to store data when running. Even if the container is restarted, it can continue to use the allocated storage space to store data, which can adapt to the scenario of container restart.
[0159] In addition, in some possible scenarios, the deployment unit may be recycled, such as container downscaling, restart, or other scenarios. In this scenario, the unique identifier of the deployment unit can be recycled. When creating a new deployment unit subsequently, the recycled unique identifier can be reused to allocate a unique identifier for the new deployment unit, thereby improving the utilization rate of the identifier.
[0160] For example, the unique identifier of at least one unused deployment unit can be obtained. If the at least one unused deployment unit meets the preset recycling conditions, the at least one deployment unit is recycled, and the unique identifier of each recycled deployment unit is used as the unique identifier of the new deployment unit when creating the deployment unit. Therefore, the embodiments of the present application can realize the recycling and utilization of the unique identifier of the deployment unit and improve the resource utilization rate.
[0161] Optionally, the recycling conditions may specifically include but are not limited to: the identifier of the deployment unit is added to the first list in N consecutive scan cycles, and the first list includes information of the created but unused deployment units, where N is a positive integer, or the number of replicas of the deployment controller exceeds the preset number, and the deployment controller can be used to configure the deployment unit when creating the deployment unit. Therefore, when the idle period of the identifier of the deployment unit exceeds N cycles or the number of created deployment controllers is too large, that is, in cases where resources are idle or resource consumption is excessive, the unique identifier of the deployment unit can be recycled to improve the resource utilization rate.
[0162] Specifically, when recycling a deployment unit, a recycling container can be created. Subsequently, the data in the storage space corresponding to the at least one unused deployment unit can be migrated to a preset directory through the recycling container. The preset directory can be a directory in the storage space for backup, or a new storage space mounted for the recycling container, etc. Therefore, when recycling a deployment unit, the data of the container can be transferred by creating a container, thus avoiding data loss after the container is recycled.
[0163] This application also provides a container configuration method. This method can be implemented independently or in combination with the Figure 5 corresponding method. Specifically, the implementation method can be determined according to the application scenario. Next, another container configuration method provided by this application will be introduced.
[0164] Refer to Figure 6 , the flowchart of another container configuration method provided by this application is as follows.
[0165] 601. Obtain a deletion instruction for instructing to delete a deployment unit.
[0166] This deletion instruction can be sent by the API server or generated by the service network element based on requirements.
[0167] This deletion instruction can be used to instruct to delete one or more deployment units, or to terminate the operation of the one or more deployment units. Information about the deployment unit to be deleted, such as the unique identifier, name, version number, or corresponding container information of the deployment unit, can be carried in the deletion instruction.
[0168] 602. Recycle the information of each deployment unit, and the recycled information of the deployment unit can be reused.
[0169] After obtaining the deletion instruction, the information of the deployment unit to be deleted can be recycled, and the recycled information of the deployment unit can be used when creating a new deployment unit later.
[0170] For example, if each deployment unit has a corresponding unique identifier, the unique identifier can be recycled. When creating a new deployment unit, the recycled unique identifier can be used as the unique identifier of the new deployment unit.
[0171] Specifically, the process of creating a new deployment unit can refer to the Figure 5 corresponding steps, which will not be elaborated here.
[0172] Therefore, in the implementation manner of this application, each deployment unit has corresponding information, such as a unique identifier. When the deployment unit is deleted, this information can be reused, thus avoiding resource waste caused by the deletion or restart of the deployment unit and improving resource utilization.
[0173] The method provided in this application can be deployed in the aforementioned service network element. The API server can implement container configuration by means of calling through input parameters. The process of the container configuration method provided in this application will be further introduced below in combination with the interaction process between the API server and the service network element.
[0174] Refer to Figure 7 The schematic diagram of the process of another container configuration method provided in this application is as follows.
[0175] 701. The API server receives a container creation request.
[0176] This container creation request can be generated by the API server according to requirements, or can be a request received through a deployment tool. This container creation request can be used to request the creation of a container cluster, which can include one or more containers. Information such as the name, version, or type of the container cluster to be created can be carried in this container creation request.
[0177] 702. The API server obtains information about at least one deployment unit to be deployed.
[0178] After the API service obtains the container creation request, it can decompose this container creation request into requests for creating one or more deployment units, and thus obtain information about one or more deployment units. For example, information such as the type, name, version, or required storage space size of one or more deployment units.
[0179] 703. The API server sends a callback request to the service network element.
[0180] Subsequently, the API server can send a callback request to the service network element through the interface pre-registered by the service network element, and carry information about the deployment unit to be deployed (or referred to as to be configured or to be created, etc.) in this callback request, such as name, the number of deployment units, version number, or required storage space size, etc.
[0181] 704. The service network element configures at least one container.
[0182] After the service network element receives the callback request, it can configure this container cluster based on this callback request.
[0183] For example, it can obtain information about at least one deployment unit according to the callback request, such as assigning a unique identifier to each deployment unit; and obtain storage information corresponding to at least one deployment unit. For example, it can allocate the required storage space size for the container cluster and generate storage information for accessing this storage space.
[0184] Specifically, the steps executed by the service network element can refer to the foregoingFigure 5 or Figure 6 The steps in are not elaborated here.
[0185] 705. The service network element feeds back a callback response to the API server.
[0186] After the service network element completes the configuration of the container cluster, it can feed back a callback response to the API server. The callback response can carry the storage information of the storage space allocated for the container cluster, and can also carry the unique identifier assigned to each deployment unit.
[0187] 706. The API server mounts the storage space in at least one deployment unit to be deployed for storing data of at least one container.
[0188] After receiving the callback response, the API server can read the storage information carried in the callback response and mount the allocated storage information in each deployment unit. Thus, when each deployment unit runs a container, it can read the storage space corresponding to the storage information to save the data generated by the container running in the storage space.
[0189] In the implementation manner of this application, storage information is bound to each deployment unit, so that the data generated by the container running can be saved in the corresponding storage space. Even if the container is restarted, the information saved in the storage space can be read through the bound storage information, avoiding data loss.
[0190] Correspondingly, when it is necessary to recycle or delete a deployment unit, the API server can notify the service network element to make the service network element recycle the unique identifier already assigned to the deployment unit, and when a new deployment unit needs to be created, the recycled unique identifier can be reused to assign a unique identifier to the new deployment unit.
[0191] Such as Figure 8 shown, the flowchart of another container configuration method provided by this application is described as follows.
[0192] 801. The API server sends a deletion instruction to the service network element.
[0193] The API can generate a deletion instruction according to requirements, or can also generate the deletion instruction under the trigger of other external tools. The deletion instruction can be used to instruct the service network element to delete the information related to the deployment unit, and can carry the information of the deployment unit to be deleted, such as the unique identifier, name, instance type or version number of the deployment unit.
[0194] 802. The service network element recycles the unique identifier in at least one deployment unit to be deleted.
[0195] After the service network element obtains the deletion instruction, it can recycle the information of one or more deployment units to be deleted. For example, it can recycle the unique identifier of each deployment unit and the storage information allocated for each deployment unit, etc.
[0196] For example, the service network element can put the unique identifier of the deployment unit to be deleted back into the available resource pool, or delete the unique identifier and the corresponding storage information in the mapping relationship between the unique identifier and the storage information maintained by the service network element, etc.
[0197] 803. The service network element feeds back to the API server.
[0198] After the service network element recycles the unique identifier of the deployment unit, it can feed back an indication of successful deletion to the API server. Of course, the service network element can also not feed back to the API server, that is, step 803 is an optional step, and it can be determined whether to execute step 803 according to the actual application scenario.
[0199] 804. The API server sends a new callback request to the service network element.
[0200] When a new container cluster needs to be created, the API can call the service network element again for container configuration, that is, it can send a callback request to the service network element again to instruct the service network element to configure the new container cluster.
[0201] 805. The service network element reuses the unique identifier to assign a unique identifier to the new deployment unit.
[0202] After receiving the new callback request, the service network element can assign a unique identifier to the new deployment unit. When assigning a unique identifier to the new deployment unit, the recycled unique identifier can be used as the unique identifier of the new deployment unit, so as to realize the reuse of resources.
[0203] 806. The service network element feeds back a callback response to the API server.
[0204] Among them, for steps 804 to 806, reference can be specifically made to the descriptions of steps 501 to 504 Figure 5 above, which will not be elaborated here.
[0205] Therefore, in the embodiment of the present application, the service network element can recycle and reuse the unique identifier of the deployment unit, thereby improving the resource utilization rate.
[0206] The above introduces the method flow provided by the present application. For the convenience of understanding, the method provided by the present application will be introduced in more detail below in combination with specific application scenarios.
[0207] In some possible scenarios, the method provided in this application can be applied to the K8S container orchestration system architecture. The method provided in this application can be deployed in a service network element. For example, the function provided in this application can be called VolumeHook. An interface can be registered in the K8S API server in advance. When container configuration is required, this interface can be called to execute the method provided in this application for container configuration. Generally, the deployment unit of K8S can be a POD, and a POD can be used to implement one or more containers. The storage space for storing the data generated by the container operation can be provided by the host of the container or the storage space in other external file systems. For example, the host can provide the directory of the available file system in advance. When allocating the storage space subsequently, available PVs can be allocated to the POD, and the corresponding PVCs can be mounted in the POD. It can also be that an external file system is deployed in advance and the corresponding directory is generated. When allocating the storage space subsequently, available PVs can be allocated to the POD, and the corresponding PVCs can be mounted in the POD.
[0208] The method provided in this application can be divided into steps in multiple parts. For example, it can be divided into creating a POD or recycling PVCs, etc. For ease of understanding, the steps of each part will be introduced separately below. It should be noted that the different embodiments mentioned below can be combined or implemented independently, which can be determined according to the actual application scenario. This application does not make any limitations in this regard.
[0209] I. Creating a POD
[0210] For example, the interaction process between the K8S API server and VolumeHook when creating a POD is as Figure 9 shown. Another representation of this interaction process can be as Figure 10 shown.
[0211] 901. Register the callback interface for creating POD resources: VolumeHook.
[0212] First, it is necessary to deploy the VolumeHook container with the Deployment API (the interface for deploying applications). The VolumeHook container exposes a REST API interface, which can be expressed as: / mutate interface. After the VolumeHook container is deployed, this interface is registered with the K8S API Server (K8S API server) through the MutatingWebhookConfiguration API (the API for configuration) so that the K8S API Server can call VolumeHook by calling the API.
[0213] For example, the code for registering the API and the corresponding comments can be expressed as:
[0214]
[0215] 902. The K8S API server receives a request to create a POD.
[0216] After registration, when the K8S API Server receives a CREAT POD (create POD) request, it can call the / mutate interface of the VolumeHook container to configure the container.
[0217] Generally, tools for deploying containers, such as the kubectl or Helm tools, can be used to send a Deployment request to create a stateless container cluster to the K8S APIServer, carrying the number of PODs to be created.
[0218] For example, as Figure 10 shown, the request to create a POD can be expressed as:
[0219] Charging POD resources / / Requesting POD resources
[0220] spec:
[0221]
[0222] That is, when requesting to create a POD, the volume for storing data in the creation request is a temporary volume, i.e., a temporary storage space. To improve the data storage stability of the container, in the subsequent process of this application, a stable storage space, i.e., a PV, can be allocated for it.
[0223] 903. The K8S API server calls the matation interface.
[0224] The K8S API Server can further break down the request to create a Deployment into multiple requests to create POD resources. At this time, according to the registration content of the above MutatingWebhookConfiguration, it calls the / mutate interface of the VolumeHook container and carries the content of the POD resources to be created in the request body.
[0225] 904. VolumeHook assigns a unique identifier podid to the POD and generates a PVC for each podid.
[0226] After receiving the / mutate request, the VolumeHook container can assign a unique identifier podid to the POD and generate a PVC for each podid.
[0227] Specifically, VolumeHook can be executed in the following steps:
[0228] 1. Find the Deployment instance to which the POD to be created belongs
[0229] Specifically, the ownerReferences field on the POD can be read (used to represent the manager of the POD). Its code and comments can be expressed as follows:
[0230]
[0231] Subsequently, based on the name of the ReplicaSet, the belonging Deployment can be further found. Its code and comments can be expressed as follows:
[0232]
[0233] The information of the instance to which the POD belongs can be queried, such as the instance type or instance name, etc.
[0234] 2. Assign a unique id (i.e., podid) to the PODs under the Deployment instance
[0235] From the Deployment instance obtained in the previous step, the number of replicas of the POD can be obtained; a non-repeating random string is generated for each POD instance as the unique ID; and these IDs are saved on the Deployment-level Label. Multiple IDs can be separated by commas, such as expressed as: volumehook / all-pod-ids:5ff54,f4dbf.
[0236] Generally, to prevent sequence chaos caused by concurrency, when modifying volumehook / all-pod-ids on the Deployment, it can be locked to ensure that only one thread modifies it at the same time, and the lock is released after the modification is completed.
[0237] In addition, this podid can also be saved on the POD-level Label, such as expressed as: volumehook / pod-id:5ff54.
[0238] For example, the relationship between each Deployment instance after assigning podid can be expressed as Figure 11 shown.
[0239] That is, the Deployment can be expressed as:
[0240]
[0241] The instance copies below can be respectively represented as:
[0242] Copy 1:
[0243]
[0244] Copy 2: apiVersion: apps / v1 / / Version
[0245]
[0246] The PVC corresponding to Copy 1 can be represented as:
[0247]
[0248] The PCV corresponding to Copy 2 can be represented as:
[0249]
[0250] Thus, the unique identification and PVC are completed for each POD copy.
[0251] 3. Generate a PVC for podid and assign it to the POD
[0252] According to the podid assigned to the POD in the previous step, further create a PVC. For example, the naming format of the PVC is: <volume name>- <podid>, where the "volume name" can come from pod-level specific labels, for example: volumehook / to-pv-volumes:cdrpv|5Gi. This label indicates that a PVC with a size of 5Gi needs to be allocated for the volume named "cdrpv" in the POD.
[0253] For example, the code and comments of the allocated PVC can be expressed as:
[0254]
[0255] For example, the allocated POD and PVC can be expressed as follows Figure 12 as shown.
[0256] For example, POD replica 1 can be expressed as:
[0257]
[0258] The corresponding PVC can be expressed as:
[0259]
[0260] For example, POD replica 2 can be expressed as
[0261]
[0262] The corresponding PCV can be expressed as:
[0263]
[0264] Therefore, the mapping relationship between the POD and the PV can be established by binding the podid and the PVC, so that the container can have a stable PV to store data even after restarting.
[0265] 905. VolumeHook sends a callback response to the K8S API server.
[0266] After VolumeHook completes the allocation of the podid and the PVC, the allocated data can be returned to the K8S APIServer.
[0267] Usually, in step 902, the initial information of the POD to be created is carried in the creation request. Therefore, when VolumeHook returns the response, the returned data can be returned to the K8S API Server in the form of the changed content of the modified Volume.
[0268] 906. The K8S API server mounts the corresponding PVC in the POD.
[0269] After the podid and PVC are allocated for the POD by calling Volume, the K8S API Server can mount the allocated PVC in the POD.
[0270] For example, the Volumehook change content is returned to the K8S API Server in the format of JSONPatch. The K8S API Server applies the JsonPatch modification to the original content of the POD to obtain the modified POD resource, and then the creation of the POD can be completed.
[0271] As Figure 10 shown, the modified POD resource can be expressed as:
[0272] Charging POD resource / / Request POD resource
[0273] spec:
[0274]
[0275] That is, the temporary storage resource is replaced with the PVC of the stable PV.
[0276] In the implementation manner of this application, the MutatingWebHook method is used to modify the Volume definition of the POD, which enhances the native K8S Deployment ability; the modification of the original Deployment design package is non-invasive, that is, only several Labels are added to protect the existing software assets.
[0277] Generally, in the existing solutions, stateless containers store persistent data, usually directly saved on the host in the hostpath manner, which requires an external disk to be mounted on the host in advance; this leads to an increased dependence of the stateless container auto-scaling and drifting characteristics on the host. However, by configuring the container through the method provided in this application, the stateless container can use the PV to store data and get rid of the dependence on the host.
[0278] II. Recycling PVC (or it can also be called PV recycling, podid recycling, etc.)
[0279] Generally, during the operation of the stateless container cluster deployment, due to factors such as scale-down, upgrade, and host, the containers in the cluster will be rebuilt. Therefore, in the embodiments of this application, for the rebuilt containers, the existing PVCs need to be reused as much as possible to avoid waste of PV space. For example, the effect of reusing the PVC after reconstruction can be as Figure 13 shown. After the POD is rebuilt, its corresponding PVC resource can also be reused.
[0280] As Figure 13 In the steps shown, CBSVolumeHook (a container for monitoring POD events) discovers an orphaned PV based on the fields on the PVC. For example, it can monitor the event of a Deployment scaling down. After discovering an idle PV, it can feedback to the K8S APIServer. After determining that PV recycling is required, CBSVolumeHook creates a recycling iob container (which can be called recyclejob for example) and mounts the orphaned PV.
[0281] For example, the created recyclejob can be expressed as:
[0282]
[0283] Subsequently, the recycling Job container transfers the content in the PV to the specified path on the NFS Server, and deletes the idle PVC after the transfer is successful.
[0284] In the embodiments of this application, in order to achieve PVC reuse, in addition to monitoring the creation events of PODs, VolumeHook also needs to monitor the deletion events of PODs. Therefore, VolumeHook also needs to expose a callback interface named ondelete and register it with the K8S API Server; the registration process is similar to the registration process of the above-mentioned "mutate" callback interface and will not be elaborated here.
[0285] In order to achieve Podid reuse, a Deployment-level label needs to be added to save the podid of the deleted POD, which can be expressed as: volumehook / standby-pod-ids:e4rt3,we397g.
[0286] For example, the process of recycling PVC can be as Figure 14 shown.
[0287] 1401. The K8S API Server receives a POD deletion instruction sent by an external tool.
[0288] In addition, the POD deletion instruction can also be generated by the K8S API Server according to requirements.
[0289] The external tool can specifically include container deployment tools such as kubectl or Helm tools, and the specific external tool can be determined according to the actual situation and is not limited here.
[0290] 1402. The K8S API Server calls the ondelete interface of VolumeHook.
[0291] After the K8S API Server receives a POD deletion event, it calls the ondelete interface of VolumeHook and transmits the content of the POD to be deleted as the request body to VolumeHook.
[0292] 1403. VolumeHook reclaims the podid.
[0293] VolumeHook puts the PODid to be deleted into the reclaim list. If VolumeHook obtains the content of the POD to be deleted in the ondelete interface request body, it can then obtain the value of the label: volumehook / pod-id from it as the PODid to be deleted. For example, the deleted podid can be as Figure 15 shown, write the PODid to be deleted into the deployment label: volumehook / standby-pod-ids list to which the pod belongs; delete the PODid to be deleted from the deployment label: volumehook / all-pod-ids list. Usually, the process of deleting the podid can lock the belonging deployment to avoid data chaos caused by concurrency.
[0294] In addition, in some scenarios, in addition to reclaiming the podid triggered by the K8S API Server, VolumeHook can also actively scan to determine whether to reclaim the podid and the corresponding PVC.
[0295] For example, a periodic task is started inside the volumehook container to scan the standby-pod-ids label on the Deployment every 5 minutes. If the podid meets the following conditions, it is considered that the corresponding pvc is in an idle state:
[0296] A certain podid has appeared in the standby-pod-ids for N consecutive cycles (such as 2 cycles), which means that this podid has not been reused for at least 10 minutes; or, the number of replicas of the Deployment is less than or equal to the number in the label all-pod-ids, which means that the number of podids in all-pod-ids is sufficient for use.
[0297] When recycling PVC, volumehook can call the k8s api to create a job container, which is called the recyclejob container. This job container will mount both the idle pvc and the shared directory of the remote NFS Server at the same time. Access the content of the pv corresponding to the pvc within the job container, and migrate all the files therein to the shared directory of the NFS Server, so as to achieve the recycling of PVC.
[0298] And generally, the PVC-PV mechanism is designed for use by PODs. The idle PVCs generated during downsizing do not have corresponding PODs, and it is relatively difficult to manually access and recycle the content therein. In the method provided in this application, the content in the idle PVC can be automatically recycled to the shared directory of a more open file system, which can facilitate subsequent maintenance operations.
[0299] 1404. VolumeHook returns a response to the K8S API Server.
[0300] After VolumeHook completes the recycling of podid, it can return a response to the K8S API Server without carrying the PVC. Of course, VolumeHook can also not return a response to the K8S API Server, that is, step 905 is an optional step.
[0301] 1405. The K8S API Server feedbacks the completion of deletion to the external tool.
[0302] The K8S API Server can feedback to the external tool that the pod deletion has been completed.
[0303] 1406. The external tool sends a create POD request to the K8S API Server.
[0304] When a new POD needs to be created, the external tool sends a new create POD request to the K8S API Server. This step is similar to the aforementioned step 902 and will not be elaborated here.
[0305] 1407. The K8S API Server calls the matation interface.
[0306] After the K8S API Server receives the create POD event, it calls the mutate interface of VolumeHook. This step can refer to the description of the aforementioned step 903 and will not be elaborated here.
[0307] 1408. VolumeHook reuses the podid.
[0308] The processing procedure of the mutate interface can refer to the aforementioned step 904 and will not be elaborated here. The difference is that when VolumeHook assigns a pod ID to a pod, an additional processing step is added: first, obtain the pod ID from the volumehook / standby-pod-ids label and assign it to the newly created pod; if Figure 16 as shown, when there is no available ID in this label, a new pod ID is created.
[0309] 1409. VolumeHook feeds back a callback response to the K8S API Server.
[0310] This step can refer to the aforementioned step 905 and will not be elaborated here.
[0311] 1410. The K8S API Server feeds back the completion of creation to the external tool.
[0312] After completing the POD configuration, the K8S API Server can feed back the completion of POD creation to the external tool.
[0313] Therefore, VolumeHook can recycle the pod ID and PVC, thereby completing the recycling of the content in the idle PVC.
[0314] The foregoing introduced the method flow provided by this application. Next, the device for executing the foregoing method provided by this application will be introduced.
[0315] Refer to Figure 17 , a schematic structural diagram of a container configuration device provided by this application. This container configuration device can specifically be used to execute the foregoing Figure 5 , Figure 7 , Figures 9 to 13 and other steps executed by service network elements.
[0316] This container configuration device includes:
[0317] A transceiver module 1701, configured to obtain a callback request, where the callback request is used to indicate the configuration of at least one container;
[0318] A processing module 1702, configured to obtain information of at least one deployment unit according to the callback request, where the at least one deployment unit is used to implement at least one container;
[0319] The processing module 1702 is further configured to obtain storage information corresponding to the at least one deployment unit;
[0320] The transceiver module 1701 is further configured to feedback storage information in response to a callback request. The storage information is used to create a storage space, and the storage space is used to store data of at least one container. The storage space includes a persistent volume PV in the file system.
[0321] In a possible implementation manner, the storage information has a mapping relationship with at least one deployment unit, and the mapping relationship is used to obtain the storage information corresponding to the at least one deployment unit when the at least one deployment unit is restarted.
[0322] In a possible implementation manner, the storage information includes a persistent volume claim PVC, and the information of at least one deployment unit includes the unique identifier of each deployment unit; the mapping relationship specifically includes the mapping relationship between the PVC and the unique identifier of each deployment unit.
[0323] In a possible implementation manner, the processing module 1702 is specifically configured to: obtain the information of the instance to which at least one deployment unit belongs; and assign a unique identifier to the at least one deployment unit according to the information of the instance to which the at least one deployment unit belongs. The information of the at least one deployment unit includes the unique identifier of each deployment unit.
[0324] In a possible implementation manner, the processing module 1702 is specifically configured to: determine the number of at least one deployment unit according to the information of the instance to which the at least one deployment unit belongs; and assign a unique identifier to each deployment unit according to the number of at least one deployment unit.
[0325] In a possible implementation manner, the processing module 1702 is further configured to: obtain the unique identifiers of at least one unused deployment unit; if the at least one unused deployment unit meets a preset recycling condition, recycle the at least one unused deployment unit, and the unique identifier of each recycled deployment unit is used as the unique identifier of a new deployment unit when creating a deployment unit.
[0326] In a possible implementation manner, the recycling condition includes one or more of the following: the identifier of the deployment unit is added to the first list in N consecutive scan cycles, and the first list includes information of created and unused deployment units, where N is a positive integer; or, the number of replicas of the deployment controller exceeds a preset number.
[0327] In a possible implementation manner, the processing module 1702 is further configured to: create a recycling container; and migrate the data of the storage space corresponding to the at least one unused deployment unit to a preset directory through the recycling container.
[0328] See Figure 18 For the structural schematic diagram of another container configuration device provided in this application, this container configuration device can be used to execute the foregoing Figures 5 to 16 Steps executed by the API server in the corresponding method flow.
[0329] The container configuration device may include:
[0330] A transceiver module 1801, configured to obtain information of at least one deployment unit to be deployed, where the at least one deployment unit is used to implement at least one container;
[0331] The transceiver module 1801 is further configured to send a callback request, where the callback request is used to indicate to configure at least one container;
[0332] The transceiver module 1801 is further configured to obtain a callback response for the callback request, where the callback response includes storage information, and the storage information is used to indicate a storage space;
[0333] A processing module 1802, configured to mount a storage space in at least one deployment unit to store data of at least one container, where the storage space includes a persistent volume PV in a file system, and the file system is used to provide a space for storing data.
[0334] In a possible implementation manner, the transceiver module 1801 is specifically configured to: obtain a container creation request, where the container creation request is used to request to create at least one deployment unit, and information of the at least one deployment unit is carried in the container creation request.
[0335] In a possible implementation manner, the transceiver module 1801 is specifically configured to: if at least one deployment unit is restarted, obtain information of the restarted at least one deployment unit.
[0336] See Figure 19 , a schematic structural diagram of another container configuration device provided in this application, where the container configuration device may be used to execute the steps executed by the API server in the foregoing Figure 6 , Figure 8 , Figures 9 to 13 Steps executed by the API server in the corresponding method flow.
[0337] The container configuration device may specifically include:
[0338] A transceiver module 1901, configured to obtain a deletion instruction, where the deletion instruction is used to indicate to delete at least one deployment unit, and the at least one deployment unit is used to implement at least one container;
[0339] A processing module 1902, configured to recycle information of each deployment unit in at least one deployment unit, where the information of each deployment unit includes a unique identifier of each deployment unit, and the unique identifier of each recycled deployment unit is used as the unique identifier of a new deployment unit when creating a deployment unit.
[0340] In a possible implementation, the transceiver module 1901 is further configured to obtain a callback request before obtaining a deletion instruction, where the callback request is used to indicate the configuration of at least one container;
[0341] The processing module is further configured to obtain information about at least one deployment unit according to the callback request, where the at least one deployment unit is used to implement at least one container;
[0342] The processing module is further configured to obtain storage information corresponding to at least one deployment unit;
[0343] The transceiver module is further configured to feedback the storage information in response to the callback request to create at least one deployment unit, where the storage information is used to create a storage space, the storage space is used to store data of at least one container, the storage space includes a persistent volume PV in the file system, and the storage space is used to mount at least one container.
[0344] This application further provides a computing device 100. As Figure 20 shown, the computing device 100 includes: a bus 102, a processor 104, a memory 106, and a communication interface 108. The processor 104, the memory 106, and the communication interface 108 communicate with each other through the bus 102. The computing device 100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 100.
[0345] The bus 102 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 20 only one line is shown herein, but it does not mean that there is only one bus or one type of bus. The bus 102 can include a path for transmitting information between various components of the computing device 100 (for example, the memory 106, the processor 104, the communication interface 108).
[0346] The processor 104 can include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP), etc.
[0347] The memory 106 may include volatile memory, such as random access memory (RAM). The processor 104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0348] The executable program code is stored in the memory 106, and the processor 104 executes the executable program code to respectively implement the functions of the transceiver module and the processing module mentioned above Figures 17 to 19 so as to implement the container configuration method. That is, instructions for executing the container configuration method are stored on the memory 106.
[0349] The communication interface 108 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement the communication between the computing device 100 and other devices or communication networks.
[0350] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0351] As Figure 21 shown, the computing device cluster includes at least one computing device 100. Instructions for executing the container configuration method may be stored in the memory 106 of one or more of the computing devices 100 in the computing device cluster.
[0352] In some possible implementation manners, partial instructions for executing the container configuration method may also be stored in the memory 106 of one or more of the computing devices 100 in the computing device cluster. In other words, the combination of one or more computing devices 100 may jointly execute the instructions for executing the container configuration method.
[0353] It should be noted that the memories 106 in different computing devices 100 in the computing device cluster may store different instructions, which are respectively used to execute partial functions of the joint test device. That is, the instructions stored in the memories 106 of different computing devices 100 may implement the functions of one or more of the foregoing transceiver module or processing module.
[0354] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. Among them, the network can be a wide area network or a local area network, etc. Figure 22 shows a possible implementation. As Figure 22 shown, two computing devices 100A and 100B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device. In this type of possible implementation, the memory 106 in computing device 100A stores instructions for executing the functions of the transceiver module 1701(1901) and the processing module 1702(1902). At the same time, the memory 106 in computing device 100B stores instructions for executing the functions of the transceiver module 1801 and the processing module 1802.
[0355] It should be understood that Figure 22 the functions of computing device 100A shown in
[0356] can also be completed by multiple computing devices 100. Similarly, the functions of computing device 100B can also be completed by multiple computing devices 100. Figure 21 and Figure 22 the connection method of the computing device cluster. The difference is that the memory 106 in one or more computing devices 100 in this computing device cluster can store the same instructions for executing the container configuration method.
[0357] The embodiments of the present application also provide a computer program product containing instructions. The computer program product can be software or a program product containing instructions that can run on a computing device or be stored in any available medium. When the computer program product runs on at least one computing device, it causes at least one computing device to execute the container configuration method.
[0358] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computing device can store or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc. The computer-readable storage medium includes instructions that direct the computing device to execute the container configuration method.
[0359] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the various embodiments of the present invention.< / podid>
Claims
1. A container configuration method, characterized in that: include: Obtaining a callback request, where the callback request is used to instruct configuration of at least one container; Acquire information of at least one deployment unit according to the callback request, where the at least one deployment unit is used to implement the at least one container; Acquire storage information corresponding to the at least one deployment unit; The storage information is fed back in response to the callback request, where the storage information is used to create a storage space, where the storage space is used to store data of the at least one container, and where the storage space includes a persistent volume PV in a file system.
2. The method according to claim 1, characterized in that The storage information has a mapping relationship with the at least one deployment unit, and the mapping relationship is used to obtain the storage information corresponding to the at least one deployment unit when the at least one deployment unit is restarted.
3. The method according to claim 2, characterized in that The storage information includes a persistent volume declaration (PVC), and the information of the at least one deployment unit includes a unique identifier of each deployment unit; The mapping relationship specifically includes a mapping relationship between the PVC and the unique identifier of each deployment unit.
4. The method according to any one of claims 1 to 3, characterized in that The acquiring information of at least one deployment unit according to the container creation request includes: Acquire information of the instance to which the at least one deployment unit belongs; According to information of the instance to which the at least one deployment unit belongs, a unique identifier is allocated to the at least one deployment unit, and the information of the at least one deployment unit includes the unique identifier of each deployment unit.
5. The method according to claim 4, characterized in that The allocating a unique identifier to the at least one deployment unit according to the information of the instance to which the at least one deployment unit belongs includes: Determining the quantity of the at least one deployment unit according to information of the instance to which the at least one deployment unit belongs; A unique identifier is allocated to each deployment unit according to the quantity of the at least one deployment unit.
6. The method according to any one of claims 1 to 5, characterized in that The information of the at least one deployment unit includes a unique identifier of each deployment unit, and the method further includes: Obtain a unique identifier of at least one unused deployment unit; If the at least one unused deployment unit meets the preset recycling condition, the at least one unused deployment unit is recycled, and the unique identifier of each recycled deployment unit is used as the unique identifier of a new deployment unit when creating a deployment unit.
7. The method according to claim 6, characterized in that The recycling conditions include one or more of the following: The identification of the deployment unit is added to a first list in N consecutive scanning cycles, wherein the first list includes information of created but unused deployment units, where N is a positive integer; Or, the number of replicas of the deployment controller exceeds the preset number.
8. The method according to claim 6 or 7, characterized in that: The recycling of the at least one unused deployment unit comprises: Create recycling containers; The data in the storage space corresponding to the at least one first deployment unit is migrated to a preset directory through the recycling container.
9. A container configuration method, characterized in that: include: Obtaining information of at least one deployment unit to be deployed, where the at least one deployment unit is used to implement at least one container; Sending a callback request, where the callback request is used to instruct configuration of at least one container; Obtaining a callback response to the callback request, wherein the callback response includes storage information, and the storage information is used to indicate a storage space; The storage space is mounted in the at least one deployment unit for storing data of the at least one container, the storage space includes a persistent volume PV in a file system, and the file system is used to provide space for storing data.
10. The method according to claim 9, characterized in that The obtaining information of at least one deployment unit to be deployed includes: A container creation request is obtained, where the container creation request is used to request creation of the at least one deployment unit, and the container creation request carries information of the at least one deployment unit.
11. The method according to claim 9, characterized in that The obtaining information of at least one deployment unit to be deployed includes: If the at least one deployment unit is restarted, information of the at least one deployment unit after the restart is obtained.
12. A container configuration method, characterized in that: include: Obtaining a deletion instruction, where the deletion instruction is used to instruct to delete at least one deployment unit, where the at least one deployment unit is used to implement at least one container; The information of each deployment unit in the at least one deployment unit is recovered, wherein the information of each deployment unit includes a unique identifier of each deployment unit, and the recovered unique identifier of each deployment unit is used as a unique identifier of a new deployment unit when creating a deployment unit.
13. The method according to claim 12, characterized in that Before obtaining the deletion instruction, the method further includes: Obtaining a callback request, where the callback request is used to instruct configuration of at least one container; Acquire information of at least one deployment unit according to the callback request, where the at least one deployment unit is used to implement the at least one container; Acquire storage information corresponding to the at least one deployment unit; The storage information is fed back in response to the callback request to create the at least one deployment unit, the storage information is used to create a storage space, the storage space is used to store data of the at least one container, the storage space includes a persistent volume PV in a file system, and the storage space is used to mount the at least one container.
14. A container configuration device, characterized in that: include: A transceiver module, used to obtain a callback request, where the callback request is used to instruct to configure at least one container; a processing module, configured to obtain information of at least one deployment unit according to the callback request, wherein the at least one deployment unit is configured to implement the at least one container; The processing module is further configured to obtain storage information corresponding to the at least one deployment unit; The transceiver module is further used to feedback the storage information in response to the callback request, where the storage information is used to create a storage space, where the storage space is used to store data of the at least one container, and the storage space includes a persistent volume PV in a file system.
15. The device according to claim 14, characterized in that The storage information has a mapping relationship with the at least one deployment unit, and the mapping relationship is used to obtain the storage information corresponding to the at least one deployment unit when the at least one deployment unit is restarted.
16. The device according to claim 15, characterized in that The storage information includes a persistent volume declaration (PVC), and the information of the at least one deployment unit includes a unique identifier of each deployment unit; The mapping relationship specifically includes a mapping relationship between the PVC and the unique identifier of each deployment unit.
17. The device according to any one of claims 14 to 16, characterized in that The processing module is specifically used for: By acquiring information of the instance to which the at least one deployment unit belongs; According to information of the instance to which the at least one deployment unit belongs, a unique identifier is allocated to the at least one deployment unit, and the information of the at least one deployment unit includes the unique identifier of each deployment unit.
18. The device according to claim 17, characterized in that The processing module is specifically used for: Determining the quantity of the at least one deployment unit according to information of the instance to which the at least one deployment unit belongs; A unique identifier is allocated to each deployment unit according to the quantity of the at least one deployment unit.
19. The device according to any one of claims 14 to 18, characterized in that The processing module is further used for: Obtain a unique identifier of at least one unused deployment unit; If the at least one unused deployment unit meets the preset recycling condition, the at least one unused deployment unit is recycled, and the unique identifier of each recycled deployment unit is used as the unique identifier of a new deployment unit when creating a deployment unit.
20. The device according to claim 19, characterized in that The recycling conditions include one or more of the following: The identification of the deployment unit is added to a first list in N consecutive scanning cycles, wherein the first list includes information of created but unused deployment units, where N is a positive integer; Or, the number of replicas of the deployment controller exceeds the preset number.
21. The device according to claim 19 or 20, characterized in that The processing module is further used for: Create recycling containers; The data in the storage space corresponding to the at least one unused deployment unit is migrated to a preset directory through the recycling container.
22. A container configuration device, characterized in that: include: A transceiver module, used to obtain information of at least one deployment unit to be deployed, wherein the at least one deployment unit is used to implement at least one container; The transceiver module is further used to send a callback request, where the callback request is used to instruct to configure at least one container; The transceiver module is further used to obtain a callback response to the callback request, wherein the callback response includes storage information, and the storage information is used to indicate a storage space; A processing module is used to mount the storage space in the at least one deployment unit for storing data of the at least one container, wherein the storage space includes a persistent volume PV in a file system, and the file system is used to provide space for storing data.
23. The device according to claim 22, characterized in that The transceiver module is specifically used for: A container creation request is obtained, where the container creation request is used to request creation of the at least one deployment unit, and the container creation request carries information of the at least one deployment unit.
24. The device according to claim 23, characterized in that The transceiver module is specifically used for: If the at least one deployment unit is restarted, information of the at least one deployment unit after the restart is obtained.
25. A container configuration device, characterized in that: include: a transceiver module, used to obtain a deletion instruction, where the deletion instruction is used to instruct to delete at least one deployment unit, where the at least one deployment unit is used to implement at least one container; A processing module is used to recover information of each deployment unit in the at least one deployment unit, wherein the information of each deployment unit includes a unique identifier of each deployment unit, and the recovered unique identifier of each deployment unit is used as a unique identifier of a new deployment unit when creating a deployment unit.
26. The device according to claim 25, characterized in that The transceiver module is further used to obtain a callback request before obtaining the deletion instruction, wherein the callback request is used to instruct to configure at least one container; The processing module is further used to obtain information of at least one deployment unit according to the callback request, and the at least one deployment unit is used to implement the at least one container; The processing module is further used to obtain storage information corresponding to the at least one deployment unit; The transceiver module is further used to feedback the storage information in response to the callback request to create the at least one deployment unit, the storage information is used to create a storage space, the storage space is used to store data of the at least one container, the storage space includes a persistent volume PV in the file system, and the storage space is used to mount the at least one container.
27. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method of claims 1-8, 9-11 or 12-13.
28. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to claims 1-8, 9-11 or 12-13.
29. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method as claimed in claims 1-8, 9-11 or 12-13.
Citation Information
Cited By
Data deployment method, electronic equipment and computer readable storage medium
CN121233050A