CN114237885A - Container resource adjusting method and device, storage medium and electronic equipment - Google Patents

Container resource adjusting method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114237885A
CN114237885A CN202111509144.6A CN202111509144A CN114237885A CN 114237885 A CN114237885 A CN 114237885A CN 202111509144 A CN202111509144 A CN 202111509144A CN 114237885 A CN114237885 A CN 114237885A
Authority
CN
China
Prior art keywords
container
resource
information
adjustment
adjusting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111509144.6A
Other languages
Chinese (zh)
Inventor
李梦
周温丁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202111509144.6A priority Critical patent/CN114237885A/en
Publication of CN114237885A publication Critical patent/CN114237885A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a container resource adjusting method and device, a storage medium and electronic equipment, wherein the method comprises the following steps: acquiring input resource adjustment information; generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a database; a task execution module is called to read the adjustment task and the resource adjustment information; executing an adjusting task, determining each target application container, and determining adjusting data of each target application container from the resource adjusting information; based on the adjustment data for each target application container, a cluster management entry component is invoked to adjust the resources of each target application container. The method comprises the steps of generating an adjusting task according to resource adjusting information input by a user, determining each target application container and adjusting data of each target application container according to the task, adjusting each target application container according to the adjusting data of each target application container, and improving the efficiency of adjusting the resources of the application containers by adjusting the resources of the application containers in batches.

Description

