Kubernetes storage method and device based on Lustre file system

By integrating the Lustre file system and CSI plug-in in Kubernetes, and using the Project quota function, the problem of insufficient support for the Lustre file system in the existing Kubernetes storage solution is solved, and the refined management of Pod storage resources and resource isolation and efficiency improvement in multi-tenant environments are achieved.

CN120179383AActive Publication Date: 2025-06-20BEIJING INBO DIGITAL TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510162304.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-06-20
Estimated Expiration
2045-02-13

AI Technical Summary

Technical Problem

The existing Kubernetes storage solution lacks support for the Lustre file system, it is difficult to automatically manage dynamic quota management of paths mounted to Pods, and there is a lack of unified storage access control and resource restriction mechanism, especially in multi-tenant or resource restriction scenarios.

Method used

Through the integration of the container storage interface plug-in (CSI) with the Lustre file system, a Kubernetes storage method based on the Lustre file system is provided, and the Project quota function is used to achieve refined management of the storage resources of Pods. The method includes creating a binding between PVC and PV according to user requests, mounting the Lustre file system path, calculating and assigning Project ID, setting the quota value, and dynamically adjusting the quota through the Webhook service.

Benefits of technology

It realizes refined management of storage resources of each Pod in the Kubernetes cluster, ensuring the isolation and utilization efficiency of resources in a multi-tenant environment. Through the collaborative work of CSI plug-in, Helper Pod and Webhook, it provides efficient scheduling and fine-grained control of storage resources, simplifies the resource recycling and reuse process, and improves storage utilization and operation and maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179383A_ABST
    Figure CN120179383A_ABST
Patent Text Reader

Abstract

The invention relates to a Kubernetes storage method and device based on a Lustre file system, and the method comprises the steps: building a PVC according to a user request, and binding the PVC with a corresponding PV; carrying out Lustre file system path mounting on the bound PVC and PV, and meanwhile, calculating a minimum unbound Project ID (Identity); the Project ID is allocated to the mounting path, and a quota value is set; and receiving a PVC capacity adjustment request, triggering the Webhook service, and modifying the quota value of the mounting path. Through a Project ID quota function of a Lustre file system, quota limitation is performed on a mounting path in Kubernetes, efficient management and access control of storage resources in a multi-tenant scene are realized, and the storage utilization rate and the operation and maintenance efficiency are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud native, and particularly to a Kubernetes storage method and device based on the Lustre file system. Background Art

[0002] With the rapid development of cloud computing and containerization technologies, Kubernetes, as a mainstream container orchestration platform, has been widely used in multi-tenant and complex application scenarios. However, there are still challenges in the efficient management of the storage system by Kubernetes, especially in scenarios that require a large amount of I / O and high throughput. As a high-performance distributed file system, the Lustre file system is often used in scenarios with large-scale data storage requirements due to its excellent I / O performance and scalability. The Project quota management feature of the Lustre file system can provide the ability to set quotas by directory. However, the application of this function in the Kubernetes environment still lacks a general and efficient integration solution. Existing methods are difficult to automatically perform dynamic quota management on the paths mounted to Pods, and lack a unified storage access control and resource limitation mechanism, especially in multi-tenant or resource-limited scenarios. For a Kubernetes cluster in a multi-tenant environment, how to effectively allocate storage resources, manage quotas, and control access is an urgent problem to be solved. Summary of the Invention

[0003] In view of this, in order to solve the problem of insufficient support for the Lustre file system in existing Kubernetes storage solutions, this application proposes a Kubernetes storage method and device based on the Lustre file system. Through the improvement of the container storage interface plugin and in cooperation with the Project quota function of the Lustre file system, an efficient, flexible, and automated storage solution is provided.

[0004] According to one aspect of this application, a Kubernetes storage method based on the Lustre file system is provided, including:

[0005] Create a PVC according to a user request and bind the PVC to the corresponding PV;

[0006] Mount the bound PVC and PV to the Lustre file system path, and at the same time calculate the smallest unbound Project ID;

[0007] Assign the Project ID to the mounted path and set the quota value;

[0008] Receive a PVC capacity adjustment request, trigger the Webhook service, and modify the quota value of the mounted path.

[0009] In a possible implementation, when binding PVC to the corresponding PV, the PV is found and bound based on the CSI plugin.

[0010] If the corresponding PV is not found, a PV is created through the StorageClass specified by the user and then bound.

[0011] In a possible implementation, when mounting the Lustre file system path for the bound PVC and PV, a lightweight container of a Helper Pod is enabled to mount the Lustre file system path.

[0012] In a possible implementation, when allocating the Project ID to the mount path and setting the quota value, it further includes: creating a mapping table for recording the binding relationship between each Project ID and the corresponding PVC.

[0013] The mapping table records the status of each Project ID and the name of the PVC bound to it.

[0014] Wherein the status of the Project ID includes at least one of "allocated" and "unbound".

[0015] In a possible implementation, creating a PV through the StorageClass specified by the user includes: specifying the type and configuration of the storage through the StorageClass, and automatically creating a PV object by the Provisioner, and binding the PVC corresponding to the PV to the StorageClass.

[0016] In a possible implementation, when creating a PVC, the mapping table is checked to find the current smallest unbound Project ID; the found Project ID is allocated to the PVC, and the status of the Project ID in the mapping table is updated to "allocated".

[0017] When deleting a PVC, the Project ID bound to the deleted PVC is found in the mapping table; the status of the Project ID is updated to "unbound", and the PVC name associated with it is cleared.

[0018] According to another aspect of the present application, a Kubernetes storage device based on the Lustre file system is provided, including: a creation module, a quota module, and an adjustment module.

[0019] The creation module is configured to create a PVC according to a user request and bind the PVC to the corresponding PV.

[0020] The quota module is configured to mount the Lustre file system path for the bound PVC and PV, and at the same time calculate the minimum unbound Project ID;

[0021] Allocate the Project ID to the mount path and set the quota value;

[0022] The adjustment module is configured to receive a PVC capacity adjustment request, trigger the Webhook service, and modify the quota value of the mount path.

[0023] According to another aspect of the present application, there is provided a Kubernetes storage device based on the Lustre file system, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to execute the above method.

[0024] According to another aspect of the present application, there is provided a non-volatile computer-readable storage medium, on which computer program instructions are stored, wherein the computer program instructions, when executed by a processor, implement the above method.

[0025] Advantages of the present application: In the present invention, through the integration of the CSI plugin and the Lustre file system in Kubernetes, each Pod in the Kubernetes cluster can mount the Lustre file system path according to the quota requirements. The ProjectID attribute is used to allocate independent storage paths for each tenant or Pod, and quota limits are set for each path to ensure resource isolation and usage efficiency in a multi-tenant environment. Through the collaborative work of the CSI plugin, Helper Pod, and Webhook, efficient scheduling and fine-grained control of storage resources are provided, simplifying the resource recycling and reuse process, and improving storage utilization and operation and maintenance efficiency.

[0026] According to the following detailed description of the exemplary embodiments with reference to the accompanying drawings, other features and aspects of the present application will become clear. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings included in the specification and constituting a part of the specification, together with the specification, illustrate the exemplary embodiments, features, and aspects of the present application, and are used to explain the principles of the present application.

[0028] Figure 1 A flowchart showing the Kubernetes storage method based on the Lustre file system according to an embodiment of the present application;

[0029] Figure 2 A diagram showing the architecture of the Kubernetes storage system based on the Lustre file system according to an embodiment of the present application;

[0030] Figure 3 Shows the PVC creation flowchart of the embodiments of the present application;

[0031] Figure 4 Shows the PVC dynamic quota adjustment flowchart of the embodiments of the present application;

[0032] Figure 5 Shows the PVC deletion flowchart of the embodiments of the present application;

[0033] Figure 6 Shows the quota recovery flowchart of the embodiments of the present application. Detailed implementation manners

[0034] The following will describe in detail various exemplary embodiments, features and aspects of the present application with reference to the accompanying drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0035] The special term "exemplary" here means "serving as an example, embodiment or illustration". Any embodiment described as "exemplary" here is not necessarily to be construed as superior to or better than other embodiments.

[0036] In addition, for a better description of the present application, numerous specific details are given in the following detailed implementation manners. Those skilled in the art should understand that the present application can also be implemented without some specific details. In some instances, methods, means, elements and circuits well known to those skilled in the art are not described in detail so as to highlight the gist of the present application.

[0037] The present application is applicable to mounting the Lustre file system path for each Pod in the Kubernetes cluster according to the quota requirements, so as to realize the refined management of the storage resources of the Pod. Each Pod is allocated an independent storage path, and corresponding quota limits are set for each path to ensure that in a multi-tenant environment, the resource usage of each tenant is effectively isolated and controlled, thereby improving the resource usage efficiency and security of the entire cluster.

[0038] Embodiment 1

[0039] Figure 1 Shows the flowchart of the Kubernetes storage method based on the Lustre file system according to an embodiment of the present application. As Figure 1 shown, the method includes:

[0040] Step S100: Create a PVC according to the user request and bind the PVC to the corresponding PV. PV refers to Persistent Volume, which is a native concept of Kubernetes and represents a volume of a specific storage type. The object of PV defines the specific storage type and volume parameters, that is, all relevant information of the target storage service. Kubernetes performs the mounting operation by referring to the storage information in the PV. PVC stands for Persistent Volume Claim, which is an abstract storage volume type in Kubernetes and represents the expression of a data volume of a specific type. One storage claim binds to one storage volume. Kubernetes is an open-source container orchestration platform that allows for the automated deployment, scaling, and management of containers.

[0041] Step S200: Mount the Lustre file system path for the bound PVC and PV, and calculate the minimum unbound Project ID at the same time. Lustre is a high-performance parallel distributed file system widely used in high-performance computing (HPC) environments. In Linux, for a file outside the root directory to be accessible, it needs to be "associated" with a directory under the root directory, and this "association" operation is called mounting.

[0042] Step S300: Assign the Project ID to the mount path and set the quota value. The quota value refers to the usage limit of the disk capacity for a user, to prevent a user from occupying too much capacity and causing insufficient available capacity for other users.

[0043] Step S400: Receive the PVC capacity adjustment request, trigger the Webhook service, and modify the quota value of the mount path.

[0044] Webhook is used to listen for the PVC capacity adjustment request and trigger the dynamic quota modification operation; use the lfs project command to modify the quota value of the specified mount path.

[0045] In a possible implementation, the user submits a PVC creation request through Kubernetes. The Controller component of the CSI plugin receives the creation request and creates the PVC according to the request parameters submitted by the user. After the PVC is successfully created, the CSI plugin starts to perform a search operation to find a matching PV. If a corresponding PV is found, the PVC is bound to the found PV; if no corresponding PV is found during the search process, the CSI plugin will specify the storage type and configuration through the StorageClass, and the Provisioner will automatically create a new PV object. After the creation is completed, the PVC corresponding to the newly created PV is bound to the StorageClass.

[0046] During the process of performing the binding, the quota management module mounts the Lustre file system path for the bound PVC and PV by enabling a Helper Pod lightweight container. After the mounting is completed, the quota management module starts to calculate the smallest unbound Project ID; after calculating the Project ID, the quota management module uses the lfs project command to assign the Project ID to the mounted path and set the corresponding quota value; after the Helper Pod completes the above steps, it will return a success message, generate a PV and bind it to the PVC, and complete the creation process.

[0047] To effectively manage storage resources, a mapping table is created to record the binding relationship between each Project ID and the corresponding PVC.

[0048] The mapping table records the current status of each Project ID and the name of the PVC bound to it; among them, the status information of the Project ID recorded in the mapping table includes two types: one is the status where the resource has been allocated, denoted as "allocated"; the other is the status where the resource is currently unbound, denoted as "unbound".

[0049] When creating a new PVC, check the mapping table to find the smallest unbound Project ID currently; assign the found Project ID to the PVC, and update the status of this Project ID in the mapping table to "allocated"; to reflect the latest resource allocation situation.

[0050] When the user submits a PVC capacity adjustment request, the CSI plugin receives the PVC capacity adjustment request from the user, and then triggers the Webhook service of the Kubernetes cluster. The Webhook service will intercept the request and use the lfs project command to modify the quota value of the mounted path.

[0051] When the user submits a PVC deletion request, the CSI plugin starts to unbind the PVC and PV. At the same time, the quota management module starts the Helper Pod to release the Project ID associated with the PVC and delete the target directory. After completing these steps, the recycled Project ID is marked as unbound. When creating a new PVC later, the smallest unbound ID is preferentially allocated. When deleting a PVC, look up the Project ID bound to the deleted PVC in the mapping table; update the status of this Project ID to "unbound", and clear the PVC name associated with it.

[0052] Such as Figure 2The figure shows the architecture diagram of the Kubernetes storage system based on the Lustre file system, including: CSI plugin, quota management module, quota recycling module, Webhook module, and Lustre storage.

[0053] The CSI plugin is responsible for handling storage requests from the Kubernetes cluster, including operations such as the creation, binding, resizing, and deletion of PVCs. The quota management module assists in mounting the Lustre file system, allocating Project IDs, and managing quotas through the lightweight container service of the Helper Pod. The quota recycling module is responsible for maintaining the allocation and recycling of Project IDs to ensure that the smallest unbound ID is preferentially allocated. The Webhook module is used to monitor PVC capacity resizing requests, trigger dynamic quota modification operations, and respond in a timely manner to changes in storage requirements.

[0054] Specifically, the PVC is bound to the corresponding PV. For example, PVC1 is bound to the corresponding PV1, PVC2 is bound to the corresponding PV2, and PVC3 is bound to the corresponding PV3. In this pattern, each newly generated PVC will correspond one-to-one with a specified PV, and these PVCs and PVs are distributed in different Pods. It should be noted here that the number of Pods is not limited in this application, and multiple Pods can exist simultaneously. The CSI plugin is used to mount the storage, the quota management module mounts the Lustre file path, and assigns a unique smallest unbound Project ID to each path. For example, path 1 corresponds to Project ID: 1, path 2 corresponds to Project ID: 2, path 3 corresponds to Project ID: 3, and so on. The Webhook module is responsible for modifying the quota settings of the specified mount path. When the relationship between the PVC and the PV is unbound, the quota management module deletes the Project ID, and the quota recycling module manages the recycling of the Project ID.

[0055] Furthermore, as Figure 3The figure shows the schematic diagram of the PVC creation process. First, a PV is created based on the user's request. The CSI plugin searches for a PV that matches the request. The quota management module starts a Helper Pod to mount the Lustre storage path. If the system cannot find a suitable PV during this process, the quota management module will continue the mounting operation after creating a new PV. Subsequently, the system calculates the smallest unbound Project ID and binds it to the mounting path. If the mounting process is successfully completed, the Helper Pod returns a message indicating that the PVC is successfully bound to the PV. If the mounting process is not completed, the Helper Pod returns a message indicating that the PVC binding to the PV fails. Once the Project ID is successfully bound to the mounting path, the quota management module performs quota settings. If the quota settings are successful, the Helper Pod returns a success message, and the entire creation process is completed.

[0056] As Figure 4 The figure shows the schematic diagram of the PVC dynamic quota adjustment process. The user submits a capacity adjustment request. The CSI plugin receives the user's request to modify the PVC capacity. The Webhook service intercepts the request and uses the lfs project command to modify the storage quota under the specified mounting path. If the quota adjustment is successful, the system returns a message indicating that the PVC capacity modification is successful. Otherwise, if the quota modification fails, it returns a message indicating that the PVC capacity modification fails.

[0057] Furthermore, this application also includes the deletion process and recycling process of PVC in terms of PVC management. As Figure 5 The figure shows the schematic diagram of the PVC deletion process. When the user submits a request to delete a PVC, the CSI plugin starts to perform the operations of unbinding the PVC and PV. At the same time, the quota management module starts a Helper Pod to unbind the Project ID associated with the PVC. After the unbinding is successfully completed, the system unmounts the data at the target path. Otherwise, it returns a message indicating that the PVC deletion fails. After successfully unmounting the data, the system marks the recycled Project ID as unbound and deletes the association between the PVC and PV, and returns a message indicating that the PVC deletion is successful. The quota recycling process is as Figure 6 , the system creates a mapping table to record the binding relationship between each Project ID and the corresponding PVC. When the user requests to create a new PVC, the system finds the current smallest unbound Project ID in the mapping table, assigns the found Project ID to the new PVC, and then updates the status of this Project ID to "allocated" in the mapping table. When the user requests to delete a PVC, the system searches for the Project ID bound to the deleted PVC in the mapping table and updates the status of the bound ProjectID to "unbound".

[0058] Example 2

[0059] In a specific embodiment of the present application, the user submits a PVC creation request with a capacity of 100 GiB through the Kubernetes cluster, and the CSI Controller receives this PVC creation request. Create a PVC according to the request submitted by the user, find the PV corresponding to the newly created PVC, and bind it to the PVC. The quota management module enables the Helper Pod to mount the Lustre file system path, and the path is: / mnt / lustre / vol1; the quota management module calculates that the smallest unbound Project ID in the current system is 101, and assigns the Project ID to the path: / mnt / lustre / vol1 through the lfs project command; and sets a storage quota of 100 GiB for this path, generates a PV and binds it to the user's PVC, and the Helper Pod returns a creation success message. Record the binding relationship between the Project ID and the corresponding PVC in the mapping table.

[0060] The user requests to expand the capacity of the existing PVC from 100 GiB to 150 GiB. To implement this request, after the CSI plugin receives the PVC capacity adjustment request, it will trigger the Webhook service of the Kubernetes cluster. After the Webhook service monitors and captures the PVC capacity adjustment request, it adjusts the quota through the lfs project command. Specifically, the quota of the storage path / mnt / lustre / vol1 is modified to 150 GiB. After the quota adjustment is successful, the status of the PVC is updated synchronously.

[0061] The user submits a request to delete the PVC. The CSI plugin starts to unbind the PVC and the PV. The quota management module starts the Helper Pod to delete the / mnt / lustre / vol1 directory and related files located in the directory. During the deletion process, the quota management module also releases the Project ID 101 associated with the PVC. The quota management module looks up the Project ID bound to the deleted PVC in the mapping table; updates the status of the Project ID 101 to "unbound", and clears the PVC name information associated with the Project ID. The Project ID 101 enters the reusable state. When a new PVC request is submitted, the quota management module will preferentially allocate the reusable Project ID 101, effectively reducing the ID fragmentation problem and optimizing the resource utilization efficiency.

[0062] According to another aspect of the present application, there is also provided a Kubernetes storage device based on the Lustre file system, including: a creation module, a quota module, and an adjustment module;

[0063] The creation module is configured to create a PVC according to a user request and bind the PVC to the corresponding PV;

[0064] The quota module is configured to mount the Lustre file system path for the bound PVC and PV, and at the same time calculate the smallest unbound Project ID; assign the Project ID to the mount path and set the quota value;

[0065] The adjustment module is configured to receive a PVC capacity adjustment request, trigger the Webhook service, and modify the quota value of the mount path.

[0066] According to another aspect of the present application, there is also provided a Kubernetes storage device based on the Lustre file system, including a processor and a memory for storing processor-executable instructions. Wherein, the processor is configured to implement the Kubernetes storage method based on the Lustre file system described in any one of the foregoing when executing the executable instructions. Here, it should be noted that the number of processors can be one or more.

[0067] As a computer-readable storage medium, the memory can be used to store software programs, computer-executable programs, and various modules, such as: the programs or modules corresponding to the Kubernetes storage method based on the Lustre file system in the embodiments of the present application. The processor executes various functional applications and data processing of the Kubernetes storage device based on the Lustre file system by running the software programs or modules stored in the memory.

[0068] According to another aspect of the present application, there is also provided a non-volatile computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the Kubernetes storage method based on the Lustre file system described in any one of the foregoing is implemented.

[0069] In this application, an independent storage path and quota are set for each tenant or application instance through the Lustre Project ID attribute. The Webhook component is used to dynamically manage and adjust the Lustre quota settings to meet the resource isolation and quota control requirements in a multi-tenant environment and adapt to the real-time changes in storage requirements. The binding relationship between each Project ID and the PVC is recorded through a mapping table, and the smallest unbound ID is preferentially allocated to reduce the fragmentation problem of Project IDs and improve the utilization rate of storage resources. Based on the high-performance characteristics of the Lustre file system, stable operation in high I / O scenarios is ensured, effectively improving the storage management efficiency of Kubernetes.

[0070] The embodiments of the present application have been described above. The above description is exemplary and not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those of ordinary skill in the art in the technical field without departing from the scope and spirit of the described embodiments. The selection of the terms used herein is intended to best explain the principles of the embodiments, the practical application or the technical improvement of the technology in the market, or to enable other ordinary technical personnel in the technical field to understand the embodiments disclosed herein.

Claims

1. A Kubernetes storage method based on the Lustre file system, characterized in that: include: Create a PVC based on the user's request and bind the PVC to the corresponding PV; Mount the bound PVC and PV with the Lustre file system path, and calculate the minimum unbound ProjectID; Assign the Project ID to the mount path and set a quota value; Receive PVC capacity adjustment request, trigger Webhook service, and modify the quota value of the mount path.

2. The Kubernetes storage method based on the Lustre file system according to claim 1, characterized in that: When binding a PVC to a corresponding PV, the PV is searched and bound based on the CSI plug-in; If the corresponding PV is not found, a PV is created through the StorageClass specified by the user and then bound.

3. The Kubernetes storage method based on the Lustre file system according to claim 1, characterized in that: When the Lustre file system path is mounted on the bound PVC and PV, the Lustre file system path is mounted by enabling a lightweight container of a Helper Pod.

4. The Kubernetes storage method based on the Lustre file system according to claim 1, characterized in that: The step of assigning the Project ID to the mount path and setting the quota value also includes: Create a mapping table to record the binding relationship between each Project ID and the corresponding PVC; The mapping table records the status of each Project ID and the name of the PVC bound to it; The status of the Project ID includes at least one of allocated and unbound.

5. The Kubernetes storage method based on the Lustre file system according to claim 2, characterized in that: Creating a PV through a user-specified StorageClass includes: specifying the storage type and configuration through the StorageClass, and having the Provisioner automatically create a PV object and bind the PVC corresponding to the PV to the StorageClass.

6. The Kubernetes storage method based on the Lustre file system according to claim 4, characterized in that: When creating a PVC, check the mapping table to find the smallest unbound Project ID. Assign the found Project ID to the PVC and update the Project ID status to "assigned" in the mapping table. When deleting a PVC, the Project ID bound to the deleted PVC is searched in the mapping table; the status of the Project ID is updated to "unbound", and the PVC name associated with it is cleared.

7. A Kubernetes storage device based on the Lustre file system, characterized in that: include: Create modules, quota modules, and adjust modules; The creation module is configured to create a PVC according to a user request and bind the PVC to a corresponding PV; The quota module is configured to mount the bound PVC and PV with a Lustre file system path and calculate the minimum unbound Project ID; Assign the Project ID to the mount path and set a quota value; The adjustment module is configured to receive a PVC capacity adjustment request, trigger a Webhook service, and modify a quota value of a mounting path.

8. A Kubernetes storage device based on the Lustre file system, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 6 when executing the executable instructions.

9. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Kubernetes-based method and system for automatic allocation and creation of application storage

    CN107193504A

  • Kubernetes storage resource binding method, system and device based on position information and medium

    CN114327784A

  • Cloud native storage method and apparatus based on kubernetes, and device and medium

    WO2023226197A1