A container creation method, device, computer readable storage medium and computer program product

By selecting the device where the target persistent volume resides or creating the target persistent volume in Kubernetes, the system ensures that the container and the persistent volume are read and written within the same device, thus solving the problem of low cross-device read and write efficiency for container PODs and improving read and write efficiency and storage performance.

CN122363809APending Publication Date: 2026-07-10CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
Filing Date
2026-02-27
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

When creating containers on Kubernetes, cross-device data read and write operations are inefficient, resulting in low read and write efficiency for container PODs.

Method used

By receiving the target container creation request, obtaining the device information where the target persistent volume is located, selecting a target device that meets the conditions, or creating the target persistent volume and creating the container on the same device, ensuring that the container and the persistent volume can perform read and write operations on the same device.

Benefits of technology

It improves the read and write efficiency of container PODs at runtime, avoids cross-device read and write operations, enhances data input and output performance, and reduces storage network load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122363809A_ABST
    Figure CN122363809A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a container creation method, which comprises: receiving a first creation request of a target container; and creating the target container on a first target device where a target persistent volume corresponding to the target container is located based on the first creation request, thereby solving the problem of poor read-write efficiency of a container in runtime in the related art. Embodiments of the present application also provide a container creation device, a computer readable storage medium and a computer program product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data, and in particular to a container creation method, device, computer-readable storage medium, and computer program product. Background Technology

[0002] With the development of technology, container orchestration engines (Kubernetes, k8s) with Container Attached Storage (CAS) architecture have been widely used. Currently, before creating a container (POD) on k8s, multiple persistent volumes (PVs) are typically created on different k8s devices (nodes) to ensure high availability of stored data by creating persistent volume claims (PVCs). After receiving a POD creation request, the POD is created based on the request, and the created POD is bound to the multiple previously created persistent volumes so that the POD can use the multiple created persistent volumes for read and write operations. However, these data read and write operations are usually performed between different devices, that is, the data read and write operations are cross-device, which leads to poor efficiency of container PODs when performing read and write operations. Summary of the Invention

[0003] To address the aforementioned technical problems, this application aims to provide a container creation method, apparatus, computer-readable storage medium, and computer program product, thereby resolving the issue of poor read / write efficiency of containers during runtime in related technologies.

[0004] To achieve the above objectives, the technical solution of this application embodiment is implemented as follows: A container creation method, the method comprising: Receive the first creation request for the target container; Based on the first creation request, the target container is created on the first target device where the target persistent volume corresponding to the target container is located.

[0005] In the above scheme, the step of creating the target container on the first target device where the target persistent volume corresponding to the target container is located, based on the first creation request, includes: Based on the first creation request, obtain the first available resource information of the first device where the target persistent volume is located in the target cluster; wherein, the first creation request includes the creation conditions of the target container; If there is first available resource information that meets the creation conditions, determine the first target device from the first device and create the target container on the first target device; If no first available resource information that meets the creation conditions exists, the first target device is determined from other devices, and the target persistent volume and the target container are created on the first target device; wherein, the other devices are devices in the target cluster other than the first device.

[0006] In the above scheme, determining the first target device from the first device includes: If there exists a first available resource information of a first device that satisfies the creation conditions, then the first target device is determined to be a first device that satisfies the creation conditions. If there are multiple first available resource information of first devices that satisfy the creation conditions, the first target device is determined from the multiple first devices that satisfy the creation conditions based on the first available resource information of each first device that satisfies the creation conditions.

[0007] In the above scheme, determining the first target device from other devices includes: Obtain the first performance information of the other devices; Based on the first performance information, a first performance score is determined for the other devices; The first target device is determined from the other devices based on the first performance score.

[0008] In the above scheme, before receiving the first creation request for the target container, the following steps are also included: Receive a second creation request, and based on the second creation request, obtain the second performance information of each device in the target cluster and the first load information of each device; Based on the second performance information and the first load information, a target score is determined for each device; The first device is determined from multiple devices based on the target score; Create the target persistent volume on the first device.

[0009] In the above scheme, determining the target score for each device based on the second performance information and the first load information includes: A second performance score is determined for each device based on the second performance information; A first load score is determined for each device based on the first load information; The target score is determined based on the second performance score and the first load score.

[0010] The method in the above scheme further includes: If no first available resource information that meets the creation conditions is found, obtain the second load information of each first device; Based on the second load information, a second load score is determined for each of the first devices; From a plurality of first devices, N second devices whose second load scores meet the target conditions are determined; wherein the value of N is the same as the number of first target devices; Migrate the data in the target persistent volume of the second device to the target persistent volume of the first target device, and delete the target persistent volume of the second device.

[0011] In the above scheme, after deleting the target persistent volume of the second device, the method further includes: Receive the reconstruction request for the target container; Based on the reconstruction request, the target container is created on the second target device where the target persistent volume corresponding to the target container is located.

[0012] A container creation apparatus, the apparatus comprising: The receiving unit is used to receive the first creation request of the target container; A creation unit is configured to create the target container on a first target device where the target persistent volume corresponding to the target container is located, based on the first creation request.

[0013] A container creation device, the device comprising: a processor, a memory, and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute a container creation program in memory to implement the steps of the container creation method described above.

[0014] A computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the container creation method described above.

[0015] A computer program product comprising a computer program that, when executed by a processor, implements the container creation method described above.