Container resource adjusting method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of resource allocation technologies, and in particular, to a method and an apparatus for adjusting container resources, a storage medium, and an electronic device.
Background
With the development of the internet, especially the development of cloud computing technology, containers become a hot topic in recent years. The container is a lightweight virtualization technology in nature, the traditional virtualization technology is resource isolation at an operating system level, and the container is isolation at a process level in nature, so the container is lighter in weight. Because the container technology has the advantages of simple deployment, multi-environment support, quick start, service arrangement, easy migration and the like, most of the applications on the cloud adopt the container type deployment.
At present, when the resources of each container in the system are configured, the resources of the containers are generally adjusted by modifying the resource configuration files in the containers, and this way of adjusting the resources of the containers can only adjust one container at a time, and when the number of containers is large, the efficiency of adjusting the resources of the containers using this way is extremely low.
Disclosure of Invention
In view of this, the present invention provides a container resource adjusting method and apparatus, a storage medium, and an electronic device, which can adjust resources of application containers in batches, thereby improving efficiency of adjusting the resources of the application containers.
In order to achieve the above purpose, the embodiments of the present invention provide the following technical solutions:
the invention discloses a container resource adjusting method, which is applied to a container resource adjusting platform and comprises the following steps:
after a user logs in a container resource adjusting platform, displaying a container configuration page to the user;
acquiring resource adjustment information input by the user based on the container configuration page;
generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a preset database;
calling a preset task execution module to read the adjustment tasks and the resource adjustment information in the database;
executing the adjustment task, determining each target application container, and determining the adjustment data of each target application container from the resource adjustment information;
and calling a preset cluster management entry component to adjust the resources of each target application container based on the adjustment data of each target application container.
Optionally, the method for presenting a container configuration page to the user includes:
acquiring application authority information of the user;
determining each application container corresponding to the application authority information;
determining resource information of each application container;
rendering a container configuration page containing resource information for each of the application containers;
and displaying the container configuration page to the user.
Optionally, the obtaining resource adjustment information input by the user based on the container configuration page includes:
determining each target application container selected by the user in each application container of the container configuration page;
acquiring configuration data input by the user for each target application container;
and when the illegal data does not exist in each configuration data, forming the resource adjustment information by each configuration data.
Optionally, the above method, where the storing the resource adjustment information and the adjustment task in a preset database includes:
determining an information storage field in a resource information table of the database, and determining a task storage field corresponding to the information storage field in a task information table of the database;
storing the resource adjustment information into the information storage field;
and saving the adjustment task to a preset task distribution module, so that the task distribution module saves the adjustment task to the task storage field.
Optionally, in the method, the invoking a preset cluster management entry component to adjust the resource of each target application container based on the adjustment data of each target application container includes:
determining, using the cluster management portal component, a resource object for each of the target application containers;
and for the resource object of each target application container, modifying the resource data in the configuration file of the resource object based on the adjustment data of the target container, and completing the resource adjustment of the target application container.
The second aspect of the present invention discloses a container resource adjusting device, which is applied to a container resource adjusting platform, and includes:
the display unit is used for displaying a container configuration page to a user after the user logs in the container resource adjusting platform;
an obtaining unit, configured to obtain resource adjustment information input by the user based on the container configuration page;
the generating unit is used for generating an adjusting task based on the resource adjusting information and storing the resource adjusting information and the adjusting task into a preset database;
the calling unit is used for calling a preset task execution module to read the adjustment tasks and the resource adjustment information in the database;
an execution unit, configured to execute the adjustment task, determine each target application container, and determine adjustment data of each target application container from the resource adjustment information;
and the adjusting unit is used for calling a preset cluster management entry component to adjust the resources of each target application container based on the adjusting data of each target application container.
The above apparatus, optionally, the display unit, includes:
the first acquisition subunit is used for acquiring the application authority information of the user;
the first determining subunit is used for determining each application container corresponding to the application authority information;
a second determining subunit, configured to determine resource information of each of the application containers;
a rendering subunit, configured to render a container configuration page containing resource information of each of the application containers;
and the display subunit is used for displaying the container configuration page to the user.
The above apparatus, optionally, the obtaining unit includes:
a third determining subunit, configured to determine each target application container selected by the user in each application container of the container configuration page;
the second acquisition subunit is used for acquiring the configuration data input by the user for each target application container;
and the forming subunit is used for forming resource adjustment information by the configuration data when the violation data does not exist in the configuration data.
The above apparatus, optionally, the generating unit includes:
a fourth determining subunit, configured to determine an information storage field in a resource information table of the database, and determine a task storage field corresponding to the information storage field in a task information table of the database;
the first storage subunit is used for storing the resource adjustment information into the information storage field;
and the second saving subunit is configured to save the adjustment task to a preset task distribution module, so that the task distribution module saves the adjustment task to the task storage field.
The above apparatus, optionally, the adjusting unit includes:
a fifth determining subunit, configured to determine, using the cluster management entry component, a resource object for each of the target application containers;
and the modifying subunit is used for modifying the resource data in the configuration file of the resource object based on the adjustment data of the target container for the resource object of each target application container, so as to complete the resource adjustment of the target application container.
A third aspect of the present invention discloses a storage medium, where the storage medium includes stored instructions, where when the instructions are executed, a device on which the storage medium is located is controlled to execute the container resource adjusting method described above.
In a fourth aspect, the present invention discloses an electronic device, comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to perform the container resource adjusting method as described above.
Compared with the prior art, the invention has the following advantages:
the invention provides a container resource adjusting method and device, a storage medium and electronic equipment, wherein the method comprises the following steps: when a user logs in the container resource adjusting platform, a container configuration page is displayed to the user; acquiring resource adjustment information input by a user based on a container configuration page; generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a database; a calling task execution module reads an adjustment task and resource adjustment information in a database; executing an adjusting task, determining each target application container, and determining adjusting data of each target application container from the resource adjusting information; based on the adjustment data for each target application container, a cluster management entry component is invoked to adjust the resources of each target application container. After the user inputs the resource adjustment information, an adjustment task is generated, the adjustment task is executed, each target application container and the adjustment data of each target application container are determined, and each target application container is adjusted according to the adjustment data of each target application container, so that the resources of the application containers can be adjusted in batches, and the efficiency of adjusting the resources of the application containers is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow diagram of a prior art method of adjusting resources of a container;
fig. 2 is a flowchart of a method for adjusting container resources according to an embodiment of the present invention;
fig. 3 is a flowchart of another method of adjusting container resources according to an embodiment of the present invention;
fig. 4 is a flowchart of another method of adjusting container resources according to an embodiment of the present invention;
fig. 5 is a diagram illustrating a scenario of a container resource adjusting method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a container resource adjusting apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
With the development of the internet, especially the development of cloud computing technology, containers become a hot topic in recent years. The container is a lightweight virtualization technology in nature, the traditional virtualization technology is resource isolation at an operating system level, and the container is isolation at a process level in nature, so the container is lighter in weight. The operation of the container does not require additional virtualization layer hypervisor support, and therefore higher performance and efficiency can be achieved. First, the start-up of the container can be done on the order of seconds, which is much faster than the traditional virtual machine approach; secondly, the resource utilization rate of the system by the containers is high, and thousands of containers can be operated on one host at the same time. The container basically does not consume additional system resources except for running the application, so that the performance of the application is high, and the overhead of the system is as small as possible. The traditional virtual machine mode is 10 virtual machines for 10 different applications, and the container only needs to start 10 isolated applications. Because the container technology has the advantages of simple deployment, multi-environment support, quick start, service arrangement, easy migration and the like, most of the applications on the cloud adopt the container type deployment.
The container only provides the most basic container runtime environment and cannot realize cross-host communication, and container cluster management can realize the cross-host communication of the container, manage the distribution of cluster resources, arrange the container and manage the full life cycle, and simultaneously can integrate complete logs and monitoring tools and provide an interactive tool, wherein Kubernets is the mainstream container cluster management technology at present. Kubernets has complete cluster management capacity, and comprises a multi-level security protection and admission mechanism, a multi-tenant application supporting capacity, a transparent service registration and service discovery mechanism, a built-in intelligent load balancer, strong fault discovery and self-repairing capacity, service rolling upgrading and online capacity expansion capacity, an expandable resource automatic scheduling mechanism and multi-granularity resource quota management capacity.
In Kubernetes, when a computing resource is defined by a cooperation, the following two parameters need to be set:
requests: the minimum application amount of the resource, the system must meet the requirements;
and (5) limit: the maximum allowed amount of this resource cannot be breached, and when a container attempts to use more than this amount of resource, it may be "killed" by kubernets and restarted.
In general, we will set Requests to a small value, which corresponds to the resource demand under container-flat workloads, and Limit to the maximum amount of resource usage under peak load. In the pod operation process, due to the unreasonable estimation and prejudgment on the resource usage, when the traffic increases, the pod resource usage is over-limited, and the pod resource usage upper limit cannot be transversely expanded, so as to meet the service requirement. The existing method for modifying container quota is generally realized by modifying yaml file, the quota of only one pod can be adjusted by the method at one time, if the number of the problematic pods is too large, the method is low in efficiency, and the rapidly-growing service cannot be met in the shortest time.
Referring to fig. 1, a schematic diagram of a device for adjusting a container quota in the prior art shows that a current container matching modifying method is to directly modify a xml file of a deployment entity and perform container matching adjustment, the method can only modify an online quota of one application at a time, and no intuitive page can show a resource use condition of a container at present, and cannot reasonably adjust an upper limit threshold of a resource according to a resource use trend. Aiming at the problems in the prior art, a platform is urgently needed to display the use condition of container resources and the upper limit threshold value of the resources, and the upper limit value of the resources can be flexibly adjusted, so that the ever-increasing business requirements of users are met.
In order to solve the above problems, the present invention provides a method and an apparatus for adjusting container resources, a storage medium, and an electronic device, which are used to adjust resources in containers in batch and improve efficiency of adjusting the resources of the containers.
The terms appearing in the present invention are to be interpreted:
K8S: a Kubernetes container cluster management system;
deployment: a Kubernetes pod deploys a copy set;
hypervisor: a virtual machine monitor;
apiserver: a Kubernetes cluster management portal;
pod: the Kubernetes container cluster management system minimum scheduling unit.
The present invention is applicable to a container resource adjustment platform that may be comprised of numerous general purpose or special purpose computing device environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor apparatus, distributed computing environments that include any of the above apparatus or devices, and the like; the execution subject of the invention may be a processor or a server of the container resource adjustment platform.
Referring to fig. 2, a flowchart of a method for adjusting container resources according to an embodiment of the present invention is specifically described as follows:
s101, when a user logs in the container resource adjusting platform, a container configuration page is displayed to the user.
The user can log in the container resource adjusting platform by using the platform account, and the specific mode can be that the user inputs account information to the container resource adjusting platform, the container resource adjusting platform verifies the account information, and when the account information passes the verification, the user successfully logs in the container resource adjusting platform and displays a container configuration page to the user; further, the account information includes a platform account and an account password of the user.
It should be noted that the container configuration page includes a plurality of application containers and resource information of each application container.
Referring to fig. 3, a flowchart of a method for displaying a container configuration page to a user according to an embodiment of the present invention is specifically described as follows:
s201, acquiring application authority information of a user.
The application right information records the authority level of the application container operated by the user, and can also contain container information of each application container which can be adjusted by the user.
S202, determining each application container corresponding to the application authority information.
When determining each application container, the determination may be performed according to the authority level in the application authority item information, for example, each application container with a level less than or equal to the authority level is determined as each application container corresponding to the application authority information.
The application permission information is determined according to the application permission information, the application container corresponding to each container information is determined, and each determined application container is determined to be the application container corresponding to the application permission information.
S203, determining the resource information of each application container.
The resource information includes current resource use information and resource configuration information of the application container, and exemplarily, the current resource use information includes, but is not limited to, CPU used information, memory used information, and the like; the resource configuration information includes, but is not limited to, a CPU upper limit value, a memory upper limit value, and the like.
And S204, rendering a container configuration page containing the resource information of each application container.
S205, displaying the container configuration page to a user.
The container configuration page is displayed to the user, so that the user can quickly know the current resource use state of each application container which can be configured by the user, and the user can make a decision for adjusting the resources of the application container.
S102, acquiring resource adjusting information input by a user based on the container configuration page.
After the container configuration page is displayed to the user, the user can adjust the application container according to the self requirement, so that the user needs to input resource adjustment information, and the resource adjustment information comprises configuration data of at least one application container.
Referring to fig. 4, a flowchart of a method for obtaining resource adjustment information according to an embodiment of the present invention is specifically described as follows:
s301, determining each target application container selected by the user in each application container of the container configuration page.
The user can select the target application container according to the self requirement, and the target application container is an application container needing resource adjustment.
When the user selects the application container, the application container needing to adjust the resource can be selected in the container configuration page, and each application container selected by the user is determined as a target application container.
S302, acquiring configuration data input by a user for each target application container.
After selecting an application container, a user needs to input configuration data for each selected application container, wherein the configuration data comprise a CPU (Central processing Unit) adjustment value and/or a memory adjustment value; the CPU adjusting value is the maximum value of the CPU adjusted by the application container, and the memory adjusting data is the maximum value of the memory adjusted by the application container.
S303, judging whether violation data exist in each configuration data, and executing S304 when the violation data do not exist in each configuration data; otherwise, S305 is executed.
For each configuration data, determining a target application container to which the configuration data belongs, determining an adjustment standard of the target application container, determining whether the configuration data meets the adjustment, determining that the configuration data is not violation data when the configuration data meets the adjustment standard, and determining that the configuration data is violation data when the configuration data does not meet the adjustment standard. It should be noted that the adjustment standard includes a CPU adjustment standard and a memory adjustment standard, the CPU adjustment standard specifies a CPU standard value, and the memory adjustment standard specifies a memory standard value.
When the configuration data only contain the CPU adjustment value, judging whether the CPU adjustment value is larger than or equal to the CPU standard value, and when the CPU adjustment value is larger than or equal to the CPU standard value, determining that the configuration data meets the adjustment standard, namely determining that the configuration data is not illegal data; when the CPU adjustment value is less than the CPU standard value, it may be determined that the configuration data does not satisfy the adjustment standard, that is, it may be determined that the configuration data is violation data.
When the configuration data only contain the memory adjustment value, judging whether the memory adjustment value is larger than or equal to the memory standard value, and when the memory adjustment value is larger than or equal to the memory standard value, determining that the configuration data meets the adjustment standard, namely determining that the configuration data is not illegal data; and when the memory adjustment value is smaller than the memory standard value, determining that the configuration data does not meet the adjustment standard, namely determining that the configuration data is illegal data.
When the configuration data comprises a CPU (Central processing Unit) adjustment value and a memory adjustment value, the configuration data can be determined to meet the adjustment standard and can not be determined to be illegal data only when the CPU adjustment value is greater than or equal to a CPU standard value and the memory adjustment value is greater than or equal to a memory standard value; otherwise, determining that the configuration data does not meet the adjustment standard, that is, determining that the configuration data is illegal.
S304, encapsulating the configuration data of each target application container into resource adjustment information.
S305, prompting the user to input errors.
When the illegal data exists in each configuration data, prompting a user to input errors, and correcting the illegal data according to the prompt by the user, specifically, deleting the illegal configuration data and the target application container corresponding to the illegal configuration data, and modifying the illegal configuration data to ensure that the modified configuration data is not the illegal data.
S103, generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a preset database.
The adjustment task includes adjustment data of each target application container, and the resource adjustment can be performed on the application containers in batches by executing the adjustment task, so that the efficiency of adjusting the resources of the application containers can be improved.
The process of updating the resource adjustment information and the adjustment task to the preset database is as follows:
determining an information storage field in a resource information table of the database, and determining a task storage field corresponding to the information storage field in a task information table of the database;
storing the resource adjustment information into the information storage field;
and saving the adjustment task to a preset task distribution module, so that the task distribution module saves the adjustment task to the task storage field.
The resource information table comprises a plurality of information storage fields, and the information storage fields are used for storing resource adjustment information; the task information table comprises a plurality of task storage fields, each task storage field has a corresponding information storage field in the resource information table, and the task storage fields are used for storing and adjusting tasks.
The resource adjustment information and the adjustment task are stored in the fields with the association relationship, so that the reading of wrong resource adjustment information during the subsequent execution of the adjustment task can be avoided, the correctness of data is ensured, and the accuracy of the subsequent adjustment of the resources of the application container is ensured.
And S104, calling a preset task execution module to read the adjustment task and the resource adjustment information in the database.
And S105, executing the adjustment task, determining each target application container, and determining the adjustment data of each target application container from the resource adjustment information.
And S106, calling a preset cluster management entry component to adjust the resources of each target application container based on the adjustment data of each target application container.
Adjusting the resources of the target application container is substantially quota adjusting the target application container, and after the adjustment of the resources of the target application container is completed, adjusting the resources of the application container may also be understood as adjusting the quota of the application container.
The process of adjusting the resources of each application container using the cluster management portal component is as follows: determining, using the cluster management portal component, a resource object for each of the target application containers; and for the resource object of each target application container, modifying the resource data in the configuration file of the resource object based on the adjustment data of the target container, and completing the resource adjustment of the target application container. It should be noted that the configuration file may be a yaml file.
Further, when the resources of the target application container are adjusted, the CPU and the memory of the target application container may be adjusted, and the CPU and the memory may be adjusted to be larger or smaller.
It should be noted that after the resource adjustment information and the adjustment task are saved in the database, corresponding operation audit information may also be generated and saved in an audit module of the database, where the operation audit information includes, but is not limited to, information and time for the user to adjust the resource of the application container.
In the method provided by the embodiment of the invention, after a user logs in a container resource adjusting platform, a container configuration page is displayed to the user; acquiring resource adjustment information input by a user based on a container configuration page; generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a database; a calling task execution module reads an adjustment task and resource adjustment information in a database; executing an adjusting task, determining each target application container, and determining adjusting data of each target application container from the resource adjusting information; based on the adjustment data for each target application container, a cluster management entry component is invoked to adjust the resources of each target application container. After the user inputs the resource adjustment information, an adjustment task is generated, the adjustment task is executed, each target application container and the adjustment data of each target application container are determined, and each target application container is adjusted according to the adjustment data of each target application container, so that the resources of the application containers can be adjusted in batches, and the efficiency of adjusting the resources of the application containers is improved.
To specifically explain the scheme, an embodiment of the present invention provides a scenario example diagram, a detailed explanation is performed based on the scenario example diagram, and referring to fig. 5, a scenario example diagram provided in an embodiment of the present invention is specifically explained as follows:
as shown in fig. 5, the diagram includes a rights management module, a quota adjusting module, a database, and a K8s cluster, and further, a container quota adjusting platform is composed of a rights management module, a quota adjusting module, a database, and a K8s cluster, and the platform may have functions of rights management, operation audit, asynchronous task issue, and the like, and may implement automatic batch adjustment of container quotas.
The authority management module divides the authority of the users in fine granularity, so that each user can only check and adjust the container quota information of the user, and the condition of misoperation on the containers of other users is avoided. The module provides an account and password information for each user, the user logs in a container quota adjusting platform through the account and the password, and the account information is associated with application information related to the user; i.e. the rights management module is used to determine the individual application containers that the user can operate.
The quota adjusting module provides a platform for a user, can visually check the resource use condition and the resource upper limit value of the application container, can select one or more application containers on the interface for quota checking and adjusting, and can flexibly search the information of the application container to be adjusted through the search bar. When the container quota is adjusted, configuration data needs to be input, if the configuration data does not meet the adjustment standard, updating operation cannot be performed, and only if the configuration data which meets the adjustment standard correctly meets a user, an update button can be clicked to adjust the application container quota.
The database module is used for recording task information, resource information and operation audit information updated by the quota adjusting platform, when a user clicks an update button to adjust the container resource, the user issues an adjusting task to the task distributing module, the task distributing module stores the task into a task recording table of the database, the adjusted resource information is recorded in the database, and in addition, information such as an operator, an operation object, operation content and operation date in the request can be recorded in the database.
The K8s cluster management module is realized by a task distribution module and a task execution module, when a user clicks an update operation on the quota adjustment module, the adjustment task for resource adjustment is sent to the task distribution module, the task distribution module stores the adjustment task in a database, then the task execution module monitors the task in the database and preempts the task, once the task is preempted, the task interacts with the cluster management entry component of the K8s cluster, and then the api interface of the K8s is called to modify the yaml file of the resource object, so that the resource adjustment of the application container is realized, and the batch adjustment of the quota of the application container is also realized substantially.
It should be noted that CPU _ use in the figure represents a value of a CPU used in an application container, and mem _ use represents a value of a memory used in the application container; the CPU _ limit represents the maximum use value of the CPU in the application container, and the mem _ limit represents the maximum use value of the memory in the application container; the CPU _ update represents the maximum utilization value of the CPU in the adjusted application container, and the mem _ update represents the maximum utilization value of the memory in the adjusted application container. Table1 is the resource information Table described above, Table2 is the task information Table described above, and Table3 is used for storing operation audit information.
The invention provides a method for adjusting resources of application containers in batches, which improves the efficiency of resource adjustment; the interface management of resources can be realized through the container resource adjusting platform, the resource use information is displayed, and a user can flexibly adjust the upper limit value of the resource use through the resource use trend; the method has the advantages that the automatic adjustment application container quota script is provided, a user can develop the script according to the self requirement, and daily management and operation and maintenance are more flexible; the operation executed on the quota adjusting platform provides an operation warehousing function, and historical operation records and operation results can be checked at any time. The invention can perfect the adjustment mode of the resource quota of the public cloud application container, provides an automatic batch adjustment method of the container quota, and is convenient for users to adjust the quota. The resource management platform under the public cloud environment is realized, the application container quota management standardization can be realized by means of the resource management platform, the operation and maintenance efficiency is improved, and the operation and maintenance automation level is improved.
Corresponding to the method shown in fig. 2, an embodiment of the present invention further provides a container resource adjusting device, which may be disposed on a container resource adjusting platform, and the device may be used to support implementation of the method shown in fig. 2, where a schematic structural diagram of the device is shown in fig. 6, and the following is specifically described:
the display unit 601 is configured to display a container configuration page to a user after the user logs in a container resource adjustment platform;
an obtaining unit 602, configured to obtain resource adjustment information input by the user based on the container configuration page;
a generating unit 603, configured to generate an adjustment task based on the resource adjustment information, and store the resource adjustment information and the adjustment task in a preset database;
a calling unit 604, configured to call a preset task execution module to read an adjustment task and resource adjustment information in the database;
an executing unit 605, configured to execute the adjustment task, determine each target application container, and determine adjustment data of each target application container from the resource adjustment information;
an adjusting unit 606, configured to invoke a preset cluster management entry component to adjust resources of each target application container based on the adjustment data of each target application container.
In the device provided by the embodiment of the invention, after a user logs in the container resource adjusting platform, a container configuration page is displayed for the user; acquiring resource adjustment information input by a user based on a container configuration page; generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a database; a calling task execution module reads an adjustment task and resource adjustment information in a database; executing an adjusting task, determining each target application container, and determining adjusting data of each target application container from the resource adjusting information; based on the adjustment data for each target application container, a cluster management entry component is invoked to adjust the resources of each target application container. After the user inputs the resource adjustment information, an adjustment task is generated, the adjustment task is executed, each target application container and the adjustment data of each target application container are determined, and each target application container is adjusted according to the adjustment data of each target application container, so that the resources of the application containers can be adjusted in batches, and the efficiency of adjusting the resources of the application containers is improved.
In the apparatus provided in the embodiment of the present invention, the display unit 601 includes:
the first acquisition subunit is used for acquiring the application authority information of the user;
the first determining subunit is used for determining each application container corresponding to the application authority information;
a second determining subunit, configured to determine resource information of each of the application containers;
a rendering subunit, configured to render a container configuration page containing resource information of each of the application containers;
and the display subunit is used for displaying the container configuration page to the user.
In the apparatus provided in the embodiment of the present invention, the obtaining unit 602 includes:
a third determining subunit, configured to determine each target application container selected by the user in each application container of the container configuration page;
the second acquisition subunit is used for acquiring the configuration data input by the user for each target application container;
and the forming subunit is used for forming resource adjustment information by the configuration data when the violation data does not exist in the configuration data.
In the apparatus provided in the embodiment of the present invention, the generating unit 603 includes:
a fourth determining subunit, configured to determine an information storage field in a resource information table of the database, and determine a task storage field corresponding to the information storage field in a task information table of the database;
the first storage subunit is used for storing the resource adjustment information into the information storage field;
and the second saving subunit is configured to save the adjustment task to a preset task distribution module, so that the task distribution module saves the adjustment task to the task storage field.
In the apparatus provided in the embodiment of the present invention, the adjusting unit 606 includes:
a fifth determining subunit, configured to determine, using the cluster management entry component, a resource object for each of the target application containers;
and the modifying subunit is used for modifying the resource data in the configuration file of the resource object based on the adjustment data of the target container for the resource object of each target application container, so as to complete the resource adjustment of the target application container.
The embodiment of the invention also provides a storage medium, which comprises a stored instruction, wherein when the instruction runs, the device where the storage medium is located is controlled to execute the container resource adjusting method.
An electronic device is further provided, and its structural diagram is shown in fig. 7, which specifically includes a memory 701 and one or more instructions 702, where the one or more instructions 702 are stored in the memory 701, and are configured to be executed by the one or more processors 703 to execute the one or more instructions 702 to perform the container resource adjustment method.
The specific implementation procedures and derivatives thereof of the above embodiments are within the scope of the present invention.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for adjusting container resources is applied to a platform for adjusting container resources, and comprises the following steps:
after a user logs in a container resource adjusting platform, displaying a container configuration page to the user;
acquiring resource adjustment information input by the user based on the container configuration page;
generating an adjusting task based on the resource adjusting information, and storing the resource adjusting information and the adjusting task into a preset database;
calling a preset task execution module to read the adjustment tasks and the resource adjustment information in the database;
executing the adjustment task, determining each target application container, and determining the adjustment data of each target application container from the resource adjustment information;
and calling a preset cluster management entry component to adjust the resources of each target application container based on the adjustment data of each target application container.
2. The method of claim 1, wherein the presenting the user with a container configuration page comprises:
acquiring application authority information of the user;
determining each application container corresponding to the application authority information;
determining resource information of each application container;
rendering a container configuration page containing resource information for each of the application containers;
and displaying the container configuration page to the user.
3. The method of claim 1, wherein obtaining resource adjustment information entered by the user based on the container configuration page comprises:
determining each target application container selected by the user in each application container of the container configuration page;
acquiring configuration data input by the user for each target application container;
and when the illegal data does not exist in each configuration data, forming the resource adjustment information by each configuration data.
4. The method of claim 1, wherein the saving the resource adjustment information and the adjustment task to a preset database comprises:
determining an information storage field in a resource information table of the database, and determining a task storage field corresponding to the information storage field in a task information table of the database;
storing the resource adjustment information into the information storage field;
and saving the adjustment task to a preset task distribution module, so that the task distribution module saves the adjustment task to the task storage field.
5. The method according to claim 1, wherein the invoking a preset cluster management entry component to adjust the resource of each target application container based on the adjustment data of each target application container comprises:
determining, using the cluster management portal component, a resource object for each of the target application containers;
and for the resource object of each target application container, modifying the resource data in the configuration file of the resource object based on the adjustment data of the target container, and completing the resource adjustment of the target application container.
6. A container resource adjusting device is applied to a container resource adjusting platform and comprises:
the display unit is used for displaying a container configuration page to a user after the user logs in the container resource adjusting platform;
an obtaining unit, configured to obtain resource adjustment information input by the user based on the container configuration page;
the generating unit is used for generating an adjusting task based on the resource adjusting information and storing the resource adjusting information and the adjusting task into a preset database;
the calling unit is used for calling a preset task execution module to read the adjustment tasks and the resource adjustment information in the database;
an execution unit, configured to execute the adjustment task, determine each target application container, and determine adjustment data of each target application container from the resource adjustment information;
and the adjusting unit is used for calling a preset cluster management entry component to adjust the resources of each target application container based on the adjusting data of each target application container.
7. The apparatus of claim 6, wherein the display unit comprises:
the first acquisition subunit is used for acquiring the application authority information of the user;
the first determining subunit is used for determining each application container corresponding to the application authority information;
a second determining subunit, configured to determine resource information of each of the application containers;
a rendering subunit, configured to render a container configuration page containing resource information of each of the application containers;
and the display subunit is used for displaying the container configuration page to the user.
8. The apparatus of claim 6, wherein the obtaining unit comprises:
a third determining subunit, configured to determine each target application container selected by the user in each application container of the container configuration page;
the second acquisition subunit is used for acquiring the configuration data input by the user for each target application container;
and the forming subunit is used for forming resource adjustment information by the configuration data when the violation data does not exist in the configuration data.
9. A storage medium, characterized in that the storage medium comprises stored instructions, wherein when the instructions are executed, a device on which the storage medium is located is controlled to execute the container resource adjusting method according to any one of claims 1 to 5.
10. An electronic device comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by the one or more processors to perform the method of container resource adjustment of any one of claims 1-5.
CN202111509144.6A 2021-12-10 2021-12-10 Container resource adjusting method and device, storage medium and electronic equipment Pending CN114237885A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111509144.6A CN114237885A (en) 2021-12-10 2021-12-10 Container resource adjusting method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111509144.6A CN114237885A (en) 2021-12-10 2021-12-10 Container resource adjusting method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114237885A true CN114237885A (en) 2022-03-25

