Disk capacity dynamic adjustment method and system based on Kubernetes

By using the overlayfs joint file system and dynamic adjustment mechanism on the Kubernetes platform, the problem of container disk usage limit is solved, effective management of container disks and reasonable allocation of resources is achieved, and the stable operation of the cluster is ensured.

CN119025222BActive Publication Date: 2024-12-31YUNBIAN CLOUD TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411516308.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2024-12-31
Estimated Expiration
2044-10-29

AI Technical Summary

Technical Problem

The existing Kubernetes platform cannot effectively limit the disk usage of Pods and containers, resulting in insufficient disk space or degradation of system performance.

Method used

The overlayfs joint file system is used to merge directories of different underlying file systems in the container to form a Rootfs container, and dynamically adjust it through the Kubernetes controller and the container disk controller to limit the disk usage of the container, including resource declaration, format verification, Node scheduling, capacity query and dynamic adjustment.

Benefits of technology

It effectively avoids excessive use of disk space in individual pods or containers, ensures reasonable allocation of cluster resources, realizes dynamic adjustment and limitation of container disks, supports a variety of container runtime and storage methods, and has good scalability and automated management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025222B_ABST
    Figure CN119025222B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for dynamically adjusting disk capacity based on Kubernetes, the method comprising: the Kubernetes controller performs resource declaration and format verification on the Pod to be used; the Kubernetes controller adjusts the Pod to be used to a node that meets the conditions; the Pod to be used is activated to form a Rootfs container including a Lower layer and an Upper layer to receive files, the Lower layer includes multiple Layer layers, and returns the result; after receiving the result returned by the Pod, the Kubernetes controller automatically notifies the container disk controller; queries the Rootfs container directory, and dynamically adjusts the container capacity of the Rootfs container to cope with the files to be received. The present invention supports dynamic adjustment of the disk size during container operation; the system layer restricts the disk to avoid affecting other containers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of container disk capacity limitation, and in particular relates to a method and system for dynamically adjusting disk capacity based on Kubernetes. Background Art

[0002] With the rapid development of container technology, Kubernetes has become the mainstream container orchestration and management platform. Kubernetes provides the ability to automatically deploy, scale and manage containerized applications. In enterprise-level applications, disk storage resources are one of the important computing resources, but the existing Kubernetes platform lacks direct means to limit the disk usage of Pods or containers, and cannot effectively prevent individual containers from overusing storage resources, resulting in insufficient disk space or system performance degradation. Therefore, there is an urgent need for a method that can effectively limit container disk usage in a Kubernetes cluster to ensure the stable operation of the cluster. Summary of the invention

[0003] The purpose of the present invention is to provide a disk usage restriction method that can be used for a Kubernetes container orchestration platform, so as to solve the problem that the prior art cannot directly and effectively restrict the disk usage of Pods and containers.

[0004] The present invention provides the following technical solution: a method for dynamically adjusting disk capacity based on Kubernetes, wherein the method uses an overlayfs joint file system to merge directories in different underlying file systems in a container, performs mirroring layering in the container, and forms a Rootfs container as a receiving file for different Pods, comprising the following steps:

[0005] S1: The Kubernetes controller performs resource declaration and format verification on the Pod to be used;

[0006] S2: The Kubernetes controller adjusts the Pod to be used to a node that meets the conditions;

[0007] S3: The Pod to be used is activated, forming a Rootfs container including a Lower layer and an Upper layer to receive the written file, wherein the Lower layer further includes multiple Layer layers, and returns the result;

[0008] S4: After receiving the result returned by the Pod, the Kubernetes controller automatically notifies the container disk controller;

[0009] S5: The container disk controller receives the notification, queries the Rootfs container directory of the container, and dynamically adjusts the container capacity of the Rootfs container to cope with the files to be received.

[0010] As a preferred embodiment of the present invention, the step S5 comprises the following steps:

[0011] S51: Build containers using space allocation for multiple different Rootfs containers in M ​​Pods:

[0012] ;

[0013] in, represents the space allocation of the i-th Rootfs container with K active users to the m-th Pod file written in M ​​Pods, K∈ A i , A i is the index set of active users in the i-th Rootfs container, is the M×M identity matrix, >0, is the attenuation coefficient during signal transmission; Represents the allocated used space allocation The mathematical expectation is 0 and the standard deviation is The complex Gaussian distribution of

[0014] S52: According to the used space allocation constructed in step S51, the total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously is constructed :

[0015] ;

[0016] in, is the probability matrix of allocation to the i-th Rootfs container with K active users, for The conjugate transposed matrix of is the predicted value of the probability of writing file capacity allocated to K active users in the i-th Rootfs container, The file dynamic adjustment error when a total of N Rootfs containers received by the mth Pod are used simultaneously. , The mathematical expectation is 0 and the standard deviation is The complex Gaussian distribution of

[0017] S53: According to the calculation result of step S52, calculate the write file capacity in the i-th Rootfs container with K active users :

[0018] ; is the probability of writing file capacity allocated to K active users in the i-th Rootfs container;

[0019] S54: Constructing a model to solve the optimal use of space allocation and write file capacity:

[0020]

[0021]

[0022]

[0023] in, The weight value of multiple Rootfs containers when receiving the total file write request issued by the Pod. is the mean square error of the write file capacity allocated to the K active users in the i-th Rootfs container, ; Dynamic adjustment factor for allocating write file capacity to Pod; is the highest probability threshold of the write file capacity allocated to the K active users in the i-th Rootfs container, , ;

[0024] S55: Continuously iterate and optimize the optimal use of the space allocation allocation frequency solution model constructed in step S54 to calculate the , , and , determine whether the calculation results of the xth generation converge, if so, stop the iteration and output as well as As the best and optimal , and substitute it into the calculation formula in the step S52 and the step S53 to obtain the optimal total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously and the optimal write file capacity in the i-th Rootfs container with K active users , the optimal total write file capacity when N Rootfs containers received by the mth Pod are used simultaneously Control the amount of file data transferred by Pod to different Rootfs containers, and control the i-th Rootfs container with K active users to write the file capacity at the optimal level Receive data allocated by Pod.

[0025] As a preferred embodiment of the present invention, the mean square error of the write file capacity allocated to the K active users in the i-th Rootfs container in step S54 is The calculation formula is:

[0026] ;

[0027] in, is the probability matrix of allocation to the i-th RootFS container with K active users The norm of .

[0028] As a preferred embodiment of the present invention, in the step S55, the dynamic adjustment factor of the file capacity allocated to the Pod is The update formula is as follows:

[0029] ;

[0030] in, Allocate an estimated value of the dynamic adjustment factor for the write file capacity for the x-1th generation Pod; is the square root of the write file capacity allocated to K active users in the i-th RootFS container of the x-1th generation, is the square root of the predicted value of the write file capacity allocated to K active users in the i-th Rootfs container of the x-1th generation;

[0031] .

[0032] As a preferred embodiment of the present invention, in the step S55, the weight values ​​of multiple Rootfs containers when receiving the total file write demand issued by the Pod are The update formula is as follows:

[0033] ;

[0034] in, The weight values ​​of multiple Rootfs containers when receiving the total file write requirements issued by the x-th generation Pod. is the mean square error of the write file capacity allocated to K active users in the i-th Rootfs container of the x-th generation;

[0035] .

[0036] The present invention also provides a Kubernetes-based disk capacity dynamic adjustment system using the above-mentioned method, the system includes a Kubernetes controller, a container disk controller and a Pod, the system also includes a resource declaration module, a file transfer node selection module, a container Rootfs mounting module, a Pod return result receiving module, and a container capacity dynamic adjustment module;

[0037] The resource declaration module is used to be adopted by the Kubernetes controller to perform resource declaration and format verification on the Pod;

[0038] The file transfer node selection module is used to be adopted by the Kubernetes controller to adjust the Pod to be used to the node that meets the conditions;

[0039] The container Rootfs mounting module is used to treat the Pod activation, form a container of the Rootfs including the Lower layer and the Upper layer, wherein the Lower layer includes multiple Layer layers, and return the result;

[0040] The Pod return result receiving module is used to be adopted by the Kubernetes controller to automatically notify the container disk controller after receiving the Pod return result;

[0041] The container capacity dynamic adjustment module is used to query the Rootfs container directory after the container disk controller receives the notification, and dynamically adjust the container capacity of the Rootfs container to cope with the files to be received.

[0042] The beneficial effects of the present invention are:

[0043] 1. Support dynamic adjustment of disk capacity of Kubernetes cluster and limit of write file capacity when multiple containers are running. The disk usage limitation method of the present invention can effectively avoid excessive use of disk space by individual Pods or containers, thereby ensuring the reasonable allocation of cluster resources.

[0044] 2. Combined with kubernetes resources, the declaration of container disk restrictions is implemented at the container orchestration layer. Automation and dynamic management: The method of the present invention is implemented through the native mechanism of Kubernetes, has good scalability and automated management capabilities, and can dynamically adjust disk usage restrictions according to needs.

[0045] 3. Set different disk limits according to different requirements. Therefore, the method provided by the present invention is applicable to a variety of scenarios. By combining persistent volumes, temporary storage and storage classes in different ways, the present invention can adapt to a variety of containerized application scenarios, including different requirements for performance and storage capacity.

[0046] 4. Support dynamic adjustment of disk size during container operation.

[0047] 5. In the process of dynamically adjusting the disk capacity according to the method provided by the present invention, when the disk resources reach the upper limit, the container will not be directly deleted.

[0048] 6. The system provided by the present invention restricts the disk, and there is no delay in periodic scanning, thereby avoiding affecting other containers. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The present invention will be described in more detail below based on embodiments and with reference to the accompanying drawings, wherein:

[0050] Figure 1 A schematic diagram of a process flow of a method for dynamically adjusting disk capacity based on Kubernetes provided by the present invention;

[0051] Figure 2 A schematic diagram of the structure of a disk capacity dynamic adjustment system based on Kubernetes provided by the present invention;

[0052] Figure 3 This is a graph comparing the experimental results of the method provided by the present invention and other comparative examples. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] like Figure 1 As shown, it is a flow chart of the method for dynamic adjustment of disk capacity based on Kubernetes provided by the present invention. The method uses the overlayfs joint file system to merge the directories in different underlying file systems in the container, performs mirroring layering in the container, and forms multiple Rootfs for the container to receive files as different Pods, including the following steps:

[0055] S1: The Kubernetes controller performs resource declaration and format verification on the Pod to be used;

[0056] S2: The Kubernetes controller adjusts the Pod to be used to the node that meets the conditions;

[0057] S3: The Pod to be used is activated, forming a Rootfs container including a Lower layer and an Upper layer to receive the written file. The Lower layer further includes multiple Layer layers, and returns the result.

[0058] S4: After receiving the result returned by the Pod, the Kubernetes controller automatically notifies the container disk controller;

[0059] S5: The container disk controller receives the notification, queries the Rootfs container directory of the container, and dynamically adjusts the container capacity of the Rootfs container to cope with the files to be received.

[0060] The method of the present invention effectively manages and limits the container disk usage in the Kubernetes cluster by setting the disk capacity in step S1, that is, adding the app.kubernetes.io / xfs_quota: xxGiB identifier. By requesting storage resources of a specified size, it ensures that the Pod and Rootfs containers can only use the declared disk capacity to prevent excessive use of storage space.

[0061] Kubernetes itself provides a way to limit resources. For each Pod, you can specify resource limits and requests, including the following:

[0062] spec.containers[].resources.limits.cpu

[0063] spec.containers[].resources.limits.memory

[0064] spec.containers[].resources.limits.ephemeral-storage

[0065] spec.containers[].resources.requests.cpu

[0066] spec.containers[].resources.requests.memory

[0067] spec.containers[].resources.requests.ephemeral-storage;

[0068] By declaring restrictions and requests for specific resources, the kubernete controller automatically selects the appropriate node to schedule the Pod.

[0069] CPU and memory are implemented through cgroup, but cgroup does not support disk (ephemeral-storage) restrictions, so kubelet performs regular and planned checks to scan each emptyDir volume, container log directory, and writable container layer.

[0070] In this mode, the kubelet does not track open file descriptors for deleted files. If you create a file inside a Pod, then some program opens the file, and you delete the file while it is still open, the inode of the deleted file will remain until you close the file, but the kubelet will not classify the space as in use.

[0071] At the same time, in the periodic scanning mode adopted by the present invention, Kubernetes will not find that the container disk has reached the upper limit and clean it up.

[0072] In step S1, when declaring resources for the Kubernetes cluster that requires disk capacity restrictions, add the "app.kubernetes.io / xfs_quota: xxGiB" identifier in the resource annotations. Then in step S2, the Kubernetes controller schedules the container to the appropriate node based on the algorithm.

[0073] In the S3 step, Kubelet calls the corresponding Pod runtime to build the Pod runtime environment. When the environment is built, Kubelet returns the result to the Kubernetes controller.

[0074] The container disk controller uses the informer mechanism of the kubernetes cluster to trigger the kubernetes controller to automatically push the resource declaration to the container disk controller. The container disk controller determines the disk size that needs to be limited for the container based on the annotations in the resource declaration, queries the directory of the Rootfs container, and calls xfsapi to limit the write file capacity of the Rootfs container according to the declared disk size.

[0075] In step S2, in the Kubernetes cluster, the main task of the Kubernetes controller is to automatically select a suitable node to run the new Pod based on the current state of the cluster. The Kubernetes controller will decide on which node to schedule the Pod based on the Pod's resource request, the node's available resources, and other policies (such as affinity, anti-affinity, etc.). When scheduling a Pod, the Kubernetes controller checks the Pod's ephemeral-storage resource request to ensure that there are sufficient storage resources on the node before the container is started.

[0076] In the S3 step, the container image layer is combined by mounting the container Rootfs to form a Rootfs container for the Pod to use by limiting the available capacity of the directory. The container image is a layered structure. An image is generally composed of multiple layers of images. Then, through the joint file system (overlay), the various image layers are combined to form the Rootfs for the container to use.

[0077] Overlayfs is a stacked file system that relies on and is built on top of other file systems (such as ext4fs and xfs, etc.). It does not directly participate in the division of disk space structure, but only "merges" different directories in the original underlying file system and then presents them to the user. Therefore, for the user, the content under the root directory of the overlay file system that it sees comes from the "collection" of different directories specified when mounting.

[0078] OverlayFS is very easy to use. Just use the mount command and specify the file system type as overlay (that is, OverlayFS) in the command, and then add OverlayFS-related parameters: lowerdir (the read-only layer in OverlayFS, which can specify multiple directories), upperdir (the read-write layer in OverlayFS), and merged (indicates the merged file system view displayed to the user after the mount operation is completed).

[0079] When adding, deleting, or modifying data in the merged directory, the OverlayFS file system implements the Copy-On-Write strategy. The basic principle of CoW can be explained by the following operations:

[0080] When creating a new file: the file will appear in the upper directory.

[0081] When deleting a file:

[0082] If you delete "in_upper.txt", the file will disappear in the upper directory.

[0083] If you delete "in_lower.txt", the "in_lower.txt" file in the lower directory will not change, but a special file will be added to the upper directory, indicating that "in_lower.txt" cannot appear in the merged directory, indicating that it has been deleted.

[0084] When modifying files: If you modify "in_lower.txt", a new "in_lower.txt" file will be created in the upper directory, containing the updated content, while the original file "in_lower.txt" in the lower directory will not be changed.

[0085] Preferably, step S5 comprises the following steps:

[0086] S51: Build containers using space allocation for multiple different Rootfs containers in M ​​Pods:

[0087] ;

[0088] in, represents the space allocation of the i-th Rootfs container with K active users to the m-th Pod file written in M ​​Pods, K∈ A i , A i is the index set of active users in the i-th Rootfs container, is the M×M identity matrix, >0, is the attenuation coefficient during signal transmission; Represents the allocated used space allocation The mathematical expectation is 0 and the standard deviation is The complex Gaussian distribution of

[0089] S52: Based on the used space allocation constructed in step S31, the total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously is constructed :

[0090] ;

[0091] in, is the probability matrix of allocation to the i-th Rootfs container with K active users, for The conjugate transposed matrix of is the predicted value of the probability of writing file capacity allocated to K active users in the i-th Rootfs container, The file dynamic adjustment error when a total of N Rootfs containers received by the mth Pod are used simultaneously. , The mathematical expectation is 0 and the standard deviation is The complex Gaussian distribution of

[0092] S53: According to the calculation result of step S52, calculate the write file capacity in the i-th Rootfs container with K active users :

[0093] ; is the probability of writing file capacity allocated to K active users in the i-th Rootfs container;

[0094] S54: Constructing a model to solve the optimal use of space allocation and write file capacity:

[0095]

[0096]

[0097]

[0098] in, The weight value of multiple Rootfs containers when receiving the total file write request issued by the Pod. is the mean square error of the write file capacity allocated to the K active users in the i-th Rootfs container, ; Dynamic adjustment factor for allocating write file capacity to Pod; is the highest probability threshold of the write file capacity allocated to the K active users in the i-th Rootfs container, , ;

[0099] S55: Calculated by continuously iterating and optimizing the optimal spatial allocation frequency solution model constructed in step S54 , , and , determine whether the calculation results of the xth generation converge, if so, stop the iteration and output as well as As the best and optimal , and substitute it into the calculation formula in step S52 and step S53 to obtain the optimal total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously and the optimal write file capacity in the i-th Rootfs container with K active users , the optimal total write file capacity when N Rootfs containers received by the mth Pod are used simultaneously Control the amount of file data transferred by Pod to different Rootfs containers, and control the i-th Rootfs container with K active users to write the file capacity at the optimal level Receive data allocated by Pod.

[0100] In the process of dynamically adjusting the container capacity in multiple Rootfs container directories and solving the optimal use of space allocation to write file capacity, it is achieved through the Xfs quota management tool. XFS is a high-performance file system mainly used for large data storage and processing. xfs_quota is a disk quota management tool provided by the XFS file system to limit and manage disk usage in the file system. It allows system administrators to set limits on disk space and the number of files to control the usage of users and groups in the file system.

[0101] The XFS quota mechanism is implemented by maintaining and monitoring disk usage for users and groups. System administrators can set space limits (i.e., the total number of bytes used by the file system) and inode limits (i.e., the number of files) for users and groups. When these limits are exceeded, the system blocks further write operations until the quotas are adjusted.

[0102] Preferably, the mean square error of the write file capacity allocated to the K active users in the i-th Rootfs container in step S54 is The calculation formula is:

[0103] ;

[0104] in, is the probability matrix of allocation to the i-th RootFS container with K active users The norm of .

[0105] Preferably, in step S55, the dynamic adjustment factor for the file capacity allocated to the Pod is The update formula is as follows:

[0106] ;

[0107] in, Allocate an estimated value of the dynamic adjustment factor for the write file capacity for the x-1th generation Pod; is the square root of the write file capacity allocated to K active users in the i-th RootFS container of the x-1th generation, is the square root of the predicted value of the write file capacity allocated to K active users in the i-th Rootfs container of the x-1th generation;

[0108] .

[0109] Preferably, in step S55, the weight values ​​of multiple Rootfs containers when receiving the total file write demand issued by the Pod The update formula is as follows:

[0110] ;

[0111] in, The weight values ​​of multiple Rootfs containers when receiving the total file write requirements issued by the x-th generation Pod. is the mean square error of the write file capacity allocated to K active users in the i-th Rootfs container of the x-th generation;

[0112] .

[0113] The present invention also provides a Kubernetes-based disk capacity dynamic adjustment system using the above method. The system includes a Kubernetes controller, a container disk controller and a Pod. The Kubernetes controller serves as a container orchestration platform and actually executes the startup and management of the container through the Pod runtime (docker, containerd, etc.).

[0114] Pod runtime is one of the core components for managing and running containers. It is responsible for the lifecycle management of Pods, including creating, starting, stopping, and deleting containers. Container runtime is a key component in the containerization technology stack, providing an interface for interacting with the operating system in order to effectively run containerized applications.

[0115] There are some differences in the disk capacity management of Pods when different container runtimes are running. Docker supports restrictions on container disk resources, while containerd does not. However, Kubernetes is not compatible with Docker disk resource management. Therefore, the size of container disks cannot be directly controlled at the Kubernetes resource level. At the same time, Docker only supports unified restrictions on all container disks and cannot be adjusted according to different scenarios.

[0116] In the context of the above technologies and requirements, based on the principle of container rootfs and the characteristics of Xfs quota, the container disk can be restricted. Compared with the restriction methods of kubernetes and docker, it is preferred that Figure 2 As shown, the system provided by the present invention also includes a resource declaration module, a file transfer node selection module, a container Rootfs mounting module, a Pod return result receiving module, and a container capacity dynamic adjustment module;

[0117] The resource declaration module is used by the Kubernetes controller to perform resource declaration and format verification on Pods.

[0118] The file transfer node selection module is used by the Kubernetes controller to adjust the Pod to be used to the node that meets the conditions;

[0119] The container Rootfs mounting module is used to treat the Pod activation, form a container of the Rootfs including the Lower layer and the Upper layer, where the Lower layer includes multiple Layer layers, and return the result;

[0120] The Pod return result receiving module is used by the Kubernetes controller to automatically notify the container disk controller after receiving the Pod return result;

[0121] The container capacity dynamic adjustment module is used to query the Rootfs container directory after the container disk controller receives the notification, and dynamically adjust the container capacity of the Rootfs container to cope with the files to be received.

[0122] The method provided by the present invention dynamically adjusts the capacity of a Rootfs (Note: capacity is a virtual concept, and the capacity of a Rootfs is actually a virtual space opened up from the real physical space). The dynamic adjustment module of the Rootfs container capacity declares the required virtual space and selects nodes that meet the requirements to actually perform the division of the physical space.

[0123] The following description is a further refinement of the file transfer node selection module. First, the total write file capacity received by the mth Pod when a total of N Pods are used simultaneously is constructed. , and then calculate the write file capacity in the i-th Rootfs container with K active users , and then construct the probability of writing file capacity allocated to K active users in the i-th Rootfs container , its predicted value And the probability matrix of allocation to the i-th Rootfs container with K active users The related optimal space allocation write file capacity solution model reduces the reconstruction error of the estimated write file capacity through continuous iterative optimization, and then obtains the write file capacity dynamic adjustment factor of the x-th generation Pod allocation signal after the x-1th generation iteration. , the estimated error is used to correct the estimated total write file capacity, thereby eliminating the influence of noise and improving the reconstruction accuracy of the total write file capacity, and then the optimized converged state is obtained. as well as , respectively as the optimal and optimal , respectively, to obtain the optimal total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously and the optimal total write file capacity in the i-th Rootfs container with K active users , the optimal total write file capacity when N Rootfs containers received by the mth Pod are used simultaneously Control Pod to transfer user file data to different regions, and control the i-th Rootfs container with K active users to write the optimal total file capacity Receive the data assigned by the Pod, use the optimization of residual to reduce and eliminate the influence of noise, continuously iterate and update the signal, and then optimize the limited modulation of the write file capacity of each Pod in the Kubernetes cluster after data matching and data simplification. Figure 3 As shown, Figure 3 The horizontal axis in the middle is the probability of each active user in each Rootfs container being allocated the write file capacity The vertical axis is the cumulative distribution function value of the write file capacity allocated to each active user in each Rootfs container using different methods to optimize the write file capacity allocated to each active user in each Rootfs container. The write file capacity dynamic adjustment factor of the Pod allocation signal using the method provided by the present invention and in the optimization process using the method provided by the present invention No update is performed as comparative example 1; in the optimization process using the method provided by the present invention, the weight values ​​of multiple Rootfs containers when receiving the total file write demand issued by the Pod No update is performed as comparative example 2; a convolutional neural network method is used to optimize the write file capacity allocated to each active user in each Rootfs container as comparative example 3; a fully connected deep neural network method is used to optimize the write file capacity allocated to each active user in each Rootfs container as comparative example 4. The optimization results of the method provided by the present invention and the optimization results of comparative examples 1-4 are statistically analyzed to obtain Figure 3 , Figure 3The cumulative distribution function curve of Comparative Example 3 represented by the dotted line in FIG. 1 is almost coincident with the cumulative distribution function curve of Comparative Example 2 represented by the solid line. Figure 3 It can be seen that the cumulative distribution function value of the method provided by the present invention is the highest under the same horizontal axis value. The larger the cumulative distribution function, the higher the probability of each active user in each Rootfs container being allocated to the channel capacity value represented by the horizontal axis value. The larger the probability, the greater the probability. Therefore, Figure 3 It can be seen that the method provided by the present invention optimizes the probability of each active user in each Rootfs container being allocated a write file capacity during the file information allocation and transmission process. The capacity value has the lowest decay, therefore, the accuracy and data clarity of dynamic adjustment of the file write capacity of each Rootfs container can be improved.

[0124] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0125] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0127] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for dynamically adjusting disk capacity based on Kubernetes, wherein the method uses the overlayfs joint file system to merge directories in different underlying file systems in the container, performs mirroring layering in the container, and forms a Rootfs container as a file receiving device for different Pods, characterized in that: The following steps are involved: S1: The Kubernetes controller performs resource declaration and format verification on the Pod to be used; S2: The Kubernetes controller adjusts the Pod to be used to a node that meets the conditions; S3: The Pod to be used is activated, forming a Rootfs container including a Lower layer and an Upper layer to receive the written file, wherein the Lower layer further includes multiple Layer layers, and returns the result; S4: After receiving the result returned by the Pod, the Kubernetes controller automatically notifies the container disk controller; S5: The container disk controller receives the notification, queries the Rootfs container directory of the container, and dynamically adjusts the container capacity of the Rootfs container to cope with the files to be received; The S5 step includes the following steps: S51: Build containers using space allocation for multiple different Rootfs containers in M ​​Pods: ; in, represents the space allocation of the i-th Rootfs container with K active users to the m-th Pod file written in M ​​Pods, K∈ A i , A i is the index set of active users in the i-th Rootfs container, is the M×M identity matrix, >0, is the attenuation coefficient during signal transmission; Represents the allocated used space allocation The mathematical expectation is 0 and the standard deviation is The complex Gaussian distribution of S52: According to the used space allocation constructed in step S51, the total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously is constructed : ; in, is the probability matrix of allocation to the i-th Rootfs container with K active users, for The conjugate transposed matrix of is the predicted value of the probability of writing file capacity allocated to K active users in the i-th Rootfs container, The file dynamic adjustment error when a total of N Rootfs containers received by the mth Pod are used simultaneously. , The mathematical expectation is 0 and the standard deviation is The complex Gaussian distribution of S53: According to the calculation result of step S52, calculate the write file capacity in the i-th Rootfs container with K active users : ; is the probability of writing file capacity allocated to K active users in the i-th Rootfs container; S54: Constructing a model to solve the optimal use of space allocation and write file capacity: in, The weight value of multiple Rootfs containers when receiving the total file write request issued by the Pod. is the mean square error of the write file capacity allocated to the K active users in the i-th Rootfs container, ; Dynamic adjustment factor for allocating write file capacity to Pod; is the highest probability threshold of the write file capacity allocated to the K active users in the i-th Rootfs container, , ; S55: Continuously iterate and optimize the optimal use of the space allocation allocation frequency solution model constructed in step S54 to calculate the , , and , determine whether the calculation results of the xth generation converge, if so, stop the iteration and output as well as As the best and optimal , and substitute it into the calculation formula in the step S52 and the step S53 to obtain the optimal total write file capacity when a total of N Rootfs containers received by the mth Pod are used simultaneously and the optimal write file capacity in the i-th Rootfs container with K active users , the optimal total write file capacity when N Rootfs containers received by the mth Pod are used simultaneously Control the amount of file data transferred by Pod to different Rootfs containers, and control the i-th Rootfs container with K active users to write the file capacity at the optimal level Receive data allocated by Pod.

2. The method for dynamically adjusting disk capacity based on Kubernetes according to claim 1, characterized in that: The mean square error of the write file capacity allocated to the K active users in the i-th Rootfs container in step S54 The calculation formula is: ; in, is the probability matrix of allocation to the i-th RootFS container with K active users The norm of .

3. The method for dynamic adjustment of disk capacity based on Kubernetes according to claim 1, characterized in that: In the step S55, the dynamic adjustment factor of the file capacity allocated to the Pod is The update formula is as follows: ; in, Allocate an estimated value of the dynamic adjustment factor for the write file capacity for the x-1th generation Pod; is the square root of the write file capacity allocated to K active users in the i-th RootFS container of the x-1th generation, is the square root of the predicted value of the write file capacity allocated to the K active users in the i-th Rootfs container of the x-1th generation; 。 4. The method for dynamically adjusting disk capacity based on Kubernetes according to claim 3 is characterized in that: In the step S55, the weight values ​​of multiple Rootfs containers when receiving the total file write demand issued by the Pod The update formula is as follows: ; in, The weight values ​​of multiple Rootfs containers when receiving the total file write requirements issued by the x-th generation Pod. is the mean square error of the write file capacity allocated to K active users in the i-th Rootfs container of the x-th generation; 。 5. A Kubernetes-based disk capacity dynamic adjustment system according to any one of the methods described in claims 1-4, wherein the system comprises a Kubernetes controller, a container disk controller and a Pod, characterized in that: The system also includes a resource declaration module, a file transfer node selection module, a container Rootfs mounting module, a Pod return result receiving module, and a container capacity dynamic adjustment module; The resource declaration module is used to be adopted by the Kubernetes controller to perform resource declaration and format verification on the Pod; The file transfer node selection module is used to be adopted by the Kubernetes controller to adjust the Pod to be used to the node that meets the conditions; The container Rootfs mounting module is used to treat the Pod activation, form a container of the Rootfs including the Lower layer and the Upper layer, wherein the Lower layer includes multiple Layer layers, and return the result; The Pod return result receiving module is used to be adopted by the Kubernetes controller to automatically notify the container disk controller after receiving the Pod return result; The container capacity dynamic adjustment module is used to query the Rootfs container directory after the container disk controller receives the notification, and dynamically adjust the container capacity of the Rootfs container to cope with the files to be received.