[0016] The container creation method, apparatus, device, computer-readable storage medium, and computer program product provided in this application embodiment can receive a first creation request for a target container and, based on the first creation request, create the target container on a first target device where the target persistent volume corresponding to the target container is located. Thus, after receiving the first creation request for the target container, it can be directly created on the first target device where the target persistent volume corresponding to the target container is located, ensuring that the first target device where the target container is to be created is a device with a target persistent volume. This ensures that the target container and a target persistent volume are on the same device (i.e., on a node). Therefore, when the target container (i.e., POD) performs read and write operations, it can preferentially perform read and write operations on a persistent volume within the same device. That is, the POD performs read and write operations on the same device during runtime, without needing to perform read and write operations across devices as in related technologies, thereby improving the read and write efficiency of the POD during runtime and solving the problem of poor read and write efficiency of containers during runtime in related technologies. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating a container creation method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a container creation system provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a container creation device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a container creation device provided in an embodiment of this application. Detailed Implementation

[0018] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.

[0019] It should be understood that the phrases "embodiments of this application" or "foreign embodiments" throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, "embodiments of this application" or "in the foreign embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0020] Unless otherwise specified, any step in the embodiments of this application performed by the electronic device may be executed by the processor of the electronic device. It is also worth noting that the embodiments of this application do not limit the order in which the electronic device performs the following steps. Furthermore, the methods used to process data in different embodiments may be the same or different methods. It should also be noted that any step in the embodiments of this application can be executed independently by the electronic device; that is, when the electronic device performs any step in the following embodiments, it may not depend on the execution of other steps.

[0021] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of this application.

[0022] This application provides a container creation method, which can be applied to container creation devices, as described above. Figure 1 As shown, the method may include the following steps: Step 101: Receive the first creation request for the target container.

[0023] In this embodiment of the application, the container creation device may refer to the k8s master node; the target container may refer to the container to be created in k8s, i.e., POD; and the first creation request may refer to a request used to instruct the creation of the target container.

[0024] It should be noted that there can be one or more target containers.

[0025] Step 102: Based on the first creation request, create the target container on the first target device where the target persistent volume corresponding to the target container is located.

[0026] In this embodiment, the target persistent volume corresponding to the target container can refer to multiple persistent volumes (PVs) corresponding to the persistent volume claim (PVC) bound to the POD. There can be only one or multiple target persistent volumes. If there are multiple target persistent volumes, the data in these volumes is mirrored, meaning they serve as backups for each other. The data stored in each target persistent volume is identical, ensuring that the data generated by the POD will not be lost after a target persistent volume fails, thus guaranteeing high data availability. The PVC can be used to specify a specific size, access mode, and type of persistent volume.

[0027] It should be noted that the first creation request may include the identifier of the PVC that the target container needs to bind. The PVC identifier can refer to the name of the PVC. Specifically, after receiving the first creation request, it can be parsed to obtain the identifier of the PVC that the target container needs to bind. Then, the status of the PVC can be determined. If the PVC status is "Bound," it means that the multiple target persistent volumes corresponding to the PVC have been created and can be used normally. In this case, the multiple target persistent volumes bound to the PVC can be determined based on the PVC identifier. Conversely, if the PVC status is "Pending / Waiting," it means that the multiple target persistent volumes corresponding to the PVC have not been fully created and cannot be used normally at present. In this case, the status of the PVC needs to be monitored in real time until the PVC status changes to "Bound," then the next step is to determine the multiple target persistent volumes bound to the PVC.

[0028] In this embodiment of the application, after receiving the first creation request of POD, it can be first determined whether the first device where the target persistent volume is located meets the creation conditions of POD. If at least one first device meets the creation conditions, the first target device to which POD is to be created can be determined from at least one first device. If at least one first device does not meet the creation conditions, the first target device can be determined from other devices, and the target persistent volume can be created on the first target device first, and then the POD can be created on the first target device to ensure that POD and a target persistent volume are on the same device (i.e., node).

[0029] In other embodiments of this application, step 102 can be implemented in the following ways.

[0030] Step 102a: Based on the first creation request, obtain the first available resource information of the first device where the target persistent volume is located in the target cluster.

[0031] The first creation request includes the creation conditions for the target container.

[0032] In this embodiment of the application, the creation conditions may refer to the user's requirements for the device on which the target container is created. For example, the creation conditions may be that the target container needs to be created on a device identified as xx, or the creation conditions may be that the available resources of the device on which the target container is created need to meet certain conditions, etc.

[0033] In this embodiment, the target cluster may refer to Kubernetes; the first device where the target persistent volume resides may refer to the node where the target persistent volume resides, hereinafter referred to as the first node. The target cluster includes multiple devices (i.e., multiple nodes), and the first device is a subset of these devices. It should be noted that the first device can be a cloud device (virtual machine, etc.) or a physical server or other physical device. Similar to the target persistent volume, there may be one or multiple first devices.

[0034] In this embodiment, the first available resource information may refer to the computer storage resources in the first device that are not yet occupied, which may include available resources of the Central Processing Unit (CPU), available memory resources, and extended resources. The available CPU resources may be calculated based on CPU utilization; similarly, available memory resources, extended resources, etc., may also be calculated in this way.

[0035] It should be noted that if there are multiple target persistent volumes, there will be multiple first devices. In this case, each first device has one first available resource information. The first available resource information of different first devices can be the same or different, and no specific limitation is made here.

[0036] In other embodiments of this application, step 102b or step 102c may be performed after step 102a.

[0037] Step 102b: If there is first available resource information that meets the creation conditions, determine the first target device from the first device and create the target container on the first target device.

[0038] In this embodiment of the application, after obtaining the first available resource information of the first device, the first available resource information can be matched with the creation conditions given by the user. For example, if the creation condition is that the CPU available resources of the device to create the target container POD are at least 60%, that is, the CPU utilization rate cannot exceed 40%, then the CPU utilization rate of the first device needs to be compared with 40% to determine whether there is a first device with a CPU utilization rate less than or equal to 40%.

[0039] In one feasible approach, if there is only one first device, then if the first available resource information of the first device meets the creation conditions, the first device can be directly identified as the first target device and a POD can be created on the first target device.

[0040] In another feasible approach, if there are multiple first devices, then if at least one of the first available resource information among the multiple first devices satisfies the creation conditions, it indicates that there are first available resource information that meets the creation conditions, and it also indicates that there is a device among the multiple first devices that meets the creation conditions of the target container. That is, there is a device among the multiple first devices that meets the node affinity and resource requirements of the POD. In this case, the first target device can be directly determined from the multiple first devices where the multiple target persistent volumes are located, and the target container POD can be created on the first target device.

[0041] In the embodiments of this application, there is usually only one target container. However, in one feasible way, it is also possible to create multiple target containers at the same time. In this case, there may also be multiple first target devices, and different target containers correspond to different first target devices.

[0042] It should be noted that the process of creating a POD on a device (i.e., a node) is existing technology and will not be described in detail here.

[0043] In other embodiments of this application, the step 102b of "determining the first target device from the first device" can be implemented by step 102b1 or step 102b2.

[0044] Step 102b1: If there is a first available resource information of a first device that meets the creation conditions, determine the first target device as the first device that meets the creation conditions.

[0045] In the embodiments of this application, the existence of a first available resource information of a first device that meets the creation conditions includes the following two cases: one is that there is only one first device and the first available resource information of the first device meets the creation conditions. In this case, the first device can be directly determined as the first target device; the other is that there are multiple first devices, but only one of them has first available resource information that meets the creation conditions. That is to say, in this case, only one first device meets the creation conditions of the target container. In this case, the first device that meets the creation conditions can be directly determined as the first target device, that is, the device to be used to create the POD.

[0046] Step 102b2: If there are multiple first available resource information of first devices that meet the creation conditions, determine the first target device from the multiple first devices that meet the creation conditions based on the first available resource information of each first device that meets the creation conditions.

[0047] In this application embodiment, for a scenario with multiple first devices, if at least two of the multiple first available resource information meet the creation conditions, it means that at least two of the multiple first devices meet the user's creation requirements. At this time, a device can be randomly selected from the multiple first devices that meet the creation conditions as the first target device. Alternatively, the multiple first devices that meet the creation conditions can be sorted from high to low according to the first available resource information, that is, the first device with the most available resources is placed first. Then, the first device ranked first can be directly used as the first target device.

[0048] Step 102c: If no first available resource information that meets the creation conditions does not exist, determine the first target device from other devices and create the target persistent volume and target container on the first target device.

[0049] Other devices are those in the target cluster other than the multiple first devices.

[0050] In this embodiment, the absence of first available resource information that meets the creation conditions means that regardless of whether there are one or more first devices, their first available resource information does not meet the creation conditions. In this case, it can be determined that none of the multiple first devices can meet the creation conditions of the target container, that is, none of the multiple first devices have the conditions to create the target container. At this time, it is necessary to determine a first target device that meets the creation conditions of POD from all devices in the target cluster k8s except for the multiple first devices, and create POD on the first target device. Since the first target device is a device other than the device where the target persistent volume is located, that is, the first target device does not have the target persistent volume, in order to ensure the read and write efficiency of POD, it is also necessary to create a new target persistent volume on the first target device that is the same as the multiple target persistent volumes. Since the total number of target persistent volumes will not change, it is necessary to select one from the original multiple target persistent volumes for deletion.

[0051] It should be noted that if multiple first available resource information do not meet the creation conditions, it means that multiple first devices do not meet the node affinity and resource requirements of POD.

[0052] In other embodiments of this application, the step 102c of "determining the first target device from other devices" can be implemented in the following ways.

[0053] Step 102c1: Obtain the first performance information of other devices.

[0054] In this embodiment, there may be multiple other devices, which can obtain the first performance information of each other device in the current period. The first performance information includes the throughput, latency, and input / output operations per second (IOPS) of the other devices (i.e., other nodes) in the current period.

[0055] It should be noted that at any given moment within the current period, the device will have a throughput, latency, and IOPS. In other words, within the current period, the device has multiple throughput, latency, and IOPS, and the number of throughput, latency, and IOPS is the same, which is the total number of data acquisition moments.

[0056] Step 102c2: Based on the first performance information, determine the first performance score of other devices.

[0057] In this embodiment, for each other device, the maximum throughput and maximum IOPS of each other device can be determined from multiple throughputs and multiple IOPSs within the current period. Then, a first sum of multiple throughputs, a second sum of multiple latencys, and a third sum of multiple IOPSs can be calculated. Further, the maximum throughput, maximum IOPS, total number of time intervals, the first sum, the second sum, and the third sum can be calculated to obtain a first performance score for each other device. The first performance score characterizes the performance level of the other device; a higher first performance score indicates a higher performance level, and vice versa.

[0058] In one feasible approach, the formula for calculating the first performance score can be as shown in formula (1): Formula (1) in, This indicates the first performance score. Indicates the maximum IOPS. Indicates the first sum value. Indicates the maximum throughput. Indicates the second sum. Let n represent the third sum, and n represent the total number of time points.

[0059] Step 102c3: Determine the first target device from other devices based on the first performance score.

[0060] In this embodiment of the application, multiple first performance scores can be sorted according to their scores, with the highest score ranked first and the lowest score ranked last. Then, other devices corresponding to the first performance score ranked first can be selected as the first target device.

[0061] In one feasible approach, if there are two devices with the highest scores, then any one of these two other devices can be chosen as the final first target device.

[0062] In other embodiments of this application, before receiving a first creation request for a target container, the following steps may be performed to create multiple target persistent volumes.

[0063] A1. Receive the second creation request, and based on the second creation request, obtain the second performance information and the first load information of each device in the target cluster.

[0064] In this embodiment, the second creation request may refer to the creation request of a persistent volume declaration PVC; each device in the target cluster refers to all devices in Kubernetes, i.e., all nodes, including the nodes where the target persistent volumes are located and the remaining nodes; the second performance information may include multiple throughputs, multiple latencies and multiple IOPS of each device in the current period; the first load information may include the CPU utilization, total CPU requests, memory utilization and total memory requests of each device.

[0065] It should be noted that total CPU requests can refer to the sum of CPU resources requested by each POD running on the device; total memory requests can refer to the sum of memory resources requested by each POD running on the device. A device can run only one POD or multiple PODs.

[0066] In this embodiment, upon receiving the second creation request, the request can be analyzed to obtain the volume binding mode of the PVC's storage class. If the volume binding mode is Immediate, it means that multiple target persistent volumes can be created immediately. In this case, the second performance information and the first load information of each device in the target cluster can be directly obtained. However, if the volume binding mode is WaitForFirstConsumer, it means that multiple target persistent volumes cannot be created yet. Instead, it is necessary to wait for the binding mode to be converted to Immediate before performing the action of creating multiple target persistent volumes, in order to obtain the second performance information and the first load information of each device.

[0067] It should be noted that the second creation request will carry the number of target persistent volumes to be created.

[0068] A2. Based on the second performance information and the first load information, determine the target score for each device.

[0069] In the embodiments of this application, the target score for each device represents the health level of each device. It should be noted that each device has one target score.

[0070] In this embodiment of the application, a second performance score for each device can be determined first based on the second performance information, and a first load score for each device can be determined based on the first load information of each device. After that, a target score for each device can be determined based on the second performance score and the first load score.

[0071] In other embodiments of this application, step A2 can be implemented in the following ways: a1. Determine the second performance score for each device based on the second performance information.

[0072] In this embodiment of the application, step 102c2 can be followed to first determine the maximum throughput and maximum IOPS of each device from multiple throughputs and multiple IOPS in the current period. Then, the fourth sum of multiple throughputs, the fifth sum of multiple latencys, and the sixth sum of multiple IOPSs can be calculated. Further, the maximum throughput, maximum IOPS, total number of moments in the current period, fourth sum, fifth sum, and sixth sum can be calculated according to formula (1) to obtain the second performance score of each device in the target cluster. .

[0073] a2. Determine the first load score for each device based on the first load information.

[0074] In this embodiment, the CPU utilization, total CPU requests, memory utilization, and total memory requests of each device can be calculated to obtain a first load score for each device. The first load score characterizes the resource usage pressure of the device; a higher second load score indicates higher resource usage pressure for the corresponding device, while a lower second load score indicates lower resource usage pressure for the device.

[0075] In one feasible approach, the first load score for each device can be calculated according to the following formula (2).

[0076] Formula (2) in, This indicates the first load score. Indicates CPU utilization. This indicates the total number of CPUs requested. Indicates memory utilization. This represents the total amount of memory requested, and m represents the number of PODs running on each device.

[0077] a3. Determine the target score based on the second performance score and the first load score.

[0078] In this embodiment of the application, for each device, a second performance score can be generated. and first load score Add them together to get the target score for each device, i.e., target score = .

[0079] A3. Determine the first device from multiple devices based on the target score.

[0080] In this embodiment, multiple target scores can be sorted in descending order. Then, M nodes (M first devices) can be selected from all nodes in the target cluster in descending order. Here, M represents the number of target persistent volumes to be created. It should be noted that M can be 1 or an integer greater than 1.

[0081] It should be noted that if you want to create multiple target persistent volumes, these target persistent volumes must be created on different devices. In other words, the number of primary devices you need to select depends on the number of target persistent volumes you want to create.

[0082] For example, if there are 4 devices in the target cluster, with device 1 having a target score of 90, device 2 having a target score of 88, device 3 having a target score of 91, and device 4 having a target score of 82, and 2 target persistent volumes need to be created, then device 1 and device 2 can be selected as the first devices in descending order of target score.

[0083] A4. Create the target persistent volume on the first device.

[0084] In one feasible approach, if only one primary device is identified, the target persistent volume can be created directly on that primary device.

[0085] In another feasible approach, if multiple first devices are identified, the target persistent volume can be created separately on each first device. It should be noted that the process of creating the target persistent volume on a device, i.e., a Node, is existing technology and will not be elaborated upon here.

[0086] In other embodiments of this application, the following steps may be performed after step 102.

[0087] Step 103: If there is no first available resource information that meets the creation conditions, obtain the second load information for each first device.

[0088] In this embodiment of the application, if at least one first available resource information does not meet the conditions for creating a POD, that is, regardless of whether there is one first device or multiple first devices, none of them can meet the conditions for creating a POD, then it means that none of the first devices can create a POD. In this case, after creating the target container on the determined first target device, a second device can be determined from the multiple first devices, and the target persistent volume on the second device can be deleted to keep the number of target persistent volumes unchanged.

[0089] In this embodiment, second load information of each first device can be obtained firstly, and a second device can be determined from multiple first devices based on the second load information. The second load information of the first device may include CPU utilization, total CPU requests, memory utilization, and total memory requests.

[0090] Step 104: Based on the second load information, determine the second load score for each first device.

[0091] In this embodiment, CPU utilization, total CPU requests, memory utilization, and total memory requests can be calculated to obtain a second load score for each first device. The second load score characterizes the resource usage pressure and health status of the device. A higher second load score indicates higher resource usage pressure and worse health status for the corresponding device, while a lower second load score indicates lower resource usage pressure and better health status.

[0092] In one feasible approach, the CPU utilization, total CPU requests, memory utilization and total memory requests of each first device can be calculated according to formula (2) to obtain the second load score of each first device.

[0093] It should be noted that regardless of whether there is one first device or multiple second devices, each first device corresponds to one second load score.

[0094] Step 105: Determine N second devices from multiple first devices whose second load scores meet the target conditions.

[0095] The value of N is the same as the number of the first target devices.

[0096] In this embodiment of the application, if there is only one target container, there is also only one first target device, and correspondingly, N is 1. That is, only one second device needs to be determined. If there are multiple target containers, there will also be multiple second target devices, and the value of N will be greater than 1. That is, multiple second devices need to be determined, and one first target device corresponds to one second device.

[0097] In one feasible approach, if N is 1, multiple second load scores can be sorted from high to low. Then, the second load score with the highest ranking can be determined from the multiple second load scores. After that, the first device corresponding to the second load score with the highest ranking can be determined as the second device.

[0098] In another feasible approach, if N is 2, the multiple second load scores can be sorted from highest to lowest. Then, the top two second load scores can be identified, and the first devices corresponding to these two scores can be designated as second devices. It should be noted that when N is 3, 4, ..., the method for determining the second device is the same as when N is 2, and will not be elaborated upon here.

[0099] In the embodiments of this application, the second device and the first target device have a one-to-one correspondence.

[0100] Step 106: Migrate the data in the target persistent volume of the second device to the target persistent volume of the first target device, and delete the target persistent volume of the second device.

[0101] In this embodiment, if N is 1, the data in the target persistent volume of the second device can be migrated to the newly created target persistent volume in the first target device, and the original target persistent volume in the second device can be deleted. That is, the target persistent volume on the second device is scheduled to be moved to the first target device. In this way, not only can the total number of target persistent volumes be kept the same, but the resource usage pressure of the second device can also be reduced, so as to ensure the load balance among multiple devices in the target cluster (i.e., k8s) as much as possible, thereby ensuring the overall operating performance and reliability of k8s.

[0102] In other embodiments of this application, the following steps may be performed after the target persistent volume of the second device is deleted, i.e., after step 106.

[0103] Step 107: Receive the reconstruction request for the target container.

[0104] In this embodiment of the application, if the first target device where the target container POD is located fails and cannot operate normally, or if the user has other needs, the created POD will not be able to run on the originally determined first target device. At this time, the user will send a reconstruction request for the target container to the Master node to instruct the Master node to rebuild the target container.

[0105] Step 108: Based on the rebuild request, create the target container on the second target device where the target persistent volume corresponding to the target container is located.

[0106] In this embodiment of the application, if there is only one target persistent volume, the performance information of each remaining device in the target cluster other than the device where the target persistent volume is located can be obtained, and the performance score of each remaining device can be calculated according to step 102c2 based on the performance information of each remaining device. Then, the second target device with the highest performance score can be determined from the multiple remaining devices according to the multiple performance scores, and the target persistent volume can be created on the second target device. After the target persistent volume is successfully created, the POD can be rebuilt on the second target device. Finally, the data in the target persistent volume of the first target device can be migrated to the target persistent volume of the second target device.

[0107] In this embodiment of the application, if there are multiple target persistent volumes, step 108 can be implemented in the following way.

[0108] B1. In response to the rebuild request, obtain the second available resource information for each third device in the target cluster.

[0109] The third device is any device other than the first target device among the devices where each target persistent volume is located.

[0110] In the embodiments of this application, the third device is any device other than the first target device among the devices where each target persistent volume is located. It should be noted that the device where each target persistent volume is located may be the original first device (i.e., the first target device is determined from multiple first devices), or it may not be the original multiple first devices (i.e., the first target device is not determined from multiple first devices, in which case there may be a second device among the multiple first devices that does not have a target persistent volume).

[0111] In this embodiment of the application, the second available resource information may refer to the computer storage resources in the third device that are not yet occupied, which may include CPU available resources, memory available resources and extended resources, etc.

[0112] It should be noted that a third device has a second available resource information. The second available resource information of different third devices can be the same or different, and no specific limitation is made here.

[0113] B2. If any second available resource information meets the creation conditions, determine the second target device from multiple third devices and rebuild the target container on the second target device.

[0114] In this embodiment of the application, step 102 can be used to determine whether each second available resource information meets the creation conditions of the target container. If it is determined that at least one second available resource information among multiple second available resource information meets the creation conditions, it means that one of the multiple third devices meets the node affinity and resource requirements of the POD. At this time, if only one third device's second available resource information meets the creation conditions, then the third device is determined to be the second target device. If multiple third devices' second available resource information meets the creation conditions, then any device can be selected from the multiple third devices that meet the creation conditions as the second target device. Alternatively, the third device with the most available resources can be selected as the second target device in descending order of the second available resource information.

[0115] In this embodiment of the application, after the second target device is determined, the target container can be rebuilt directly on the second target device. At this time, the second target device not only has a target persistent volume but also runs the target container.

[0116] B3. If none of the second available resource information meets the creation conditions, determine the second target device from the multiple fourth devices based on the third performance information of each fourth device in the target cluster, and create the target persistent volume and target container on the second target device.

[0117] Among them, multiple fourth devices are devices in each device of the target cluster other than the device where each target persistent volume is located.

[0118] In this embodiment, the third performance information may include multiple throughputs, multiple latencys, and multiple IOPS of the fourth device in the current period. If none of the multiple second available resource information meets the creation conditions of the target container POD, it means that all the third devices do not meet the node affinity and resource requirements of the POD. In this case, the third performance information of each fourth device can be obtained first. Then, the obtained third performance information can be processed according to the content of step 102c2 to obtain the target performance score of each fourth device. Further, according to step 102c3, the second target device can be determined from the multiple fourth devices based on the multiple target performance scores. Then, the target persistent volume and the target container can be created on the second target device respectively.

[0119] It should be noted that after the target persistent volume is created on the second target device, in order to ensure that the total number of target persistent volumes does not change, it is necessary to follow the steps 103-106, and based on the third load information of the device where each target persistent volume is located, determine a fifth device from the multiple devices where the target persistent volume is located, and migrate the data in the target persistent volume of the fifth device to the target persistent volume of the second target device. Then, delete the target persistent volume in the fifth device, that is, schedule the target persistent volume of the fifth device to the second target device, so as to ensure that the target container POD and a certain target persistent volume are on the same device (i.e., node).

[0120] In the embodiments of this application, after a POD is rescheduled for various reasons, i.e. rebuilt, the node to which the POD is to be recreated can be determined from the multiple nodes where the multiple target persistent volumes corresponding to the PVC are located. If the multiple nodes where the multiple target persistent volumes are located do not meet the scheduling requirements (i.e. creation conditions) of the POD, then a certain target persistent volume will migrate with the POD to ensure that the POD and a certain persistent volume are on the same device (i.e. node). This improves the read and write efficiency of the POD during operation, increases the storage input / output (I / O) performance, and reduces the load on the storage network.

[0121] The container creation method provided in this application embodiment, after receiving the first creation request of the target container, can directly create the container on the first target device where the target persistent volume corresponding to the target container is located, thus ensuring that the first target device where the target container is to be created is a device with the target persistent volume. This ensures that the target container and a target persistent volume are on the same device (i.e., on the node). Therefore, when the target container (i.e., POD) performs read and write operations, it can preferentially perform read and write operations on the persistent volume on the same device. That is, the POD performs read and write operations on the same device during runtime, without needing to perform read and write operations across devices as in related technologies. This improves the read and write efficiency of the POD during runtime, thereby solving the problem of poor read and write efficiency of containers during runtime in related technologies.

[0122] This application provides a container creation system, which can be applied to... Figure 1 In the container creation method provided in the corresponding embodiment, refer to Figure 2 As shown, the container creation system 2 may include a cluster monitoring module 21, a system scheduling module 22, a storage management module 23, and a container management module 24, wherein: The cluster monitoring module 21 is used to collect the IOPS, throughput and latency of nodes in the target cluster, and calculate the performance score and load score of the nodes within a specified time. The system scheduling module 22 is responsible for the creation and scheduling of PODs. That is, it determines the node to which a POD is created or scheduled based on the performance score and load score of each node, so as to realize the creation and scheduling of PODs.

[0123] Storage management module 23 is responsible for managing the lifecycle of PVC, that is, maintaining multiple replica volumes of PVC (i.e. multiple target persistent volumes) to enable cross-node migration of replica volumes, etc.

[0124] The container management module 24 is responsible for managing the lifecycle of a POD, including creating a POD, mounting and unmounting PVCs, etc.

[0125] In this embodiment of the application, when a user initiates the creation of a POD or PVC, the system scheduling module 22 can query the cluster monitoring module 21 to obtain the relevant monitoring indicators of each node in the target cluster within a specified period, and select the corresponding node based on indicators such as resource allocation and cluster storage performance. After that, the storage management module 23 and the container management module 24 can be called to create the corresponding POD and PVC.