Family

ID=80754713

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111509144.6A Pending CN114237885A (en) 2021-12-10 2021-12-10 Container resource adjusting method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114237885A (en)

Similar Documents

Publication Publication Date Title
US20210314223A1 (en) Managing Virtual Network Functions
US10292044B2 (en) Apparatus for end-user transparent utilization of computational, storage, and network capacity of mobile devices, and associated methods
EP3030966B1 (en) Virtual computing instance migration
US9684502B2 (en) Apparatus, systems, and methods for distributed application orchestration and deployment
CA3000422C (en) Workflow service using state transfer
US8762986B2 (en) Advanced packaging and deployment of virtual appliances
US8966450B2 (en) Facilitating the execution of web applications in the cloud
US9251483B2 (en) Performance optimization of business processes by stochastic environmental changes
EP1679602B1 (en) Shared memory based monitoring for application servers
US11481239B2 (en) Apparatus and methods to incorporate external system to approve deployment provisioning
CN112104723B (en) Multi-cluster data processing system and method
EP2989543B1 (en) Method and device for updating client
US9535754B1 (en) Dynamic provisioning of computing resources
US20130159376A1 (en) Systems and methods for a computing resource broker agent
WO2006042153A2 (en) Distributed processing system
US20200389416A1 (en) Checkpoint-inclusive resource allocation
US11509693B2 (en) Event-restricted credentials for resource allocation
CN116541134A (en) Method and device for deploying containers in multi-architecture cluster
US20160179570A1 (en) Parallel Computing Without Requiring Antecedent Code Deployment
WO2017074320A1 (en) Service scaling for batch processing
US11561843B2 (en) Automated performance tuning using workload profiling in a distributed computing environment
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
US10073689B2 (en) Managing application lifecycles within a federation of distributed software applications
CN111399999A (en) Computer resource processing method and device, readable storage medium and computer equipment
US20120265879A1 (en) Managing servicability of cloud computing resources

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination