Search

CN-122018812-A - Method and device for adjusting storage space of container data volume

CN122018812ACN 122018812 ACN122018812 ACN 122018812ACN-122018812-A

Abstract

The invention provides a method and a device for adjusting storage space of a container data volume. The method aims at the scene that kata safe containers use external iscsi disks as data volumes, when a container storage plug-in controller module (controller) receives a capacity expansion request, firstly, the iscsi LUN is expanded on an external storage system, then the operation of scanning the disks is carried out on a host machine operated by the container, the new iscsi disk size is obtained, a container storage plug-in node module informs kata of the updated data volume size of the container, finally, kata-agent operated in a kata virtual machine refreshes the virtual disk space size after receiving the capacity expansion request, and expands the capacity of a file system on the virtual disk in a mounting state, and finally, capacity expansion processing is completed.

Inventors

  • ZHANG HUIJIAN

Assignees

  • 济南浪潮数据技术有限公司

Dates

Publication Date
20260512
Application Date
20260210

Claims (10)

  1. 1. A method of adjusting storage space of a container data volume, comprising: s1, monitoring the change of a storage space size field of a persistent volume declaration PVC corresponding to a container data volume, and triggering a capacity expansion flow when the update of the storage space size field is detected; S2, calling VolumeResize interfaces of a container storage plug-in controller module, acquiring management IP addresses, storage pool names and user authentication information of an external storage system, and calling the management interfaces of the external storage system to expand the capacity of the iSCSI LUNs; S3, scanning a SCSI bus on a host computer through a container storage plug-in node module, acquiring the updated iSCSI disk size, and informing kata that the virtual machine disk size where the container is located is changed through a block_restore message of the QEMU; S4, sending a gRPC request for expanding the volume of the data to a kata-agent process in the kata virtual machine, after receiving the request, scanning a disk list in the virtual machine by the kata-agent, updating virtio-blk equipment size, and calling a file system expansion command to complete online expansion of the file system when the file system is in a mounted state.
  2. 2. The method of claim 1, wherein S1 comprises: S11, monitoring the change of the resources, requests and storage fields of the PVC object in real time through a listener in the Kubernetes auxiliary container; and S12, when the increase of the resource field value is detected, generating and sending a capacity expansion event to a controller module of the container storage plug-in.
  3. 3. The method of claim 1, wherein S2 comprises: S21, inquiring corresponding StorageClass configuration according to storageClassName fields of the PVC, and extracting a management IP address and a storage pool name of the external storage system from the configuration; S22, user authentication information of the back-end storage system is obtained through Kubernetes Secret objects, wherein the user authentication information comprises an administrator user name and an encrypted password, and identity verification is carried out when a management interface is called.
  4. 4. The method of claim 1, wherein S4 comprises: S41, after receiving gRPC request, kata-agent scans virtio-blk equipment in the virtual machine to confirm that the corresponding disk size is updated; And S42, if the file system is detected to be in the mounting state, a hidden file is created under the root directory of the file system, the file system_restore is recorded, the beginning time of the expansion operation is recorded, and the file is deleted after the expansion is successful.
  5. 5. The method as recited in claim 1, further comprising: And S5, when the expansion operation is interrupted by node downtime or other anomalies, detecting that the file system_restore file exists when the container is started next time, automatically triggering the file system expansion flow to finish the expansion operation which is not finished before.
  6. 6. An apparatus for adjusting storage space of a container data volume, comprising: the monitoring module is used for monitoring the change of the storage space size field of the persistent volume declaration PVC corresponding to the container data volume, and triggering the capacity expansion flow when the update of the storage space size field is detected; the capacity expansion request module is used for calling the VolumeResize interface of the container storage plug-in controller module, acquiring the management IP address, the storage pool name and the user authentication information of the external storage system, and calling the management interface of the external storage system to expand the iSCSI LUN; The disk updating module is used for scanning a SCSI bus on the host computer through the container storage plug-in node module, acquiring the updated iSCSI disk size, and notifying kata that the virtual machine disk size where the container is located is changed through a block_restore message of the QEMU; The container notification module is used for sending a gRPC request for expanding the volume of the data to a kata-agent process in the kata virtual machine, after receiving the request, the kata-agent scans a disk list in the virtual machine, updates virtio-blk equipment size, and calls a file system expansion command to complete online expansion of the file system when the file system is in a mounted state.
  7. 7. The apparatus of claim 2, wherein the listening module is further to: monitoring the change of the resources, requests and storage fields of the PVC object in real time through a listener in the Kubernetes auxiliary container; When an increase in the resource request field value is detected, a dilatation event is generated and sent to the controller module of the container storage plug-in.
  8. 8. The apparatus of claim 3, wherein the capacity expansion request module is further to: inquiring corresponding StorageClass configuration according to storageClassName fields of the PVC, and extracting a management IP address and a storage pool name of the external storage system from the configuration; user authentication information of the back-end storage system, including an administrator user name and an encrypted password, is obtained through Kubernetes Secret objects, and identity verification is performed when the management interface is called.
  9. 9. The apparatus of claim 4, wherein the container notification module is further to: kata-agent after receiving gRPC request, firstly scanning virtio-blk equipment in the virtual machine to confirm that the corresponding disk size is updated; If the file system is detected to be in the mounting state, a hidden file is created under the root directory of the file system, the file system_restore is recorded, the starting time of the capacity expansion operation is recorded, and the file is deleted after the capacity expansion is successful.
  10. 10. The apparatus as recited in claim 5, further comprising: And the abnormal recovery module is used for detecting that the file system_restore file exists when the expansion operation is interrupted by node downtime or other abnormal conditions and then automatically triggering the file system expansion flow to complete the expansion operation which is not completed before.

Description

Method and device for adjusting storage space of container data volume Technical Field The present disclosure relates to the field of storage and expansion of container data volumes, and in particular, to a method and apparatus for adjusting a storage space of a container data volume. Background With the rapid development of cloud computing and containerization technologies, kubernetes has taken an important role in enterprise-level application deployment as a core component of the containerization system. In the Kubernetes environment, the container storage plugin (CSI) implements dynamic management of container data volumes through the collaborative operation of the controller module and the Node module. Specifically, the storage system covers key links from storage resource application, volume creation and mounting, to capacity expansion and unloading of data volumes, wherein PVC (PersistentVolumeClaim) is used for describing the requirement of a container on storage resources, and an external storage system provides persistent storage capability through an iSCSI protocol. In order to improve the safety of container operation, kata containers are based on a lightweight virtualization technology, and isolation between the container and a host is realized through a customized QEMU virtual machine, so that a container operation environment with both safety and performance is constructed. However, the use of iSCSI disks as data volumes for Kata containers in the prior art generally lacks a complete mechanism to achieve dynamic expansion of storage space during container operation. Specifically, the conventional container expansion operation often depends on manual intervention or needs to interrupt container service, so that the application continuity is damaged, while Kata containers have isolation advantages, but the expansion cooperative mechanism of the Kata containers and an external storage system is not perfect, and particularly after iSCSI LUN expansion, links such as disk information synchronization between a host and a virtual machine, online file system adjustment and the like have obvious defects. In addition, if the node is abnormally interrupted, such as downtime, in the capacity expansion process, the existing scheme cannot automatically recover incomplete capacity expansion operation, so that the stability and the operation and maintenance efficiency of the system are affected. Based on this, a technical solution capable of realizing automatic, continuous and recoverable capacity expansion of a storage space of a container data volume in operation is needed, so as to meet urgent demands for high available storage in a cloud primary environment. Disclosure of Invention The present invention aims to solve at least one of the technical problems in the related art to some extent. The invention provides a method for adjusting storage space of a container data volume. Another object of the present invention is to provide an apparatus for adjusting storage space of a container data volume. To achieve the above object, an embodiment of a first aspect of the present invention provides a method for adjusting a storage space of a container data volume, including: s1, monitoring the change of a storage space size field of a persistent volume declaration PVC corresponding to a container data volume, and triggering a capacity expansion flow when the update of the storage space size field is detected; S2, calling VolumeResize interfaces of a container storage plug-in controller module, acquiring management IP addresses, storage pool names and user authentication information of an external storage system, and calling the management interfaces of the external storage system to expand the capacity of the iSCSI LUNs; S3, scanning a SCSI bus on a host computer through a container storage plug-in node module, acquiring the updated iSCSI disk size, and informing kata that the virtual machine disk size where the container is located is changed through a block_restore message of the QEMU; S4, sending a gRPC request for expanding the volume of the data to a kata-agent process in the kata virtual machine, after receiving the request, scanning a disk list in the virtual machine by the kata-agent, updating virtio-blk equipment size, and calling a file system expansion command to complete online expansion of the file system when the file system is in a mounted state. In one embodiment of the present invention, the S1 includes: S11, monitoring the change of the resources, requests and storage fields of the PVC object in real time through a listener in the Kubernetes auxiliary container; and S12, when the increase of the resource field value is detected, generating and sending a capacity expansion event to a controller module of the container storage plug-in. In one embodiment of the present invention, the S2 includes: S21, inquiring corresponding StorageClass configuration according to storageClassName fields of the PVC,