[0126] The container creation system provided in this application embodiment, after receiving the first creation request of the target container, can directly create the container on the first target device where the target persistent volume corresponding to the target container is located. This ensures that the first target device where the target container is to be created is a device with the target persistent volume, thus ensuring that the target container and a target persistent volume are on the same device (i.e., on the node). In this way, when the target container (i.e., POD) performs read and write operations, it can preferentially perform read and write operations on the persistent volume on the same device. That is, the POD performs read and write operations on the same device during runtime, without needing to perform read and write operations across devices as in related technologies, thereby improving the read and write efficiency of the POD during runtime and solving the problem of poor read and write efficiency of containers during runtime in related technologies.

[0127] This application provides a container creation apparatus, which can be applied to... Figure 1 In the container creation method provided in the corresponding embodiment, refer to Figure 3 As shown, the container creation device 3 may include: a receiving unit 31 and a creation unit 32, wherein: Receiving unit 31 is used to receive the first creation request of the target container; The creation unit 32 is used to create the target container on the first target device where the target persistent volume corresponding to the target container is located, based on the first creation request.

[0128] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: Based on the first creation request, obtain the first available resource information of the first device where the target persistent volume is located in the target cluster; wherein, the first creation request includes the creation conditions of the target container; If there is first available resource information that meets the creation conditions, determine the first target device from the first device and create the target container on the first target device; If no first available resource information that meets the creation conditions does not exist, determine the first target device from the other devices and create the target persistent volume and target container on the first target device; wherein, the other devices are devices in the target cluster other than the first device.

[0129] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: If there exists a first available resource information of a first device that satisfies the creation conditions, then the first target device is determined to be the first device that satisfies the creation conditions. If there are multiple first available resource information of first devices that meet the creation conditions, the first target device is determined from the multiple first devices that meet the creation conditions based on the first available resource information of each first device that meets the creation conditions.

[0130] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: Obtain initial performance information from other devices; Based on the initial performance information, determine the initial performance score of other devices; The first target device is determined from other devices based on the first performance score.

[0131] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: Receive the second creation request, and based on the second creation request, obtain the second performance information and the first load information of each device in the target cluster; Based on the second performance information and the first load information, a target score is determined for each device; The first device is determined from multiple devices based on the target score; Create the target persistent volume on the first device.

[0132] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: A second performance score is determined for each device based on the second performance information; Determine the first load score for each device based on the first load information; The target score is determined based on the second performance score and the first load score.

[0133] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: If no first available resource information that meets the creation conditions is found, obtain the second load information for each first device; Based on the second load information, a second load score is determined for each first device; From a plurality of first devices, determine N second devices whose second load scores meet the target conditions; wherein the value of N is the same as the number of first target devices; Migrate the data in the target persistent volume of the second device to the target persistent volume of the first target device, and delete the target persistent volume of the second device.

[0134] In other embodiments of this application, the creation unit 32 is also used to perform the following steps: Receive the rebuild request for the target container; Based on the rebuild request, the target container is created on the second target device where the target persistent volume corresponding to the target container resides.

[0135] It should be noted that the specific implementation process of the steps performed by each unit in the embodiments of this application can be referred to Figure 1 The implementation process of the container creation method provided in the corresponding embodiment will not be described in detail here.

[0136] The container creation apparatus provided in this application embodiment, after receiving a first creation request for a target container, can directly create the container on the first target device where the target persistent volume corresponding to the target container is located, based on the first creation request. This ensures that the first target device where the target container is to be created is a device with a target persistent volume, thus ensuring that the target container and a target persistent volume are on the same device (i.e., on a node). In this way, when the target container (i.e., POD) performs read and write operations, it can preferentially perform read and write operations on the persistent volume on the same device. That is, the POD performs read and write operations on the same device during runtime, without needing to perform read and write operations across devices as in related technologies, thereby improving the read and write efficiency of the POD during runtime and solving the problem of poor read and write efficiency of containers during runtime in related technologies.

[0137] This application provides a container creation device that can be applied to... Figure 1 In the container creation method provided in the corresponding embodiment, refer to Figure 4 As shown, the container creation device 4 may include: a processor 41, a memory 42, and a communication bus 44; Communication bus 44 is used to realize the communication connection between processor 41 and memory 42; Processor 41 is used to execute the container creation program in memory 42 to perform the following steps: Receive the first creation request for the target container; Based on the first creation request, the target container is created on the first target device where the target persistent volume corresponding to the target container is located.

[0138] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: Based on the first creation request, obtain the first available resource information of the first device where the target persistent volume is located in the target cluster; wherein, the first creation request includes the creation conditions of the target container; If there is first available resource information that meets the creation conditions, determine the first target device from the first device and create the target container on the first target device; If no first available resource information that meets the creation conditions does not exist, determine the first target device from the other devices and create the target persistent volume and target container on the first target device; wherein, the other devices are devices in the target cluster other than the first device.

[0139] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: If there exists a first available resource information of a first device that satisfies the creation conditions, then the first target device is determined to be the first device that satisfies the creation conditions. If there are multiple first available resource information of first devices that meet the creation conditions, the first target device is determined from the multiple first devices that meet the creation conditions based on the first available resource information of each first device that meets the creation conditions.

[0140] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: Obtain initial performance information from other devices; Based on the initial performance information, determine the initial performance score of other devices; The first target device is determined from other devices based on the first performance score.

[0141] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: Receive the second creation request, and based on the second creation request, obtain the second performance information and the first load information of each device in the target cluster; Based on the second performance information and the first load information, a target score is determined for each device; The first device is determined from multiple devices based on the target score; Create the target persistent volume on the first device.

[0142] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: A second performance score is determined for each device based on the second performance information; Determine the first load score for each device based on the first load information; The target score is determined based on the second performance score and the first load score.

[0143] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: If no first available resource information that meets the creation conditions is found, obtain the second load information for each first device; Based on the second load information, a second load score is determined for each first device; From a plurality of first devices, determine N second devices whose second load scores meet the target conditions; wherein the value of N is the same as the number of first target devices; Migrate the data in the target persistent volume of the second device to the target persistent volume of the first target device, and delete the target persistent volume of the second device.

[0144] In other embodiments of this application, the processor 41 is used to execute a container creation program in the memory 42, and may also perform the following steps: Receive the rebuild request for the target container; Based on the rebuild request, the target container is created on the second target device where the target persistent volume corresponding to the target container resides.

[0145] It should be noted that a detailed description of the steps performed by the processor can be found in [reference needed]. Figure 1 The container creation method provided in the corresponding embodiment will not be described again here.

[0146] The container creation device provided in this application embodiment, after receiving the first creation request of the target container, can directly create the container on the first target device where the target persistent volume corresponding to the target container is located. This ensures that the first target device where the target container is to be created is a device with the target persistent volume, thus ensuring that the target container and a target persistent volume are on the same device (i.e., on a node). In this way, when the target container (i.e., POD) performs read and write operations, it can preferentially perform read and write operations on the persistent volume on the same device. That is, the POD performs read and write operations on the same device during runtime, without needing to perform read and write operations across devices as in related technologies, thereby improving the read and write efficiency of the POD during runtime and solving the problem of poor read and write efficiency of containers during runtime in related technologies.

[0147] Based on the foregoing embodiments, this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to achieve... Figure 1 The corresponding implementation provides the steps of the container creation method.

[0148] Based on the foregoing embodiments, this application provides a computer program product, including a computer program that can be executed by a processor 41 to perform... Figure 1 The corresponding implementation provides the steps of the container creation method.

[0149] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for creating a container, characterized in that, The method includes: Receive the first creation request for the target container; Based on the first creation request, the target container is created on the first target device where the target persistent volume corresponding to the target container is located.

2. The method according to claim 1, characterized in that, The step of creating the target container on the first target device where the target persistent volume corresponding to the target container is located, based on the first creation request, includes: Based on the first creation request, obtain the first available resource information of the first device where the target persistent volume is located in the target cluster; wherein, the first creation request includes the creation conditions of the target container; If there is first available resource information that meets the creation conditions, determine the first target device from the first device and create the target container on the first target device; If no first available resource information that meets the creation conditions exists, the first target device is determined from other devices, and the target persistent volume and the target container are created on the first target device; wherein, the other devices are devices in the target cluster other than the first device.

3. The method according to claim 2, characterized in that, Determining the first target device from the first device includes: If there exists a first available resource information of a first device that satisfies the creation conditions, then the first target device is determined to be a first device that satisfies the creation conditions. If there are multiple first available resource information of first devices that satisfy the creation conditions, the first target device is determined from the multiple first devices that satisfy the creation conditions based on the first available resource information of each first device that satisfies the creation conditions.

4. The method according to claim 2, characterized in that, Determining the first target device from other devices includes: Obtain the first performance information of the other devices; Based on the first performance information, a first performance score is determined for the other devices; The first target device is determined from the other devices based on the first performance score.

5. The method according to claim 2, characterized in that, Before receiving the first creation request for the target container, the process also includes: Receive a second creation request, and based on the second creation request, obtain the second performance information of each device in the target cluster and the first load information of each device; Based on the second performance information and the first load information, a target score is determined for each device; The first device is determined from multiple devices based on the target score; Create the target persistent volume on the first device.

6. The method according to claim 5, characterized in that, The step of determining the target score for each device based on the second performance information and the first load information includes: A second performance score is determined for each device based on the second performance information; A first load score is determined for each device based on the first load information; The target score is determined based on the second performance score and the first load score.

7. The method according to claim 2, characterized in that, The method further includes: If no first available resource information that meets the creation conditions is found, obtain the second load information of each first device; Based on the second load information, a second load score is determined for each of the first devices; From a plurality of first devices, N second devices whose second load scores meet the target conditions are determined; wherein the value of N is the same as the number of first target devices; Migrate the data in the target persistent volume of the second device to the target persistent volume of the first target device, and delete the target persistent volume of the second device; Accordingly, after deleting the target persistent volume of the second device, the method further includes: Receive the reconstruction request for the target container; Based on the reconstruction request, the target container is created on the second target device where the target persistent volume corresponding to the target container is located.

8. A container creation device, characterized in that, The device includes: a processor, a memory, and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute a container creation program in memory to implement the steps of the container creation method as described in any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs that can be executed by one or more processors to implement the steps of the container creation method as described in any one of claims 1-7.

10. A computer program product, the computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the container creation method according to any one of claims 1-7.