Resource scheduling method and device of kubernetes cluster, storage medium and electronic equipment
By introducing new custom resource types into the Kubernetes cluster, the increase and decrease of capacity configuration information is solved, and the problem that persistent storage volumes do not support automatic scaling is achieved, dynamic scaling and scaling of storage volumes is achieved, and resource utilization efficiency is improved.
Patent Information
- Application Number
- CN202411688840.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, persistent storage volumes do not support automatic capacity reduction. Users can only expand the storage volume by increasing the storage request size, but cannot achieve capacity reduction.
By introducing new custom resource types into the Kubernetes cluster, a second persistent volume declaration of predefined types is created, which supports the increase and decrease of capacity configuration information, thereby achieving capacity expansion and reduction of storage volumes.
It realizes automatic expansion and shrinking of persistent storage volumes in Kubernetes clusters, meets the dynamic scheduling requirements of storage resources, and improves resource utilization efficiency.
Smart Images

Figure CN119536949A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a resource scheduling method, device, storage medium and electronic device for a Kubernetes cluster. Background Art
[0002] In actual applications, a large number of Kubernetes users will use persistent storage volumes to store application data or logs. The universal container storage interface provided by the Kubernetes platform can dynamically allocate and configure storage and automate storage requests.
[0003] In the process of implementing the present disclosure, it was found that there are at least the following technical problems in the prior art: users apply for persistent storage volumes by creating persistent volume declarations. During use, the automatic expansion of storage volumes can be achieved by increasing the storage request size in the persistent volume declaration. However, automatic reduction of storage volumes is not supported. Summary of the invention
[0004] The present disclosure provides a resource scheduling method for a Kubernetes cluster to create a persistent storage volume and support expansion and reduction of the persistent storage volume.
[0005] According to one aspect of the present disclosure, a resource scheduling method for a Kubernetes cluster is provided, comprising:
[0006] In response to a resource scheduling request, create a first persistent volume declaration and a second persistent volume declaration of a predefined type, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information;
[0007] Associating the pre-created pod node with the first persistent volume claim;
[0008] Create a storage volume based on the first persistent volume declaration, and mount the storage volume to the pod node.
[0009] Optionally, the creation of a first persistent volume declaration and a second persistent volume declaration of a predefined type includes: creating a second persistent volume declaration of the predefined type; and upon monitoring the second persistent volume declaration, creating the first persistent volume declaration based on the second persistent volume declaration, wherein the first persistent volume declaration and the second persistent volume declaration respectively correspond to the same identifier.
[0010] Optionally, the method also includes: in response to a capacity update request for the second persistent volume declaration, updating the capacity configuration information in the second persistent volume declaration; the capacity update request includes a capacity increase request and a capacity decrease request; and when a change is detected in the second persistent volume declaration, performing capacity change processing on the storage volume.
[0011] Optionally, the method further includes: in response to a capacity update request for the first persistent volume declaration, updating capacity configuration information in the second persistent volume declaration; the capacity update request includes a capacity increase request; and when a change is detected in the first persistent volume declaration, performing capacity change processing on the storage volume.
[0012] Optionally, the performing capacity change processing on the storage volume includes: updating a storage resource quota of the storage volume according to capacity configuration information in the capacity update request.
[0013] Optionally, the method further includes: sending capacity update information to the storage pool to update the available resources of the storage pool.
[0014] Optionally, the method further includes: in response to a query request, displaying resource information corresponding to the storage volume mounted on the created pod node, the resource information including resource quantity and resource utilization.
[0015] According to another aspect of the present disclosure, a resource scheduling device for a Kubernetes cluster is provided, comprising:
[0016] A persistent volume declaration creation module, configured to create a first persistent volume declaration and a second persistent volume declaration of a predefined type in response to a resource scheduling request, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information;
[0017] A storage volume creation module is used to associate a pre-created pod node with the first persistent volume declaration; create a storage volume based on the first persistent volume declaration, and mount the storage volume to the pod node.
[0018] According to another aspect of the present disclosure, an electronic device is provided, the electronic device comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the resource scheduling method of the Kubernetes cluster described in any embodiment of the present disclosure.
[0022] According to another aspect of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource scheduling method of the Kubernetes cluster described in any embodiment of the present disclosure when executed.
[0023] The technical solution of the embodiment of the present disclosure introduces a new Kuberentes custom resource type. During the storage volume creation process, a second persistent volume declaration of a predefined type is created. The second persistent volume declaration supports the increase and decrease adjustment of the capacity configuration information, and further supports the expansion and reduction of the created storage volume. By creating a corresponding first persistent volume declaration based on the second persistent volume declaration and creating a storage volume based on the first persistent volume declaration, the scheduling of storage resources for pod nodes is realized.
[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 It is a schematic diagram of the storage volume creation process;
[0027] Figure 2 It is a flow chart of a resource scheduling method of a Kubernetes cluster provided by an embodiment of the present disclosure;
[0028] Figure 3 is a schematic diagram of a resource scheduling method provided by an embodiment of the present disclosure;
[0029] Figure 4 It is a flowchart of a resource scheduling method provided by an embodiment of the present disclosure;
[0030] Figure 5 It is a structural diagram of a resource scheduling device for a Kubernetes cluster provided in an embodiment of the present disclosure.
[0031] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present disclosure, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present disclosure.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0034] The following is a brief description of the technical field and related terms of the embodiments of the present application.
[0035] Kubernetes is a container-based cluster management system. It is built on container operating environments such as Docker and Container, and is used to manage containerized workloads and services. It is a portable and scalable open source platform with a large and rapidly growing ecosystem whose services, support and tools are widely available.
[0036] A Pod node is the smallest deployable computing unit created and managed in Kubernetes, containing one or more containers that share storage, networks, and declarations on how to run these containers. A Pod node models an application-specific "logical host" that contains one or more application containers that are relatively tightly coupled together.
[0037] PV (PersistentVolume) is a piece of storage in the cluster that can be provisioned in advance by an administrator or dynamically provisioned using a Storage Class. A PersistentVolume is a cluster resource, just like a Node is a cluster resource. PV persistent volumes are implemented using volume plugins just like regular Volumes, but they have a lifecycle independent of any Pod that uses the PV.
[0038] PVC (Persistent Volume Claim) expresses a user's request for storage. It is similar to Pod in concept. Pod consumes node resources, while PVC claim consumes PV resources. Pod can request a specific amount of resources (CPU and memory); similarly, PVC claim can also request a specific size and access mode.
[0039] StorageClass provides a way for administrators to describe storage "classes". Different types may be mapped to different quality of service levels or backup policies, or arbitrary policies set by the cluster administrator.
[0040] See also Figure 1 , Figure 1 It is a schematic diagram of the storage volume creation process. On the storage pool side, the administrator describes the storage pool by setting the storage class. The storage pool is used to provide storage resources, that is, the storage class is the description information of the storage pool. Optionally, there can be multiple storage pools, and each storage pool can correspond to a storage class. For example, the storage class can be the StorageClass class.
[0041] In the kubernetes cluster, in response to the resource scheduling request input by the user, a persistent volume declaration PVC is created. The persistent volume declaration PVC is the native persistent volume declaration of the kubernetes cluster. In response to the creation request for the pod node, the pod node is created and the pod node is associated with the persistent volume declaration PVC. The controller of the kubernetes cluster creates a storage volume PV based on the persistent volume declaration PVC and mounts the storage volume on the pod node.
[0042] It is understandable that the persistent volume declaration PVC may include capacity configuration information. The controller performs resource scheduling in the storage pool corresponding to the storage class based on the capacity configuration information in the persistent volume declaration PVC and the storage class associated with the persistent volume declaration PVC, and creates a storage volume corresponding to the capacity configuration information. Taking the capacity configuration information of 50G as an example, the storage resource limit of the storage volume is 50G. The storage volume is mounted on the pod node, and accordingly, the pod node can use the storage resources of the above storage volume for data storage. Accordingly, the storage resources corresponding to the capacity configuration information are divided out in the storage pool as the storage resources of the storage volume.
[0043] Optionally, the above resource scheduling process can be executed by the persistent volume management module of the Kubernetes cluster. Figure 1 In the case where the storage volume resources corresponding to the pod node are insufficient, the capacity configuration information of the storage volume can be increased to achieve the expansion of the storage volume. The controller receives the user's request to adjust the capacity configuration information in the persistent volume declaration PVC, verifies the target capacity configuration information in the adjustment request, and completes the verification if the target capacity configuration information is greater than the original capacity configuration information in the persistent volume declaration PVC. The controller updates the persistent volume declaration PVC. When the controller detects changes in the persistent volume declaration PVC, it expands the storage volume based on the updated persistent volume declaration PVC.
[0044] It should be noted that during the verification process of the capacity configuration information of the persistent volume declaration PVC, if the target capacity configuration information is greater than the original capacity configuration information in the persistent volume declaration PVC, the verification is completed; if the target capacity configuration information is less than the original capacity configuration information in the persistent volume declaration PVC, the verification fails. Figure 1 The storage volumes in can only be expanded, not reduced.
[0045] In response to the above technical problem, the present disclosure provides a resource scheduling method for a Kubernetes cluster, which can expand and shrink the storage volume. Figure 2 This is a flow chart of a resource scheduling method for a kubernetes cluster provided by an embodiment of the present disclosure. This embodiment can be applied to creating a storage volume and supports increasing or decreasing the capacity of the storage volume. The method can be executed by a resource scheduling device for a kubernetes cluster. The resource scheduling device for the kubernetes cluster can be implemented in the form of hardware and / or software. The resource scheduling device for the kubernetes cluster can be configured in a computer or server. Figure 2 As shown, the method includes:
[0046] S110. In response to a resource scheduling request, create a first persistent volume declaration and a second persistent volume declaration of a predefined type, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the Kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information.
[0047] S120. Associate the pre-created pod node with the first persistent volume declaration.
[0048] S130. Create a storage volume based on the first persistent volume declaration, and mount the storage volume to the pod node.
[0049] In this embodiment, the resource scheduling request can be understood as a request for scheduling storage resources for the pod node. Optionally, an interactive page is displayed, and a resource scheduling request is generated in response to a preset request in the interactive page. Among them, the interactive page may include an information collection control and a resource scheduling control, and the configuration information input by the user can be obtained through the information collection control. The configuration information may include but is not limited to capacity configuration information and storage pool information. The storage pool information may be attribute information of the target storage pool, such as but not limited to storage type, etc. In response to a click operation on the resource scheduling control, a resource scheduling request carrying the configuration information is generated.
[0050] Optionally, the persistent volume management module of the kubernetes cluster receives the resource scheduling request and executes the resource scheduling request to implement storage resource scheduling and schedule storage resources for the pod node.
[0051] In this embodiment, a new Kuberentes custom resource type (CR, Custom Resources) is introduced in the kubernetes cluster, which can be marked as BenVolume. Accordingly, in response to the resource scheduling request, a first persistent volume declaration and a second persistent volume declaration are created, wherein the first persistent volume declaration is the native persistent volume declaration PVC of the kubernetes cluster, and the second persistent volume declaration is a predefined type of persistent volume declaration BenVolume.
[0052] The first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, wherein the first persistent volume declaration supports the increase adjustment of the capacity configuration information, and the second persistent volume declaration supports the increase adjustment and decrease adjustment of the capacity configuration information. It can be understood that the increase adjustment of the capacity configuration information can be used to achieve the expansion of the storage volume, and the decrease adjustment of the capacity configuration information is used to achieve the reduction of the storage volume. In the case that the native persistent volume declaration of the Kubernetes cluster (i.e., the first persistent volume declaration) does not support the reduction of the storage volume, the reduction of the storage volume in the Kubernetes cluster is achieved by introducing a second persistent volume declaration of a predefined type.
[0053] Optionally, the first persistent volume declaration and the second persistent volume declaration may be created by: creating a second persistent volume declaration of the predefined type; and upon monitoring the second persistent volume declaration, creating the first persistent volume declaration based on the second persistent volume declaration, wherein the first persistent volume declaration and the second persistent volume declaration respectively correspond to the same identifier.
[0054] In this embodiment, the kubernetes cluster or the persistent volume management module of the kubernetes cluster includes a controller, and the controller can monitor the first persistent volume declaration and the second persistent volume declaration. For example, the first persistent volume declaration and the second persistent volume declaration can be monitored through a watch listener.
[0055] The resource scheduling request includes configuration information, which can be understood as information required to create a persistent volume declaration, such as but not limited to capacity configuration information and information about the storage pool. A second persistent volume declaration of a predefined type is created based on the configuration information. When the controller detects a newly added second persistent volume declaration, it creates a first persistent volume declaration corresponding to the second persistent volume declaration based on the second persistent volume declaration. Specifically, the first persistent volume declaration is created based on the identifier of the second persistent volume declaration and the configuration information in the second persistent volume declaration, and the identifier of the first persistent volume declaration is the same as the identifier of the second persistent volume declaration. By setting the same identifier, it is easy to identify the first persistent volume declaration and the second persistent volume declaration that have a corresponding relationship.
[0056] The first persistent volume claim and the second persistent volume claim are respectively associated with the storage pool. Specifically, the first persistent volume claim and the second persistent volume claim are respectively associated with the storage class of the storage pool.
[0057] The controller creates a storage volume based on the native logic of the kubernetes cluster and mounts the storage volume on the pod node. Specifically, the controller creates a storage volume in the storage pool corresponding to the storage class based on the capacity configuration information in the first persistent volume declaration and the storage class associated with the first persistent volume. The storage resource limit of the storage volume is determined based on the capacity configuration information.
[0058] The pod node may be pre-created, or may be created according to a creation request of the pod node, which is not limited here.
[0059] For example, see Figure 3 , Figure 3It is a schematic diagram of the resource scheduling method provided by an embodiment of the present disclosure. Among them, on the storage system side, the storage pool is described by a storage class. In the Kuberentes cluster, in response to the resource scheduling request input by the user, a second persistent volume declaration BenVolume is created, and when the newly added second persistent volume declaration BenVolume is monitored through the controller, a first persistent volume declaration PVC with the same identifier as the second persistent volume declaration BenVolume is created. In response to the creation request of the pod node, a pod node is created, and the pod node is associated with the first persistent volume declaration PVC with the same identifier as the second persistent volume declaration BenVolume. The controller includes native logic, and a storage volume is created based on the first persistent volume declaration PVC by the controller, and the storage volume is mounted on the above-mentioned pod node, so as to schedule storage resources for the pod node.
[0060] The technical solution provided in this embodiment introduces a new Kuberentes custom resource type. During the storage volume creation process, a second persistent volume declaration of a predefined type is created. The second persistent volume declaration supports the increase and decrease adjustment of capacity configuration information, and further supports the expansion and reduction of the created storage volume. By creating a corresponding first persistent volume declaration based on the second persistent volume declaration and creating a storage volume based on the first persistent volume declaration, storage resources are scheduled for pod nodes.
[0061] Figure 4 This is a flow chart of a resource scheduling method provided by an embodiment of the present disclosure, which is optimized on the basis of the above embodiment to achieve the reduction and / or expansion of storage volumes. Specifically, the method includes:
[0062] S210. In response to a resource scheduling request, create a first persistent volume declaration and a second persistent volume declaration of a predefined type, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools, respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the Kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information.
[0063] S220. Associating the pre-created pod node with the first persistent volume declaration; creating a storage volume based on the first persistent volume declaration, and mounting the storage volume to the pod node.
[0064] S230. In response to a capacity update request for the second persistent volume declaration, update the capacity configuration information in the second persistent volume declaration; the capacity update request includes a capacity increase request and a capacity decrease request; when a change is detected in the second persistent volume declaration, perform capacity change processing on the storage volume.
[0065] The capacity update request can be understood as a request to update the capacity configuration information in the second persistent volume declaration, wherein the capacity update request may include a capacity increase request and a capacity decrease request, the capacity increase request is used to increase the capacity configuration information in the second persistent volume declaration to achieve expansion of the storage volume, and the capacity decrease request is used to decrease the capacity configuration information in the second persistent volume declaration to achieve reduction of the storage volume.
[0066] The capacity update request may be generated according to a capacity update operation of a user. The capacity update request may be generated according to a requirement to update capacity configuration information of a created storage volume. For example, the capacity update request may be generated when the storage resources of the created storage volume are insufficient or when the storage resources of the created storage volume are excessive.
[0067] Optionally, in response to a query request, resource information corresponding to the storage volume mounted on the created pod node is displayed, the resource information including resource quantity and resource utilization. The resource quantity may be the storage resource quota corresponding to the storage volume, that is, the total resource quantity. The resource utilization may be the ratio of the used resource quantity to the resource quantity. Optionally, the resource utilization corresponding to the storage volume may be one or more of the historical maximum resource utilization, the historical average resource utilization, and the current resource utilization.
[0068] By displaying the resource amount and resource utilization of each storage volume, users can obtain the resource usage of the storage volume to expand or reduce the capacity of each storage volume. Exemplarily, if the resource utilization of the storage volume exceeds the first threshold (for example, it may be), it indicates that the storage resources of the storage volume are insufficient; if the resource utilization of the storage volume is less than the second threshold, it indicates that the storage resources of the storage volume are excessive, wherein the first threshold is greater than the second threshold. Exemplarily, the available resource amount of the storage volume is determined based on the resource amount and the resource utilization; if the available resource amount of the storage volume is less than the third threshold, it indicates that the storage resources of the storage volume are insufficient; if the available resource amount of the storage volume is greater than the fourth threshold, it indicates that the storage resources of the storage volume are excessive, wherein the fourth threshold is greater than the third threshold.
[0069] You can expand the capacity of storage volumes with insufficient storage resources, and reduce the capacity of storage volumes with excess storage resources.
[0070] In some embodiments, the query request may be executed based on a preset time period to periodically query the resource information of each storage volume, so as to facilitate timely expansion or reduction of each storage volume.
[0071] In some embodiments, during the resource scheduling process of a newly added pod node, if there are insufficient resources in the storage pool, a query request can be triggered to query the resource information of each storage volume, and by shrinking one or more storage volumes, invalid occupation of storage resources can be avoided.
[0072] In some embodiments, a scheduled task may be set to query the resource information of the storage volume and determine the resource information of the storage volume to generate capacity update prompt information. If it is detected that the storage resources of any storage volume are insufficient, a capacity expansion prompt information of the storage volume is generated; if it is detected that the storage resources of any storage volume are excessive, a capacity reduction prompt information of the storage volume is generated.
[0073] A capacity update request may be generated based on the capacity update prompt information, or the capacity update prompt information may be displayed and a capacity update request may be generated based on the user's capacity update operation. The capacity update request here may be a capacity update request for the second persistent volume declaration, and the second persistent volume declaration supports increasing and decreasing adjustments to the capacity configuration information.
[0074] The second persistent volume declaration includes a capacity configuration field, and the field content of the capacity configuration field is the capacity configuration information. The capacity update request of the second persistent volume declaration may be an update request for the field content of the capacity configuration field in the second persistent volume declaration to update the value of the capacity configuration information, for example, the capacity configuration information may be updated from 500G to 100G, or from 100G to 500G, etc.
[0075] When the controller monitors the change of the second persistent volume declaration, it performs capacity change processing on the storage volume, for example, it can be expansion processing or reduction processing. In some embodiments, the controller may include a storage plug-in scaler, and the storage volume is expanded or reduced through the storage plug-in scaler.
[0076] In the following embodiment, the method further includes: in response to a capacity update request for the first persistent volume declaration, updating the capacity configuration information in the second persistent volume declaration; the capacity update request includes a capacity increase request; and upon monitoring that the first persistent volume declaration has changed, performing capacity change processing on the storage volume. The first persistent volume declaration supports increasing adjustment of the capacity configuration information to achieve capacity expansion of the storage volume. The capacity configuration information carried in the capacity update request is verified, and when the capacity configuration information carried in the capacity update request is greater than the original capacity configuration information in the first persistent volume declaration, the original capacity configuration information in the first persistent volume declaration is updated to the capacity configuration information carried in the capacity update request. When the controller monitors that the first persistent volume declaration has changed, it performs capacity change processing on the storage volume.
[0077] Optionally, performing capacity change processing on the storage volume includes: updating the storage resource quota of the storage volume according to the capacity configuration information in the capacity update request. For example, if the capacity configuration information in the capacity update request is 100G, the storage resource quota of the storage volume is updated to 100G accordingly.
[0078] Optionally, the storage volume is controlled to send capacity update information to the storage pool to update the available resources of the storage pool. The storage pool adjusts the storage space corresponding to the storage volume based on the capacity update information. Taking the capacity reduction request as an example, the capacity update information controlled to be sent to the storage pool may include the updated storage resource quota (or capacity configuration information). The storage pool adjusts the storage space corresponding to the storage volume based on the storage resource quota and releases excess storage resources to update the available resources of the storage pool. Taking the capacity increase request as an example, the storage pool adjusts the storage space corresponding to the storage volume based on the storage resource quota and increases the storage space corresponding to the storage volume, that is, schedules the corresponding storage resources from the available resources of the storage pool to meet the resource scheduling requirements of the storage volume and update the available resources of the storage pool.
[0079] The technical solution of this embodiment expands or shrinks the storage volume through the second persistent volume declaration to meet different scheduling requirements for the storage resources of the storage volume.
[0080] Figure 5 Schematic diagram of a resource scheduling device for a kubernetes cluster provided by an embodiment of the present disclosure. Figure 5 As shown, the device comprises:
[0081] A persistent volume declaration creation module 310 is used to create a first persistent volume declaration and a second persistent volume declaration of a predefined type in response to a resource scheduling request, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information;
[0082] The storage volume creation module 320 is used to associate the pre-created pod node with the first persistent volume declaration; create a storage volume based on the first persistent volume declaration, and mount the storage volume to the pod node.
[0083] The technical solution of this embodiment,
[0084] Based on the above embodiment, optionally, the persistent volume declaration creation module 310 is used to: create a second persistent volume declaration of the predefined type; and create the first persistent volume declaration based on the second persistent volume declaration when the second persistent volume declaration is monitored, wherein the first persistent volume declaration and the second persistent volume declaration correspond to the same identifier respectively.
[0085] Based on the above embodiment, optionally, the device further includes:
[0086] A capacity update module is used to update the capacity configuration information in the second persistent volume declaration in response to a capacity update request for the second persistent volume declaration; the capacity update request includes a capacity increase request and a capacity decrease request; when a change in the second persistent volume declaration is detected, the capacity change processing is performed on the storage volume.
[0087] Optionally, the capacity update module is also used to update the capacity configuration information in the second persistent volume declaration in response to a capacity update request for the first persistent volume declaration; the capacity update request includes a capacity increase request; when a change is detected in the first persistent volume declaration, the capacity change processing is performed on the storage volume.
[0088] Optionally, the capacity update module is further configured to update the storage resource quota of the storage volume according to the capacity configuration information in the capacity update request.
[0089] Optionally, the capacity update module is further used to send capacity update information to the storage pool to update the available resources of the storage pool.
[0090] Optionally, the capacity update module is further used to display resource information corresponding to the storage volume mounted on the created pod node in response to a query request, where the resource information includes resource quantity and resource utilization.
[0091] The resource scheduling device for a Kubernetes cluster provided in the embodiments of the present disclosure can execute the resource scheduling method for a Kubernetes cluster provided in any embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.
[0092] Figure 61 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0093] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the electronic device 10 request can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0094] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0095] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a resource scheduling method for a kubernetes cluster.
[0096] In some embodiments, the resource scheduling method of the Kubernetes cluster may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the resource scheduling method of the Kubernetes cluster described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the resource scheduling method of the Kubernetes cluster in any other appropriate manner (e.g., by means of firmware).
[0097] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general-purpose programmable processor that can receive data and instructions from a storage pool, at least one input device, and at least one output device, and transmit data and instructions to the storage pool, the at least one input device, and the at least one output device.
[0098] The computer program for implementing the resource scheduling method of the kubernetes cluster of the present disclosure can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / requests specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or completely on a remote machine or server.
[0099] The embodiment of the present disclosure also provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a processor to execute a resource scheduling method for a Kubernetes cluster, the method comprising:
[0100] In response to a resource scheduling request, a first persistent volume declaration and a second persistent volume declaration of a predefined type are created, and the first persistent volume declaration and the second persistent volume declaration are respectively associated with storage pools, wherein the first persistent volume declaration is a native persistent volume declaration of the kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information; a pre-created pod node is associated with the first persistent volume declaration; a storage volume is created based on the first persistent volume declaration, and the storage volume is mounted on the pod node.
[0101] In the context of the present disclosure, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0102] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0103] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0104] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0105] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of this disclosure can be achieved, and this document is not limited here.
[0106] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A resource scheduling method for a kubernetes cluster, characterized in that: include: In response to a resource scheduling request, create a first persistent volume declaration and a second persistent volume declaration of a predefined type, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information; Associating the pre-created pod node with the first persistent volume claim; Create a storage volume based on the first persistent volume declaration, and mount the storage volume to the pod node.
2. The method according to claim 1, characterized in that The creating a first persistent volume claim and a second persistent volume claim of a predefined type includes: Creating a second persistent volume claim of the predefined type; In case the second persistent volume declaration is monitored, the first persistent volume declaration is created based on the second persistent volume declaration, wherein the first persistent volume declaration and the second persistent volume declaration correspond to the same identifier respectively.
3. The method according to claim 1, characterized in that The method further comprises: In response to a capacity update request for the second persistent volume declaration, updating capacity configuration information in the second persistent volume declaration; the capacity update request includes a capacity increase request and a capacity decrease request; When it is monitored that the second persistent volume declaration is changed, a capacity change process is performed on the storage volume.
4. The method according to claim 1, characterized in that The method further comprises: In response to a capacity update request for the first persistent volume declaration, updating capacity configuration information in the second persistent volume declaration; the capacity update request includes a capacity increase request; When it is monitored that the first persistent volume declaration has changed, a capacity change process is performed on the storage volume.
5. The method according to claim 3 or 4, characterized in that: The performing capacity change processing on the storage volume includes: The storage resource quota of the storage volume is updated according to the capacity configuration information in the capacity update request.
6. The method according to claim 3 or 4, characterized in that: The method further comprises: Capacity update information is sent to the storage pool to update the available resources of the storage pool.
7. The method according to claim 3 or 4, characterized in that: The method further comprises: In response to the query request, resource information corresponding to the storage volume mounted on the created pod node is displayed, and the resource information includes resource quantity and resource utilization.
8. A resource scheduling device for a kubernetes cluster, characterized in that: include: A persistent volume declaration creation module, configured to create a first persistent volume declaration and a second persistent volume declaration of a predefined type in response to a resource scheduling request, and associate the first persistent volume declaration and the second persistent volume declaration with storage pools respectively, wherein the first persistent volume declaration is a native persistent volume declaration of the kubernetes cluster, and the first persistent volume declaration and the second persistent volume declaration are respectively provided with capacity configuration information, and the second persistent volume declaration supports increasing and decreasing the capacity configuration information; A storage volume creation module is used to associate a pre-created pod node with the first persistent volume declaration; create a storage volume based on the first persistent volume declaration, and mount the storage volume to the pod node.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the resource scheduling method for the Kubernetes cluster described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource scheduling method for a Kubernetes cluster described in any one of claims 1 to 7 when executed.
Citation Information
Cited By
Resource scheduling method and apparatus for kubernetes cluster, storage medium, and electronic device
WO2026108276A1