WO2022042724A1 - 容器创建方法、装置、电子设备及存储介质 - Google Patents

容器创建方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022042724A1
WO2022042724A1 PCT/CN2021/115374 CN2021115374W WO2022042724A1 WO 2022042724 A1 WO2022042724 A1 WO 2022042724A1 CN 2021115374 W CN2021115374 W CN 2021115374W WO 2022042724 A1 WO2022042724 A1 WO 2022042724A1
Authority
WO
WIPO (PCT)
Prior art keywords
available
rack
list
racks
current
Prior art date
Application number
PCT/CN2021/115374
Other languages
English (en)
French (fr)
Inventor
沈伯伟
白石
Original Assignee
北京京东尚科信息技术有限公司
北京京东世纪贸易有限公司
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 北京京东尚科信息技术有限公司, 北京京东世纪贸易有限公司 filed Critical 北京京东尚科信息技术有限公司
Priority to EP21860556.6A priority Critical patent/EP4206915A4/en
Priority to JP2023511608A priority patent/JP7549132B2/ja
Priority to US18/041,689 priority patent/US20230315531A1/en
Publication of WO2022042724A1 publication Critical patent/WO2022042724A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/177Initialisation or configuration control
    • 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/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • 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/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/45562Creating, deleting, cloning virtual machine instances
    • 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/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Definitions

  • the present disclosure belongs to the field of computer technology, and in particular relates to a container creation method, an apparatus, an electronic device and a storage medium.
  • the container cluster management platform can provide a series of functions such as container orchestration, resource scheduling, elastic scaling, deployment management and service discovery.
  • the container cluster management platform such as Kubernates (K8S for short).
  • One aspect of the present disclosure provides a container creation method, the method includes: acquiring a list of available racks and a list of available network addresses, wherein the list of available racks includes a plurality of available racks in different availability zones, each of the available racks
  • the rack includes at least one server node, and the above-mentioned available network address list includes at least one available network address; locate the spare server node in the available rack in the above-mentioned available rack list; The current container corresponding to the available network address; updating the above-mentioned available network address list; reordering the available racks in the above-mentioned available rack list according to the resource occupation information of the available racks in the above-mentioned available rack list; Additional containers are created with the spare server nodes in the available racks from the sorted list of available racks and the updated list of available network addresses.
  • obtaining the list of available racks includes: obtaining total resources of each server node in each rack; obtaining used resources of each server node, wherein the used resources are already used resources. Create the resources used by the container; determine the available racks according to the total resources of each server node and the used resources of each server node; and generate the available rack list according to the available racks.
  • a plurality of the above-mentioned available racks in the above-mentioned available rack list are sorted by priority.
  • the above-mentioned multiple available racks in the above-mentioned available rack list are sorted according to their priorities by the following manner: obtaining a created container list, wherein the above-mentioned created container list includes a plurality of created containers, Each of the above-mentioned created containers has a corresponding server node, an application to which it belongs, and a group to which it belongs; determine the created quantity information corresponding to each of the above-mentioned server nodes, wherein the above-mentioned created quantity information includes the quantity of the created containers belonging to the same application and the number of the created containers belonging to the same application. the grouped number of created containers; and prioritizing a plurality of the above-mentioned available racks in the above-mentioned available rack list according to the created quantity information corresponding to each of the above-mentioned server nodes.
  • the above-mentioned locating the spare server nodes in the available racks in the foregoing available rack list includes: determining an available rack with the highest priority in the foregoing available rack list as the current rack; determining whether the number of spare server nodes in the current rack is greater than a preset threshold; if the number of spare server nodes in the current rack is greater than the preset threshold, locate the spare server nodes in the current rack; When the number of spare server nodes in the current rack is less than or equal to the preset threshold, determine the available rack with the next priority in the available rack list as the current rack; and, return to executing the determination of the current rack Whether the number of spare server nodes in the current rack is greater than the above-mentioned preset threshold, until the above-mentioned spare server nodes in the current rack are located.
  • reordering the available racks in the available rack list according to the resource occupancy information of the available racks in the available rack list includes: acquiring the application to which the current container belongs and the information to which the container belongs. obtain the previous resource occupation information of the above-mentioned current rack in the above-mentioned available rack list; obtain the previous resource occupation information of other racks in the above-mentioned available rack list; according to the application to which the above-mentioned current container belongs, the above-mentioned current The group to which the container belongs and the previous resource occupation information of the current rack, determine the current resource occupation information of the current rack; and, according to the current resource occupation information of the current rack in the available rack list and the available machine Re-order the available racks in the available rack list above based on the previous resource occupancy information of other racks in the rack list.
  • the previous resource occupation information of the current rack and other racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of first slots, wherein , the above-mentioned first number of pits is the ratio of the total resources of the rack to the resources used by all created containers.
  • the available rack list is The available racks are reordered, including: according to preset rack priority rules, the current resource occupation information of the current rack in the available rack list, and the previous resources of other racks in the available rack list.
  • the occupancy information is used to reorder the available racks in the above-mentioned list of available racks, wherein the above-mentioned preset rack priority rules include: the lower the number of containers belonging to the same application, the higher the priority corresponding to the available racks.
  • the method further includes: reordering the server nodes in the available racks in the available rack list according to the resource occupation information of the server nodes in the available racks in the available rack list ;
  • the above creates other containers according to the spare server nodes in the available racks in the reordered available rack list and the updated available network address list, including: according to the available racks in the reordered available rack list and The server nodes in the available racks are determined, and new spare server nodes in the available racks are determined; and other containers are created according to the above-mentioned new spare server nodes and the updated list of available network addresses.
  • the resource occupancy information of the server nodes in the available racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of second slots.
  • the number of two pits is the ratio of the total resources of the server node to the resources used by all created containers.
  • reordering the server nodes in the available racks in the available rack list according to the resource occupation information of the server nodes in the available racks in the available rack list includes: according to The server node priority rules and the resource occupation information of the server nodes in the available racks in the above-mentioned available rack list are preset, and the server nodes in the available racks in the above-mentioned available rack list are reordered.
  • Set the priority rules of server nodes including: the server node with fewer containers belonging to the same application has a higher priority; if the number of containers belonging to the same application is the same, the server with fewer containers belonging to the same group.
  • the priority corresponding to the node is higher; and, if the number of containers belonging to the same group is the same, the priority corresponding to the server node with the larger number of second pits is higher.
  • a container creation apparatus includes: an obtaining module configured to obtain a list of available racks and a list of available network addresses, wherein the list of available racks includes a plurality of available racks in different availability zones available racks, each of the available racks includes at least one server node, and the available network address list includes at least one available network address; the positioning module is configured for vacancy in the available racks in the available rack list The server node performs positioning; a first creation module is configured to create a current container corresponding to the above-mentioned available network address on the above-mentioned spare server node; an update module is configured to update the above-mentioned available network address list; a first sorting module , is configured to reorder the available racks in the above-mentioned available rack list according to the resource occupancy information of the available racks in the above-mentioned available rack list; After the list of available racks, the free server nodes in the available racks and the updated list of available network addresses
  • Another aspect of the present disclosure provides an electronic device comprising: one or more processors; a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more programs described above When executed by one or more processors, the above one or more processors are caused to implement the method as described above.
  • Another aspect of the present disclosure provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement the method as described above.
  • Another aspect of the present disclosure provides a computer program comprising computer-executable instructions that, when executed, are configured to implement the method as described above.
  • FIG. 1 schematically shows a schematic diagram of a service tree according to an embodiment of the present disclosure
  • FIG. 2 schematically shows a schematic diagram of an example arrangement in the related art
  • FIG. 3 schematically shows an exemplary system architecture to which a container creation method can be applied according to an embodiment of the present disclosure
  • FIG. 4 schematically shows a flowchart of a container creation method according to an embodiment of the present disclosure
  • FIG. 5 schematically shows a flowchart of another container creation method according to an embodiment of the present disclosure
  • FIG. 6 schematically shows a flow chart of a computing resource process according to an embodiment of the present disclosure
  • FIG. 7 schematically shows an application diagram of a container creation method according to an embodiment of the present disclosure
  • FIG. 8 schematically shows a block diagram of a container creation apparatus according to an embodiment of the present disclosure.
  • FIG. 9 schematically shows a block diagram of an electronic device suitable for implementing a container creation method according to an embodiment of the present disclosure.
  • At least one of the “systems” shall include, but not be limited to, systems with A alone, B alone, C alone, A and B, A and C, B and C, and/or A, B, C, etc. ).
  • Proprietary cloud is a cloud service provider that can deploy complete cloud computing services for customers in their own data centers. All resources in the proprietary cloud are provided by cloud service providers, but the data is isolated both physically and on the network, and can only be accessed through the intranet.
  • An availability zone can be a data center with independent power and network in the same region. Since the availability of different availability zones does not affect each other, the server nodes of the customer's business system can be deployed across availability zones, which greatly improves availability.
  • the rack may be an integrated cabinet that includes multiple server nodes and provides unified power supply and network access for the multiple server nodes.
  • a server node can be a physical server device.
  • Cross Availability Zones can be allocating multiple containers to different Availability Zones.
  • Cross-rack can be the assignment of multiple containers to different racks in the same Availability Zone.
  • Across server nodes can be distributing multiple containers on different server nodes on the same rack.
  • High availability can be the balanced deployment of multiple containers in a system.
  • a server node fails to run normally due to a fault, it can ensure that the containers on the non-faulty server node can run normally and provide external services to ensure the system's availability.
  • a cluster can be a collection of computing, storage, and network resources.
  • a product line can be a cloud platform product on a proprietary cloud, for example, a cloud hosting product.
  • the system can be a stand-alone service module in the product line.
  • a product line can include one or more systems.
  • An application can be an independent functional module in the system.
  • a system may include one or more applications.
  • Groups can be independent modules that solve problems in different scenarios in the application.
  • An application can include one or more groups.
  • a group is configured to manage the environment variables and external configuration required for container operation, which is the smallest unit of deployment.
  • Node nodes can refer to worker nodes in a cluster on which real applications run.
  • the Kubelet and Proxy of K8S are run on the Node node.
  • the Kubelet and Proxy are configured to be responsible for Pod creation, startup, monitoring, restart, destruction, and load balancing in software mode.
  • the Node node may include the Node address, the Node's operating status, the Node's system capacity, and other information.
  • the Node address includes the network address of the host or the identity of the host.
  • the Node system capacity represents the system resources available to the Node node, which can include CPU, memory, and the maximum number of schedulable Pods.
  • a Pod is the smallest deployable unit of work that can be created and managed in K8S.
  • a Pod can include one or more closely related containers, such as Docker containers, that share storage, networking, and declarations of how to run the container. The containers in the Pod will be scheduled to run on the same Node node by the Master node as a whole.
  • a Pod is equivalent to a logical host, each Pod has a corresponding network address, and different containers belonging to the same Pod share the same network address and port space. The network address of each Pod changes as the Pod is destroyed and restarted.
  • Service can be the external access interface of a group of Pods that provide the same service.
  • Service has network address and port, Service provides load balancing for Pod.
  • Controllers can be used to manage Pods.
  • the deployment characteristics of the Pod are defined in the Controller, for example, how many copies are included, and what kind of Node node is it running on.
  • Running Pod in K8S is executed by Controller, and accessing Pod is executed by Service.
  • the Master node can be the master node of the cluster and is configured to host the control panel of K8S and manage the entire cluster, on which runs a set of processes ETCD, API Server, Controller Manager and Scheduler related to cluster management. Among them, API Server, Controller Manager and Scheduler form the main control center of K8S. These processes realize the management functions of cluster resource management, Pod scheduling, elastic scaling, security control, system monitoring and error correction.
  • ETCD can be a highly available distributed key-value database that can be used to persistently store all resource objects in the cluster. That is, it is mainly used to store the configuration information of the cluster and the status information of various resources. When data changes, ETCD will quickly notify the relevant components of K8S.
  • API (Application Programming Interface) Server can be the only external interface of K8S, and all requests need to be communicated through this interface.
  • API Server provides an encapsulation interface for operating etcD.
  • the encapsulation interface is basically an interface for adding, deleting, modifying and checking resource objects in the cluster and for monitoring resource changes.
  • the Controller Manager can be a management control center inside the cluster, which is mainly configured to manage various resources of the cluster and ensure that the resources are in the expected state.
  • Controller Manager can include Replication Controller (RC), Endpoints Controller, Namespace Controller and Serviceaccounts Controller, etc. Among them, RC is used to define the Pod, the number of replicas that the Pod needs to run, and the Pod label that needs to be monitored.
  • RC Replication Controller
  • Scheduler can be a scheduler in the cluster, which is mainly used to determine which Node to assign a Pod to run on.
  • Kubelet can be used for full life cycle management such as creation, modification, monitoring and deletion of Pods on Node nodes. At the same time, the status information of the Node node is reported to the Master node.
  • Proxy can be a load balancer used to implement the proxy and software mode of Service. Proxy can be a reverse proxy server of API Server. Clients outside the K8S cluster can access the API Server through Proxy.
  • An instance may be multiple resource allocation units with the same configuration and configured to support grouping functionality. Multiple containers support high availability of a group.
  • the overbooking factor can be that the cloud service provider divides the physical core logic on the physical server into multiple virtual cores, multiple virtual cores share the functions of the same physical core, and uses time slicing and other methods to realize the use of physical core resources. . Through the overbooking factor, cloud service providers can allocate resources to more tenants, thereby improving resource utilization.
  • the solution that can be adopted is to add filtering or optimization strategies in the Scheduler of K8S.
  • the process of realizing the concept of the present disclosure it is found that at least the above solution has the problem that it is difficult to realize the balanced arrangement of the containers.
  • the main reason for the above problems is that the above solutions do not consider the location distribution of server nodes in multi-availability zones and multi-racks, and because the dedicated cloud involves many products and services , and there are very strict requirements for high availability of services. Therefore, it is difficult to achieve a balanced arrangement of containers with the above solution.
  • the balanced arrangement described here refers to the containers under the same application in the availability zone, rack and server nodes.
  • the balanced arrangement on the three levels makes it difficult to meet the service requirements of high availability across availability zones, racks and server nodes.
  • the embodiments of the present disclosure provide a solution for realizing balanced arrangement of containers. It should be noted that, after determining which server node to assign the container to, the container needs to be created on the corresponding server node. Therefore, realizing the balanced creation of the container is to realize the balanced arrangement of the container.
  • FIG. 1 schematically shows a schematic diagram of a service tree according to an embodiment of the present disclosure.
  • the service tree can include tenants, applications, groups, and instances from top to bottom.
  • the top-level tenant is configured to manage quota information in the entire cluster.
  • the second-tier application is configured to manage deployment modules and environment variable information.
  • Layer 3 groups are configured to manage program versions, configuration versions, container specifications, and environment variables, and layer 4 instances are configured to manage container and network address information.
  • Each instance in the service tree corresponds to a Pod (ie, a set of containers) in K8S. It should be noted that the implementation of the balanced arrangement of containers described in the embodiments of the present disclosure is the implementation of the balanced arrangement of instances.
  • FIG. 2 schematically shows a schematic diagram of an example arrangement in the related art. As shown in FIG. 2, it includes rack 1, rack 2 and rack 3, and each rack includes four server nodes. Includes App 1, App 2, and App 3.
  • application 2 includes group 1, group 2 and group 3.
  • Group 1 includes instance 1, group 2 includes instance 2, and group 3 includes instance 3.
  • Instance 1, instance 2, and instance 3 that all belong to application 2 are allocated to the server node on rack 1, the server node on rack 2, and the server node on rack 2 by using the related technology. It can be seen that the instance 2 and instance 3 that belong to the application 2 are allocated to the same rack by using the related technology, that is, the balanced arrangement of the containers is not realized by using the related technology. This is because related technologies cannot identify availability zones and racks.
  • Embodiments of the present disclosure provide a container creation method, apparatus, electronic device, and storage medium.
  • the method includes a container creation process.
  • obtain the list of available racks and the list of available network addresses obtain the list of available racks and the list of available network addresses, locate the spare server nodes in the racks in the list of available racks, and create the current container corresponding to the available network addresses on the spare server nodes.
  • Update the list of available network addresses reorder the available racks in the available racks list according to the resource occupancy information of the available racks in the available racks list, and reorder the available racks in the available racks list after reordering Create additional containers with the spare server nodes in and the updated list of available network addresses.
  • FIG. 3 schematically illustrates an exemplary system architecture 300 to which a container creation method may be applied according to an embodiment of the present disclosure. It should be noted that FIG. 3 is only an example of the system architecture to which the embodiments of the present disclosure can be applied, so as to help those skilled in the art to understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used for other A device, system, environment or scene.
  • the system architecture 300 may include an intelligent arrangement system, a master node (ie, a Master node) and a working node (ie, a Node node).
  • the intelligent arrangement system includes API gateway, distributed key-value database (ie ETCD), intelligent resource arrangement and resource scheduling.
  • the master node includes master node 1, master node 2 and master node 3.
  • the worker nodes corresponding to the master node 1 are the worker node 1 and the worker node 2.
  • Each master node includes an application programming interface server (ie API Server), a scheduler (ie Scheduler), a distributed key-value database (ie ETCD) and a management control center (ie Controller Manager).
  • Each worker node includes Kubelet, proxy server (ie Proxy) and Pod. Each Pod includes one or more containers.
  • the existing K8S architecture includes the master node (ie, the Master node) and the worker node (ie, the Node node) in FIG. 3 .
  • the existing process of creating a container based on K8S is as follows: generate RC request information through Kubectl, and send the RC request information to ETCD through API Server, and ETCD stores the RC request information, wherein the RC request information includes the Pod to be created, the RC request information to be created The number of replicas corresponding to the Pod and the label of the Pod to be created.
  • Controller Manager listens to RC events through the monitoring resource change interface in API Server, and then obtains RC request information. If it is determined that there is no Pod to be created in the current cluster, the Pod is created according to the RC request information and sent to ETCD through the API Server. ECTD stores Pods.
  • the Scheduler listens to the RC event through the monitoring resource change interface in the API Server, and executes the scheduling process to generate an allocation relationship.
  • ETCD stores the allocation relationship.
  • the Kubelet running on the target Node node detects the Pod through the API Server, and starts the Pod according to the RC request information until the Pod's life cycle is reached.
  • the embodiment of the present disclosure adds an intelligent arrangement system to the existing K8S architecture.
  • the API gateway in the intelligent arrangement system replaces the API Server of the Master node in K8S as the only entrance to the entire cluster.
  • the intelligent scheduling system takes over the allocation and part of the scheduling of containers in the cluster.
  • the intelligent arrangement system in the embodiments of the present disclosure can be implemented independently and can be added to K8S without intrusion, the intelligent arrangement system can be applied to various K8S cluster environments without affecting the original system.
  • the container creation method provided by the embodiments of the present disclosure may generally be performed by an intelligent arrangement system, and the intelligent arrangement system may be set in a server or a server cluster.
  • the container creation apparatus provided by the embodiments of the present disclosure may generally be set in a server or a server cluster.
  • FIG. 4 schematically shows a flowchart of a container creation method according to an embodiment of the present disclosure.
  • the method includes operations S410 ⁇ S460.
  • an available rack list and an available network address list are obtained, wherein the available rack list includes a plurality of available racks in different availability zones, each available rack includes at least one server node, and the available network address list includes at least one available rack.
  • An available network address is obtained, wherein the available rack list includes a plurality of available racks in different availability zones, each available rack includes at least one server node, and the available network address list includes at least one available rack.
  • the list of available racks may include a plurality of available racks, different available racks may belong to different availability zones, and each available rack may include at least one server node. Multiple available racks in the Available Racks list can be sorted by priority.
  • the list of available racks includes available rack 1 , available rack 2 and available rack 3 .
  • available rack 1 and available rack 2 belong to availability zone 1
  • available rack 3 belongs to availability zone 2.
  • a server node 1 , a server node 2 and a server node 3 are provided on the available rack 1 .
  • a server node 4 and a server node 5 are provided on the available rack 2 .
  • a server node 6 , a server node 7 and a server node 8 are provided on the available rack 3 .
  • the list of available network addresses may include at least one available network address, wherein each available network address refers to a network address that may be configured to set the Pod's network address but has not been used.
  • a list of available network addresses can be obtained as follows.
  • Get a list of total network addresses Get a list of assigned network addresses.
  • the list of available network addresses is determined from the list of total network addresses and the list of assigned network addresses.
  • the list of assigned network addresses includes at least one assigned network address, and each assigned network address refers to the network address of the set Pod. Each network address in the list of total network addresses can be used to set up the Pod. Determining the available network address list according to the total network address list and the assigned network address list may include: subtracting the assigned network address list from the total network address list to obtain the available network address list.
  • an available rack in the list of available racks may or may not have a spare server node.
  • a spare server node may refer to a server node with spare resources.
  • a spare resource can be understood as a resource with a set container.
  • the list of available racks includes a plurality of available racks, it can be determined whether there are spare server nodes in each of the available racks in a preset sequence until the spare server nodes are determined.
  • multiple available racks in the list of available racks can be sorted by priority, it can be determined whether there is a spare server node in each available rack in order of priority from high to low.
  • an available network address may be selected from the list of available network addresses as the target network address, and a current container corresponding to the target network address is created on the spare server node.
  • Creating the current container corresponding to the target network address on the spare server node may include creating the current Pod corresponding to the target network address on the spare server node, and creating the current container instance in the current Pod.
  • the available network address here may refer to the target network address. Since the corresponding current container is created on the target network address, therefore , the target network address changes from an available network address to an assigned network address, and accordingly, the available network addresses included in the available network address list will change, and the available network address list needs to be updated.
  • updating the list of available network addresses may include deleting the target network address in the list of available network addresses to obtain an updated list of available network addresses.
  • the available racks in the available rack list are reordered according to the resource occupation information of the available racks in the available rack list.
  • the resource occupancy information of the available racks may represent resources occupied by containers set on the available racks.
  • the resource occupancy information of the available racks may include the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of first slots, where the first number of slots may be the total number of resources of the available racks and all created containers. The ratio of the amount of resources used.
  • the resource occupancy information of the available racks in the available rack list changes, therefore, it is necessary to check the available racks.
  • the available racks in the list are reordered to obtain a reordered list of available racks.
  • Reordering the available racks in the available rack list according to the resource occupation information of the available racks in the available rack list may include obtaining the application to which the current container belongs and the group to which it belongs. Get the previous resource occupancy information of the current rack and the previous resource occupancy information of other racks in the list of available racks.
  • the current resource occupation information of the current rack is determined according to the application to which the current container belongs, the group to which the current container belongs, and the previous resource occupation information of the current rack.
  • the racks in the available rack list are reordered according to the current resource usage information of the current rack in the available rack list and the previous resource usage information of other racks in the available rack list.
  • the current rack may refer to an available rack with the highest priority in the available rack list.
  • each time a container is created the list of available network addresses needs to be updated, and the racks in the list of available racks need to be reordered to create the next container until all containers are completed. create. Since the container is created on the corresponding spare server node, it is also equivalent to assigning each container to the corresponding spare server node.
  • a resource request may be obtained, wherein the resource request may include the number of containers to be created.
  • obtain a list of currently available racks and a list of currently available network addresses Locate the spare server nodes in the available racks in the list of currently available racks.
  • On a spare server node create the current container corresponding to the currently available network address.
  • Update the currently available network address list to obtain a new available network address list, and use the new network address list as the current available network address list.
  • the resource occupancy information of the available racks in the currently available rack list reorder the available racks in the currently available rack list to obtain a new available rack list, and use the new available rack list as the currently available rack list Rack list.
  • Repeatedly locate the spare server nodes in the available racks in the list of currently available racks, and on the spare server nodes create the current container corresponding to the currently available network address, until the number of containers to be created is completed.
  • the resource request may further include the specification of the container to be created, the application to which the container to be created belongs, and the group to which the container to be created belongs.
  • the specification of the container to be created can refer to the CPU and memory required by the container to be created.
  • the list of available racks includes multiple available racks in different availability zones, each available rack includes at least one server node, and the available network
  • the address list includes at least one available network address, locate the spare server node in the available rack in the available rack list, create a current container corresponding to the available network address on the spare server node, update the available network address list, according to The resource occupancy information of the available racks in the available racks list, reorder the available racks in the available racks list, and update according to the free server nodes in the available racks in the reordered available racks list and update After the list of available network addresses, create additional containers.
  • the available racks in the available rack list are reordered according to the resource occupancy information of the available racks in the available rack list, and then based on the reordered available racks
  • the spare server nodes in the available racks in the rack list and the updated list of available network addresses are used to create the next container, in which the spare server nodes are from the available racks in different availability zones, thus achieving a balanced arrangement of containers Therefore, the technical problem that it is difficult to achieve a balanced arrangement of containers by using the related art is at least partially overcome.
  • the service requirements for high availability across availability zones, racks and server nodes are met, thereby effectively avoiding the occurrence of system paralysis.
  • obtaining a list of available racks may include the following operations.
  • Get the total resources for each server node in each rack Get the used resources of each server node, where the used resources are the resources used by the created container.
  • the available racks are determined based on the total resources of each server node and the used resources of each server node. Generates a list of available racks based on available racks.
  • the total resources of each server node may be determined in the following manner. Obtain server node resources, where the server node resources include CPU and memory. Get the overbooking factor corresponding to the server node. The total resources of the server nodes are determined according to the server node resources and the oversale coefficient, that is, the total resources of the server nodes are obtained by multiplying the server node resources by the oversale coefficient.
  • determining the available racks according to the total resources of the server node and the used resources of the server node which may include comparing the total resources of the server node with the used resources of the server node Subtract the resources to obtain the remaining resources of the server node. Based on this, the remaining resources of each server node on the rack can be obtained. Whether the rack is an available rack is determined according to the remaining resources of each server node on the rack. If the remaining resources of each server node on the rack is greater than or equal to the remaining resource threshold, the rack may be determined as an available rack. The remaining resource threshold may be determined according to the actual situation, which is not limited here.
  • the plurality of available racks in the available rack list are sorted by priority.
  • multiple available racks in the available rack list may be sorted according to their priorities, so that spare server nodes may be subsequently selected according to the priorities of the available racks, and create containers on spare server nodes.
  • the multiple available racks in the available rack list are sorted by priority in the following manner.
  • Obtain a list of created containers where the list of created containers includes multiple created containers, and each created container has a corresponding server node, an application to which it belongs, and a group to which it belongs.
  • the created quantity information corresponding to each server node is determined, wherein the created quantity information includes the quantity of the created containers belonging to the same application and the quantity of the created containers belonging to the same group.
  • the multiple available racks in the available rack list are prioritized according to the created quantity information corresponding to each server node.
  • a created container list may be obtained, the created container list may include multiple created containers, and a created container may refer to a Create Pods.
  • Each created container has a corresponding server node means that each created container has a corresponding server node.
  • each created container has its owning application and its owning group.
  • determining the creation quantity information corresponding to each server node may include, for each created container, increasing the count of the application to which the created container belongs on the server node corresponding to the created container 1 and the count of the group to which this created container belongs is incremented by 1. Based on this, the application to which each created container belongs and the group to which it belongs can be associated with the corresponding server node.
  • each creation quantity information corresponding to the server node is determined, wherein each creation quantity information may include the quantity of the created containers belonging to the same application and the created containers belonging to the same group quantity.
  • the created quantity information of all server nodes included in each available rack the created quantity information of the available rack can be determined, that is, the number of created containers belonging to the same application and the created containers belonging to the same group in the available rack can be determined the number of containers. Based on this, information on the created quantity of each available rack in the available rack list can be obtained.
  • prioritizing each available rack according to the created quantity information of each available rack in the available rack list may include, according to preset rack priority rules and each available rack list Information on the number of available racks created, and prioritizes the available racks in the available rack list.
  • the preset rack priority rules can include available racks with fewer containers belonging to the same application. The corresponding priority is higher. If the number of containers belonging to the same application is the same, the priority corresponding to the available rack with fewer containers belonging to the same group is higher. If the number of containers belonging to the same group is the same, the priority corresponding to an available rack with a larger number of first slots is higher.
  • the first number of pits may be the ratio of the total resources of the available racks to the resources used by all created containers. The number of containers mentioned here refers to the number of containers that have been created.
  • the created container list includes created container 1 , created container 2 and created container 3 .
  • the list of available racks includes Available Rack 1 and Available Rack 2.
  • Available rack 1 includes server node 1 , server node 2 and server node 3 .
  • Available rack 2 includes server node 4 and server node 5 .
  • the server node corresponding to the created container 1 is server node 1, the application it belongs to is application 1, and the group it belongs to is group 1.
  • the server node corresponding to the created container 2 is server node 1, the application it belongs to is application 1, and the group it belongs to is group 1.
  • the server node corresponding to the created container 3 is server node 4, the application it belongs to is application 1, and the group it belongs to is group 2.
  • the creation quantity information corresponding to the server node 1 is determined.
  • the created quantity information includes that the number of created containers belonging to application 1 is 2, and the number of created containers belonging to group 1 is 2.
  • the creation quantity information corresponding to the server node 2 is determined. Among them, the created quantity information is 0.
  • the creation quantity information corresponding to the server node 3 is determined. Among them, the created quantity information is 0.
  • the creation quantity information corresponding to the server node 4 is determined.
  • the created quantity information includes that the number of created containers belonging to application 1 is 1, and the number of created containers belonging to group 2 is 1.
  • the creation quantity information corresponding to the server node 5 is determined. Among them, the created quantity information is 0.
  • the creation quantity information corresponding to the server node 6 is determined. Among them, the created quantity information is 0.
  • the created quantity information of server node 1 includes that the number of created containers belonging to application 1 is 2, and the number of created containers belonging to group 1 is 2 .
  • server node 4 and server node 5 it is determined that the created quantity information of available racks 2 includes that the number of created containers belonging to application 1 is 1, and the number of created containers belonging to group 2 is 1.
  • the available racks 1 and the available racks 2 are prioritized according to the preset rack priority rule, the information of the created quantity of the available racks 1 and the information of the created quantity of the available racks 2 . Since the number of the available rack 1 belonging to the same application 1 is greater than the number of the available rack 1 belonging to the same application 1 , the priority of the available rack 2 is higher than the priority of the available rack 1 .
  • a basis is provided for the balanced arrangement of containers at the rack level.
  • locating a spare server node in an available rack in the list of available racks may include the following operations.
  • the available rack with the highest priority in the available rack list is determined as the current rack. Determines whether the number of spare server nodes in the current rack is greater than a preset threshold. When the number of spare server nodes in the current rack is greater than the preset threshold, locate the spare server nodes in the current rack. In the case that the number of spare server nodes in the current rack is less than or equal to the preset threshold, the available rack with the next priority in the list of available racks is determined as the current rack. Return to perform the operation of determining whether the number of spare server nodes in the current rack is greater than the preset threshold, until the spare server nodes in the current rack are located.
  • the determination may be performed according to the priority of the available racks.
  • an available rack with the highest priority in the available rack list is determined as the current rack, and it is determined whether the number of spare server nodes in the current rack is greater than a preset threshold. If the number of spare server nodes in the current rack is greater than the preset threshold, locate the spare server nodes from the current rack. If the number of spare server nodes in the current rack is less than or equal to the preset threshold, determine the available rack with the next priority in the list of available racks as the current rack, and execute whether the number of spare server nodes in the current rack is greater than the preset threshold. Thresholding operations until a spare server node is located from the current rack.
  • the plurality of server nodes included in each available rack in the list of available racks are sorted by priority.
  • the ordering of multiple server nodes according to their priorities is achieved by obtaining a list of created containers, wherein the list of created containers includes multiple created containers, and each created container has a corresponding server node, an application to which it belongs, and a group to which it belongs. .
  • the created quantity information corresponding to each server node is determined, wherein the created quantity information includes the quantity of the created containers belonging to the same application and the quantity of the created containers belonging to the same group.
  • the multiple server nodes are prioritized according to the creation quantity information corresponding to each server node.
  • the preset server node priority rules may include the number of containers belonging to the same application Fewer server nodes correspond to higher priorities. If the number of containers belonging to the same application is the same, the server node with fewer containers belonging to the same group has a higher priority. If the number of containers belonging to the same group is the same, a server node with a larger number of second pits corresponds to a higher priority. The second number of pits is the ratio of the total resources of the server node to the resources used by all created containers. The number of containers here refers to the number of containers that have been created.
  • reordering the available racks in the available rack list according to the resource occupation information of the available racks in the available rack list may include the following operations.
  • the current resource occupation information of the current rack is determined according to the application to which the current container belongs, the group to which the current container belongs, and the previous resource occupation information of the current rack.
  • the available racks in the available rack list are reordered according to the current resource occupation information of the current rack in the available rack list and the previous resource occupation information of other racks in the available rack list.
  • the previous resource occupation information of the current rack has changed. Therefore, the application and the group to which the current container belongs needs to be , and update the previous resource occupation information of the current rack to obtain the current resource occupation information of the current rack.
  • the previous resource occupation information of the current rack and the previous resource occupation information of other racks both refer to the resource occupation information corresponding to the current rack and other racks before the current container is created.
  • the available racks in the list of available racks can be updated according to the current resource occupancy information of the current rack and the previous resource occupancy information of other racks.
  • Racks are reordered.
  • the resource occupation information of the current rack and other racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of first slots.
  • the number of pits is the ratio of the total resources of the rack to the resources used by all created containers.
  • the resource occupation information of the available racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of first slots.
  • the available racks include the current rack and other racks.
  • the resource occupation information includes the current resource occupation information of the current rack and the previous resource occupation information of other racks.
  • the first number of pits may represent resource information of the rack.
  • the available racks in the available rack list are evaluated.
  • Reordering can include the following operations.
  • the preset rack priority rules the current resource occupation information of the current rack in the available rack list, and the previous resource occupation information of other racks in the available rack list, the available racks in the available rack list are evaluated. Reordering is performed, wherein the preset rack priority rule may include: the lower the number of containers belonging to the same application, the higher the priority corresponding to the available racks. If the number of containers belonging to the same application is the same, the priority corresponding to the available rack with fewer containers belonging to the same group is higher. If the number of containers belonging to the same group is the same, the priority corresponding to an available rack with a larger number of first slots is higher.
  • the previous resource occupation information of other racks includes the number of containers belonging to the same application, the number of containers belonging to the same group Therefore, for each application, the priority corresponding to an available rack with a smaller number of containers belonging to the same application is higher. If the number of containers belonging to the same application is the same, the priority corresponding to the available rack with fewer containers belonging to the same group is higher. If the number of containers belonging to the same group is the same, the available racks in the list of available racks are reordered by a preset rack priority rule with a higher priority corresponding to an available rack with a larger number of first slots. Among them, the available racks include the current rack and other racks.
  • a basis is provided for the balanced arrangement of containers at the rack level.
  • the above container creation method may further include the following operations.
  • the server nodes in the available racks in the available racks list are reordered according to the resource occupancy information of the server nodes in the available racks in the available racks list.
  • Creating other containers based on the spare server nodes in the available racks in the reordered list of available racks and the updated list of available network addresses may include the following operations.
  • a new spare server node in the available rack is determined based on the available racks in the reordered list of available racks and the server nodes in the available racks. Create additional containers based on new spare server nodes and an updated list of available network addresses.
  • the application to which the current container belongs and the group to which it belongs can be acquired. Get the last resource usage information of the server node in the list of available racks.
  • the previous resource occupation information of the spare server node is updated according to the application to which the current container belongs and the group to which the current container belongs, so as to obtain the current resource occupation information of the spare server node.
  • the available racks According to the current resource occupancy information of the spare server nodes of the available racks in the available rack list and the previous resource occupancy information of other server nodes except the spare server nodes in the available racks in the available rack list, the available racks
  • the server nodes in the available racks are reordered in the list.
  • a new spare server node in the available racks may be determined according to the above.
  • the server nodes in the available racks in the available rack list can be sorted according to the priority
  • the positioning can be performed according to the priority of the server node. That is, the available rack with the highest priority in the available rack list is determined as the current rack.
  • the server node with the highest priority in the current rack is determined as the current server node. Determines whether the current server node is a spare server node. If the current server node is a spare server node, the current server node is determined as a spare server node.
  • the current server node is not a spare server node, determine the server node corresponding to the next priority in the current rack as the current server node, and return to perform the operation of determining whether the current server node is a spare server node until the spare server node is determined. to locate.
  • the resource occupation information of the server nodes in the available racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of second slots, where the second slot
  • the number of bits is the ratio of the total resources of the server node to the resources used by all created containers.
  • the second pit number may represent resource information of the server node.
  • reordering the server nodes in the available racks in the available rack list according to the resource occupation information of the server nodes in the available racks in the available rack list may include the following operations.
  • the server nodes in the available racks in the available rack list are reordered according to the preset server node priority rules and the resource occupancy information of the server nodes in the available racks in the available rack list, wherein the preset server
  • the node priority rule may include: a server node with a smaller number of containers belonging to the same application corresponds to a higher priority. If the number of containers belonging to the same application is the same, the server node with fewer containers belonging to the same group has a higher priority. If the number of containers belonging to the same group is the same, the higher the priority corresponding to the server node with the larger number of second pits.
  • the resource occupancy information of the server node includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of second pits, therefore, for each application, according to the number of the server nodes belonging to the same application, the smaller the number of containers.
  • the corresponding priority is higher. If the number of containers belonging to the same application is the same, the server node with fewer containers belonging to the same group has a higher priority. If the number of containers belonging to the same group is the same, the server nodes in the available racks in the list of available racks are subject to the preset server node priority rule with a higher priority corresponding to a server node with a larger number of second slots. rearrange.
  • a basis is provided for the balanced arrangement of containers at the server node level.
  • FIG. 5 schematically shows a flowchart of another container creation method according to an embodiment of the present disclosure.
  • the method includes operations S501 to S530.
  • a resource request is obtained, wherein the resource request includes the number of containers to be created.
  • an available rack is determined according to the total resources of each server node and the used resources of each server node.
  • an available rack list is generated according to the available racks.
  • a created container list is obtained, wherein the created container list includes a plurality of created containers, and each created container has a corresponding server node, an application to which it belongs, and a group to which it belongs.
  • the creation quantity information corresponding to each server node is determined, wherein the creation quantity information includes the quantity of the created containers belonging to the same application and the quantity of the created containers belonging to the same group.
  • information on the created quantity of each available rack is determined according to the created quantity information of all server nodes included in each available rack.
  • the multiple available racks in the available rack list are prioritized according to the preset rack priority rule and the information on the created quantity of the multiple available racks in the available rack list.
  • a list of available network addresses is obtained, wherein the list of available network addresses includes at least one available network address.
  • the available rack with the highest priority in the available rack list is determined as the current rack.
  • the spare server nodes in the current rack are determined according to the priorities of the plurality of service nodes in the current rack, and operation S516 is performed.
  • one available network address is selected from the available network address list as the target network address.
  • operation S517 on the spare server node, a current container corresponding to the target network address is created, and operation S520 is performed.
  • the current resource occupation information of the current rack is determined according to the application to which the current container belongs, the group to which the current container belongs, and the previous resource occupation information of the current rack.
  • the server nodes in the available racks in the available rack list are reordered according to the preset server node priority rule and the resource occupation information of the server nodes in the available racks in the available rack list.
  • a new spare server node in the available rack is determined according to the available racks in the reordered available rack list and the server nodes in the available rack, and operation S530 is performed.
  • next container is created according to the new spare server node and the updated list of available network addresses, the next container is used as the current container, and the operation returns to perform operation S520.
  • the essence of the method for creating a K8S container based on the embodiment of the present disclosure is that according to the availability zone of the deployment environment, the placement information of racks and server nodes, and the cluster service information in the service tree in FIG.
  • Different containers that is, instances in the service tree
  • Different containers are allocated to corresponding server nodes according to the scheduling policy, so as to achieve a balanced arrangement of containers. Since the container needs to be created on the corresponding server node after determining which server node to assign the container to, realizing the balanced creation of the container is to realize the balanced arrangement of the container.
  • the scheduling strategy is: 1. For a multi-availability zone scenario, different containers under the same application are preferentially allocated to different availability zones. 2. Under the premise of Guarantee 1, if the availability zone includes multiple racks and multiple containers under the same application are allocated to the availability zone, the containers in the same availability zone are preferentially allocated to different racks. Under the premise of Guarantee 2, if the rack includes multiple server nodes and multiple containers under the same application are allocated on the rack, the containers on the same rack are preferentially allocated to different server nodes.
  • the containers under the same application can be arranged in a balanced manner at the three levels of availability zone, rack and server node.
  • FIG. 6 schematically shows a flow chart of a computing resource process according to an embodiment of the present disclosure.
  • FIG. 6 shows the generation process of the available rack list, which is an illustration of operations S502 ⁇ S510 .
  • the K8S master in Figure 6 is the Master node (ie the master node) described above.
  • the node list refers to the server node list.
  • the Node resource is the server node resource described above.
  • the server node list is counted according to the racks where the server nodes are located to calculate the resource status of the racks to generate a list of available racks.
  • the racks are prioritized according to the preset rack priority rule in operation S510.
  • the server nodes in the rack are prioritized according to the preset server node priority rule in operation S508.
  • the number of node pits and the total number of pits are calculated, and the total number of pits is compared with the to-be-allocated number calculated in response to the resource request to determine whether the resource request can be responded to. That is, if the total number of pits is greater than or equal to the number to be allocated, a list of available racks and a list of allocated network addresses are returned. If the total number of pits is less than the number to be allocated, the allocation exception information is generated.
  • the available racks in the available rack list need to be reordered, and the server nodes in the available racks in the available rack list need to be reordered.
  • FIG. 7 schematically shows an application diagram of a container creation method according to an embodiment of the present disclosure.
  • the system application in Fig. 7 includes five layers, namely product line, system, application, grouping and instance. Now, the instance 1 to be created, the instance 2 to be created, and the instance 2 to be created under the same application need to be created on the corresponding server nodes.
  • the Availability Zone can be randomly selected. Now select availability zone 1, and create instance 1 to be created on server node 1 in rack 1 in availability zone 1 according to operations S501 and S530.
  • Availability Zone 2 is selected, and according to operations S501 and S530, the machines in Availability Zone 2 Instance 2 to be created is created on server node 5 in rack 3.
  • the located spare server nodes are server nodes that meet the requirements for balanced arrangement of containers.
  • the balanced arrangement at the three levels of availability zone, rack and server node therefore, at least partially overcomes the technical problem that it is difficult to achieve balanced arrangement of containers by using the related technology.
  • the service requirements for high availability across availability zones, racks and server nodes are met, thereby effectively avoiding the occurrence of system paralysis.
  • FIG. 8 schematically shows a block diagram of a container creation apparatus according to an embodiment of the present disclosure.
  • the container creation apparatus 800 includes an acquisition module 810 , a positioning module 820 , a first creation module 830 , an update module 840 , a first sorting module 850 and a second creation module 860 .
  • the obtaining module 810 is configured to obtain a list of available racks and a list of available network addresses, wherein the list of available racks includes a plurality of available racks in different availability zones, each available rack includes at least one server node, and the available network
  • the address list includes at least one available network address.
  • the positioning module 820 is configured to locate spare server nodes in the available racks in the available rack list.
  • the first creation module 830 is configured to create the current container corresponding to the available network address on the spare server node.
  • the update module 840 is configured to update the list of available network addresses.
  • the first sorting module 850 is configured to reorder the available racks in the available rack list according to the resource occupation information of the available racks in the available rack list.
  • the second creation module 860 is configured to create other containers according to the spare server nodes in the available racks and the updated list of available network addresses in the reordered list of available racks.
  • the list of available racks includes multiple available racks in different availability zones, each available rack includes at least one server node, and the available network
  • the address list includes at least one available network address, locate the spare server node in the available rack in the available rack list, create a current container corresponding to the available network address on the spare server node, update the available network address list, according to The resource occupancy information of the available racks in the available racks list, reorder the available racks in the available racks list, and update according to the free server nodes in the available racks in the reordered available racks list and update After the list of available network addresses, create additional containers.
  • the available racks in the available rack list are reordered according to the resource occupancy information of the available racks in the available rack list, and then based on the reordered available racks
  • the spare server nodes in the available racks in the rack list and the updated list of available network addresses are used to create the next container, in which the spare server nodes are from the available racks in different availability zones, thus achieving a balanced arrangement of containers Therefore, the technical problem that it is difficult to achieve a balanced arrangement of containers by using the related art is at least partially overcome.
  • the service requirements for high availability across availability zones, racks and server nodes are met, thereby effectively avoiding the occurrence of system paralysis.
  • acquiring the list of available racks may include: acquiring total resources of each server node in each rack. Get the used resources of each server node, where the used resources are the resources used by the created container. The available racks are determined based on the total resources of each server node and the used resources of each server node. Generates a list of available racks based on available racks.
  • the plurality of available racks in the available rack list are sorted by priority.
  • the multiple available racks in the available rack list are sorted by priority by obtaining a list of created containers, wherein the created container list includes a plurality of created containers, each of which has been Creating a container has a corresponding server node, belonging application and belonging group.
  • the created quantity information corresponding to each server node is determined, wherein the created quantity information includes the quantity of the created containers belonging to the same application and the quantity of the created containers belonging to the same group.
  • the multiple available racks in the available rack list are prioritized according to the created quantity information corresponding to each server node.
  • the positioning module 820 may include a first determining sub-module, a second determining sub-module, a first positioning sub-module, a second positioning sub-module, and a returning sub-module.
  • the first determining submodule is configured to determine the available rack with the highest priority in the available rack list as the current rack.
  • the second determination submodule is configured to determine whether the number of spare server nodes in the current rack is greater than a preset threshold.
  • the first positioning submodule is configured to locate the spare server nodes in the current rack when the number of spare server nodes in the current rack is greater than a preset threshold.
  • the second positioning sub-module is configured to determine the available rack of the next priority in the available rack list as the current rack when the number of spare server nodes in the current rack is less than or equal to the preset threshold.
  • the returning submodule is configured to return to perform the operation of determining whether the number of spare server nodes in the current rack is greater than a preset threshold, until the spare server nodes in the current rack are located.
  • the first sorting module 840 may include a first obtaining sub-module, a second obtaining sub-module, a third obtaining sub-module, and a sorting sub-module.
  • the first obtaining sub-module is configured to obtain the application to which the current container belongs and the group to which it belongs.
  • the second obtaining submodule is configured to obtain the previous resource occupation information of the current rack in the available rack list.
  • the third obtaining submodule is configured to obtain the previous resource occupation information of other racks in the available rack list.
  • the third determining submodule is configured to determine the current resource occupation information of the current rack according to the application to which the current container belongs, the group to which the current container belongs, and the previous resource occupation information of the current rack.
  • the first sorting submodule is configured to, according to the current resource occupation information of the current rack in the available rack list and the previous resource occupation information of other racks in the available rack list, sort the available racks in the available rack list. Racks are reordered.
  • the resource occupation information of the current rack and other racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of first slots.
  • the number of pits is the ratio of the total resources of the rack to the resources used by all created containers.
  • the first sorting submodule may include a sorting unit.
  • the sorting unit is configured to sort the available racks according to the preset rack priority rule, the current resource occupation information of the current rack in the available rack list, and the previous resource occupation information of other racks in the available rack list.
  • the available racks in the rack list are reordered, with preset rack priority rules, including:
  • the priority corresponding to the available rack with fewer containers belonging to the same group is higher.
  • the priority corresponding to an available rack with a larger number of first slots is higher.
  • the container creation apparatus 800 may further include a second sorting module.
  • the second sorting module is configured to reorder the server nodes in the available racks in the available rack list according to the resource occupancy information of the server nodes in the available racks in the available rack list.
  • the second creation module 850 may include a fourth determination sub-module and a creation sub-module.
  • the fourth determining submodule is configured to determine a new spare server node in the available rack according to the available racks in the reordered available rack list and the server nodes in the available rack.
  • Create submodule configured to create additional containers based on new spare server nodes and an updated list of available network addresses.
  • the resource occupation information of the server nodes in the available racks in the available rack list includes the number of containers belonging to the same application, the number of containers belonging to the same group, and the number of second slots, where the second slot
  • the number of bits is the ratio of the total resources of the server node to the resources used by all created containers.
  • the second sorting module may include a second sorting sub-module.
  • the second sorting submodule is configured to, according to the preset server node priority rule and the resource occupation information of the server nodes in the available racks in the available rack list, sort the servers in the available racks in the available rack list
  • the nodes are reordered, and the preset server node priority rules include:
  • a server node with fewer containers belonging to the same application has a higher priority.
  • the server node with fewer containers belonging to the same group has a higher priority.
  • a server node with a larger number of second pits corresponds to a higher priority.
  • Any of the modules, sub-modules, and units according to embodiments of the present disclosure, or at least part of the functions of any of them, may be implemented in one module. Any one or more of the modules, sub-modules, and units according to the embodiments of the present disclosure may be divided into multiple modules for implementation.
  • any one or more of the modules, sub-modules, and units according to the embodiments of the present disclosure may be implemented at least partially as hardware circuits, such as Field Programmable Gate Array (FPGA), Programmable Logic Array (Programmable Logic Array) Logic Arrays, PLA), system on chip, system on substrate, system on package, application specific integrated circuit (ASIC), or any other reasonable means of hardware or firmware that can be integrated or packaged by a circuit It can be realized by any one of the three implementation manners of software, hardware and firmware, or by any suitable combination of any of them.
  • one or more of the modules, sub-modules, and units according to the embodiments of the present disclosure may be implemented at least in part as computer program modules, which, when executed, may perform corresponding functions.
  • any number of acquisition module 810, location module 820, first creation module 830, update module 840, first sorting module 850, and second creation module 860 may be combined in one module/submodule/unit to implement, or Any one of the modules/submodules/units can be split into multiple modules/submodules/units. Alternatively, at least part of the functionality of one or more of these modules/submodules/units may be combined with at least part of the functionality of other modules/submodules/units and combined in one module/submodule/unit realized in.
  • At least one of the acquisition module 810, the positioning module 820, the first creation module 830, the update module 840, the first sorting module 850, and the second creation module 860 may be implemented at least partially as a hardware circuit, For example, Field Programmable Gate Array (FPGA), Programmable Logic Array (PLA), System on Chip, System on Substrate, System on Package, Application Specific Integrated Circuit (ASIC), or any other circuit that can be integrated or packaged by It can be realized by hardware or firmware in a reasonable manner such as software, or by any one of the three implementation modes of software, hardware and firmware, or by any suitable combination of any of them.
  • FPGA Field Programmable Gate Array
  • PLA Programmable Logic Array
  • ASIC Application Specific Integrated Circuit
  • At least one of the acquisition module 810, the location module 820, the first creation module 830, the update module 840, the first sorting module 850, and the second creation module 860 may be implemented at least in part as a computer program module, when the computer program When the module is run, it can perform the corresponding function.
  • the container creation device part in the embodiment of the present disclosure corresponds to the container creation method part in the embodiment of the present disclosure, and the description of the container creation device part refers to the container creation method part, which is not repeated here.
  • Figure 9 schematically shows a block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure.
  • the electronic device shown in FIG. 9 is only an example, and should not impose any limitation on the function and scope of use of the embodiments of the present disclosure.
  • an electronic device 900 includes a processor 901 , which can be loaded into a random access memory according to a program stored in a read-only memory (Read-Only Memory, ROM) 902 or from a storage part 908 (Random Access Memory, RAM) program in 903 to execute various appropriate actions and processes.
  • the processor 901 may include, for example, a general-purpose microprocessor (eg, a CPU), an instruction set processor and/or a related chipset, and/or a special-purpose microprocessor (eg, an application-specific integrated circuit (ASIC)), among others.
  • the processor 901 may also include on-board memory for caching purposes.
  • the processor 901 may comprise a single processing unit or a plurality of processing units configured to perform different actions of the method flow according to an embodiment of the present disclosure.
  • the processor 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904.
  • the processor 901 performs various operations of the method flow according to an embodiment of the present disclosure by executing programs in the ROM 902 and/or the RAM 903.
  • the program may also be stored in one or more memories other than ROM 902 and RAM 903.
  • the processor 901 may also perform various operations of the method flow according to the embodiments of the present disclosure by executing programs stored in the one or more memories.
  • the electronic device 900 may also include an input/output (I/O) interface 905 which is also connected to the bus 904 .
  • the system 900 may also include one or more of the following components connected to the I/O interface 905: an input portion 906 including a keyboard, mouse, etc.; including a cathode ray tube (CRT), a liquid crystal display (LCD) such as ) etc. and an output section 907 of speakers and the like; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card, a modem and the like.
  • the communication section 909 performs communication processing via a network such as the Internet.
  • Driver 910 is also connected to I/O interface 905 as needed.
  • a removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 910 as needed so that a computer program read therefrom is installed into the storage section 908 as needed.
  • the method flow according to an embodiment of the present disclosure may be implemented as a computer software program.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code configured to perform the methods illustrated in the flowcharts.
  • the computer program may be downloaded and installed from the network via the communication portion 909, and/or installed from the removable medium 911.
  • the above-described functions defined in the system of the embodiment of the present disclosure are performed.
  • the above-described systems, apparatuses, apparatuses, modules, units, etc. can be implemented by computer program modules.
  • the present disclosure also provides a computer-readable storage medium.
  • the computer-readable storage medium may be included in the device/apparatus/system described in the above embodiments; it may also exist alone without being assembled into the device/system. device/system.
  • the above-mentioned computer-readable storage medium carries one or more programs, and when the above-mentioned one or more programs are executed, implement the method according to the embodiment of the present disclosure.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM (Erasable Programmable Read Only Memory) or flash memory), portable compact Disk read-only memory (Computer Disc Read-Only Memory, CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable storage medium may include one or more memories other than ROM 902 and/or RAM 903 and/or ROM 902 and RAM 903 described above.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams or flowchart illustrations, and combinations of blocks in the block diagrams or flowchart illustrations can be implemented in special purpose hardware-based systems that perform the specified functions or operations, or can be implemented using A combination of dedicated hardware and computer instructions is implemented.
  • Those skilled in the art will appreciate that various combinations and/or combinations of features recited in various embodiments and/or claims of the present disclosure are possible, even if such combinations or combinations are not expressly recited in the present disclosure.
  • various combinations and/or combinations of the features recited in the various embodiments of the present disclosure and/or the claims may be made without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of this disclosure.

Landscapes

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

Abstract

一种容器创建方法、装置、电子设备及存储介质,该方法包括:获取可用机架列表和可用网络地址列表,其中,可用机架列表包括不同可用区的多个可用机架,每个可用机架中包括至少一个服务器节点,可用网络地址列表包括至少一个可用网络地址(S410);对可用机架列表中的可用机架中的空余服务器节点进行定位(S420);在空余服务器节点上,创建与可用网络地址对应的当前容器(S430);更新可用网络地址列表(S440);根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序(S450);以及,根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器(S460)。

Description

容器创建方法、装置、电子设备及存储介质
相关申请的引用
本申请要求于2020年8月31日向中国国家知识产权局递交的题为“容器创建方法、装置、电子设备及存储介质置”的中国专利申请202010900719.6的优先权,该申请的全部内容通过引用一并于此。
技术领域
本公开属于计算机技术领域,具体涉及一种容器创建方法、装置、电子设备及存储介质。
背景技术
随着专有云平台中产品的不断壮大,平台中的各类产品服务和容器也越来越多。如果全部容器都由运维人员手动维护,则无疑会带来很大的人员消耗和不确定因素,导致运维成本和故障率增加。
为了解决上述问题,各种容器集群管理平台应运而生。容器集群管理平台可以提供容器编排、资源调度、弹性伸缩、部署管理和服务发现等一系列功能。其中,容器集群管理平台如Kubernates(简称K8S)。
公开内容
本公开的一个方面提供了一种容器创建方法,该方法包括:获取可用机架列表和可用网络地址列表,其中,上述可用机架列表包括不同可用区的多个可用机架,每个上述可用机架中包括至少一个服务器节点,上述可用网络地址列表包括至少一个可用网络地址;对上述可用机架列表中的可用机架中的空余服务器节点进行定位;在上述空余服务器节点上,创建与上述可用网络地址对应的当前容器;更新上述可用网络地址列表;根据上述可用机架列表中的可用机架的资源占用信息,对上述可用机架列表中的可用机架进行重新排序;以及,根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
根据本公开的实施例,上述获取可用机架列表,包括:获取每个机架中的每个服务器节点的总资源;获取每个上述服务器节点的已使用资源,其中,上述已使用资源为已创建容器所使用的资源;根据每个上述服务器节点的总资源和每个上述服务器节点的已使用资源,确定可用机架;以及,根据上述可用机架生成上述可用机架列表。
根据本公开的实施例,上述可用机架列表中的多个上述可用机架按照优先级进行排序。
根据本公开的实施例,通过如下方式实现上述可用机架列表中的多个上述可用机架按照优先级进行排序:获取已创建容器列表,其中,上述已创建容器列表包括多个已创建容器,每个上述已创建容器具有对应的服务器节点、所属应用和所属分组;确定与每个上述服务器节点对应的创建数量信息,其中,上述创建数量信息包括属于同一应用的已创建容器的数量和属于同一分组的已创建容器的数量;以及,根据与每个上述服务器节点对应的创建数量信息对上述可用机架列表中的多个上述可用机架进行优先级排序。
根据本公开的实施例,上述对上述可用机架列表中的可用机架中的空余服务器节点进行定位,包括:将上述可用机架列表中的优先级最高的可用机架确定为当前机架;确定上述当前机架的空余服务器节点数量是否大于预设阈值;在上述当前机架的空余服务器节点数量大于上述预设阈值的情况下,对上述当前机架中的空余服务器节点进行定位;在上述当前机架的空余服务器节点数量小于或等于上述预设阈值的情况下,将上述可用机架列表中的下一优先级的可用机架确定为当前机架;以及,返回执行确定上述当前机架的空余服务器节点数量是否大于上述预设阈值的操作,直至对上述当前机架中的空余服务器节点进行定位。
根据本公开的实施例,上述根据上述可用机架列表中的可用机架的资源占用信息,对上述可用机架列表中的可用机架进行重新排序,包括:获取上述当前容器所属的应用和所属的分组;获取上述可用机架列表中的上述当前机架的上一资源占用信息;获取上述可用机架列表中的其他机架的上一资源占用信息;根据上述当前容器所属的应用、上述当前容器所属的分组和上述当前机架的上一资源占用信息,确定上述当前机架的当前资源占用信息;以及,根据上述可用机架列表中的上述当前机架的当前资源占用信息和上述可用机架列表中的其他机架的上一资源占用信息,对上述可用机架列表中的可用机架进行重新排序。
根据本公开的实施例,上述可用机架列表中的上述当前机架和其他机架的上一资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,其中,上述第一坑位数量为机架的总资源与全部创建的容器所使用资源的比值。
根据本公开的实施例,上述根据上述可用机架列表中的上述当前机架的当前资源占用信息和上述可用机架列表中的其他机架的上一资源占用信息,对上述可用机架列表中的可用机架进行重新排序,包括:根据预设机架优先级规则、上述可用机架列表中的上述当前机架的当前资源占用信息和上述可用机架列表中的其他机架的上一资源占用信息,对上述可用机架列表中的可用机架进行重新排序,其中,上述预设机架优先级规则,包括:属于同一应用下的容器数量越少的可用机架所对应的优先级越高;如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的可用机架所对应的优先级越高;以及,如果属于同一分组的 容器数量相同,则第一坑位数量越多的可用机架所对应的优先级越高。
根据本公开的实施例,该方法还包括:根据上述可用机架列表中的可用机架中的服务器节点的资源占用信息,对上述可用机架列表中的可用机架中的服务器节点进行重新排序;上述根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表创建其他容器,包括:根据重新排序后的可用机架列表中的可用机架和可用机架中的服务器节点,确定可用机架中的新的空余服务器节点;以及,根据上述新的空余服务器节点和更新后的可用网络地址列表创建其他容器。
根据本公开的实施例,上述可用机架列表中的可用机架中的服务器节点的资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第二坑位数量,其中,上述第二坑位数量为服务器节点的总资源与全部创建的容器所使用资源的比值。
根据本公开的实施例,所根据上述可用机架列表中的可用机架中的服务器节点的资源占用信息,对上述可用机架列表中的可用机架中的服务器节点进行重新排序,包括:根据预设服务器节点优先级规则和上述可用机架列表中的可用机架中的服务器节点的资源占用信息,对上述可用机架列表中的可用机架中的服务器节点进行重新排序,其中,上述预设服务器节点优先级规则,包括:属于同一应用下的容器数量越少的服务器节点所对应的优先级越高;如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的服务器节点所对应的优先级越高;以及,如果属于同一分组的容器数量相同,则第二坑位数量越多的服务器节点所对应的优先级越高。
本公开的另一方面提供了一种容器创建装置,该装置包括:获取模块,被配置用于获取可用机架列表和可用网络地址列表,其中,上述可用机架列表包括不同可用区的多个可用机架,每个上述可用机架中包括至少一个服务器节点,上述可用网络地址列表包括至少一个可用网络地址;定位模块,被配置用于对上述可用机架列表中的可用机架中的空余服务器节点进行定位;第一创建模块,被配置用于在上述空余服务器节点上,创建与上述可用网络地址对应的当前容器;更新模块,被配置用于更新上述可用网络地址列表;第一排序模块,被配置用于根据上述可用机架列表中的可用机架的资源占用信息,对上述可用机架列表中的可用机架进行重新排序;以及,第二创建模块,被配置用于根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
本公开的另一方面提供了一种电子设备,该电子设备包括:一个或多个处理器;存储器,被配置用于存储一个或多个程序,其中,当上述一个或多个程序被上述一个或多个处理器执行时,使得上述一个或多个处理器实现如上所述的方法。
本公开的另一方面提供了一种计算机可读存储介质,其上存储有可执行指令,该指令被 处理器执行时使处理器实现如上所述的方法。
本公开的另一方面提供了一种计算机程序,上述计算机程序包括计算机可执行指令,上述指令在被执行时被配置用于实现如上所述的方法。
附图说明
图1示意性示出了根据本公开实施例的一种服务树的示意图;
图2示意性示出了相关技术中的一种实例排布的示意图;
图3示意性示出了根据本公开实施例的可以应用容器创建方法的示例性系统架构;
图4示意性示出了根据本公开实施例的一种容器创建方法的流程图;
图5示意性示出了根据本公开的实施例的另一种容器创建方法的流程图;
图6示意性示出了根据本公开的实施例的一种计算资源流程的流程图;
图7示意性示出了根据本公开的实施例的一种容器创建方法的应用示意图;
图8示意性示出了根据本公开实施例的一种容器创建装置的框图;以及
图9示意性示出了根据本公开实施例的适于实现容器创建方法的电子设备的框图。
具体实施方式
以下,将参照附图来描述本公开的实施例。但是应该理解,这些描述只是示例性的,而并非要限制本公开的范围。在下面的详细描述中,为便于解释,阐述了许多具体的细节以提供对本公开实施例的全面理解。然而,明显地,一个或多个实施例在没有这些具体细节的情况下也可以被实施。此外,在以下说明中,省略了对公知结构和技术的描述,以避免不必要地混淆本公开的概念。
在此使用的术语仅仅是为了描述具体实施例,而并非意在限制本公开。在此使用的术语“包括”、“包含”等表明了所述特征、步骤、操作和/或部件的存在,但是并不排除存在或添加一个或多个其他特征、步骤、操作或部件。
在此使用的所有术语(包括技术和科学术语)具有本领域技术人员通常所理解的含义,除非另外定义。应注意,这里使用的术语应解释为具有与本说明书的上下文相一致的含义,而不应以理想化或过于刻板的方式来解释。
在使用类似于“A、B和C等中至少一个”这样的表述的情况下,一般来说应该按照本领域技术人员通常理解该表述的含义来予以解释(例如,“具有A、B和C中至少一个的系统”应包括但不限于单独具有A、单独具有B、单独具有C、具有A和B、具有A和C、具有B 和C、和/或具有A、B、C的系统等)。在使用类似于“A、B或C等中至少一个”这样的表述的情况下,一般来说应该按照本领域技术人员通常理解该表述的含义来予以解释(例如,“具有A、B或C中至少一个的系统”应包括但不限于单独具有A、单独具有B、单独具有C、具有A和B、具有A和C、具有B和C、和/或具有A、B、C的系统等)。
本公开实施例提供的技术方案可以用于针对专有云场景下K8S的容器排布问题。为了更好地理解本公开实施例的技术方案,首先对本公开实施例所涉及的基本概念进行说明。
专有云是云服务商可以为客户在其自己的数据中心内部署完整的云计算服务。专有云中资源全部由云服务商提供,但是数据不论在物理上还是网络上都是隔离的,仅能通过内网访问。
可用区可以是在同个地域下,电力和网络相互独立的数据中心。由于不同可用区的可用性是互不影响的,因此,客户业务系统的服务器节点可以通过跨可用区部署,这在很大程度上提高了可用性。
机架可以是包括多个服务器节点,并为多个服务器节点提供统一的供电和网络接入的一体式机柜。
服务器节点可以是物理服务器设备。
跨可用区可以是将多个容器分配到不同的可用区上。
跨机架可以是将多个容器分配到同一可用区的不同的机架上。
跨服务器节点可以是将多个容器分配到同一机架上的不同服务器节点上。
高可用可以是将一个系统中的多个容器进行均衡部署,当一个服务器节点由于故障不能正常运行时,能够确保没有故障的服务器节点上的容器可以正常运行,并对外提供服务,以保障系统的可用性。
集群可以是计算、存储和网络资源的集合。
产品线可以是专有云上的一款云平台产品,例如,云主机产品。
系统可以是产品线上的一个独立服务模块。产品线可以包括一个或多个系统。
应用可以是系统中的一个独立功能模块。系统可以包括一个或多个应用。
分组可以是解决应用中不同场景问题的独立模块。应用可以包括一个或多个分组。分组被配置用于管理容器运行需要的环境变量和外置配置,其是部署的最小单位。
Node节点可以是指集群中的工作节点,其上运行真正的应用程序。在Node节点上运行K8S的Kubelet和Proxy,Kubelet和Proxy被配置用于负责Pod的创建、启动、监控、重启、销毁和实现软件模式的负载均衡。Node节点可以包括Node地址、Node的运行状态、Node系统容量和其他信息。Node地址包括主机的网络地址或主机的标识。Node系统容量表示Node 节点可用的系统资源,可以包括CPU、内存和最大可调度Pod数量等。
Pod是可以在K8S中创建和管理的最小的可部署的工作单元。Pod可以包括一个或多个紧密相关的容器,例如,Docker容器,这些容器共享存储、网络和如何运行容器的声明。Pod中的容器会作为一个整体被Master节点调度到同一个Node节点上运行。Pod相当于逻辑主机,每个Pod具有对应的网络地址,属于同一Pod的不同容器共享相同的网络地址和端口空间。每个Pod的网络地址会随着Pod的销毁和重启而发生变化。
Service可以是一组提供相同服务的Pod的对外访问接口。Service具有网络地址和端口,Service为Pod提供了负载均衡。
Controller可以是用于管理Pod的。Controller中定义了Pod的部署特性,例如,包括几个副本、在什么样的Node节点上运行。K8S中运行Pod由Controller执行,访问Pod由Service执行。
Master节点可以是集群的主节点,被配置用于承载K8S的控制和管理整个集群的控制面板,其上运行着与集群管理相关的一组进程ETCD、API Server、Controller Manager和Scheduler。其中,API Server、Controller Manager和Scheduler组成了K8S的总控中心,这些进程实现了集群的资源管理、Pod调度、弹性伸缩、安全控制、系统监控和纠错等管理功能。
ETCD可以是高可用的分布式键值数据库,可以用于持久化存储集群中所有的资源对象。即主要用于存储集群的配置信息和各种资源的状态信息。当数据发生变化时,ETCD会快速地通知K8S的相关组件。
API(Application Programming Interface,应用程序编程接口)Server可以是K8S对外的唯一接口,全部请求需要通过这个接口进行通信。API Server提供了操作ETCD的封装接口,封装接口基本上是集群中资源对象的增删改查以及监听资源变化的接口。
Controller Manager可以是集群内部的管理控制中心,其主要被配置用于实现管理集群的各种资源,保证资源处于预期的状态。Controller Manager可以包括Replication Controller(RC)、Endpoints Controller、Namespace Controller和Serviceaccounts Controller等。其中,RC用于定义Pod、Pod需要运行的副本数量和需要监控的Pod标签。
Scheduler可以是集群中的调度器,其主要用于确定将Pod分配到哪个Node上运行。
Kubelet可以是用于负责Node节点上的Pod的创建、修改、监控和删除等全生命周期管理。同时,向Master节点报告Node节点的状态信息。
Proxy可以是用于实现Service的代理与软件模式的负载均衡器。Proxy可以是API Server的一个反向代理服务器。在K8S集群外部的客户端可以通过Proxy访问API Server。
实例可以是具有相同配置,并被配置用于支持分组功能的多个资源分配单位。多个容器 支持一个分组的高可用。
超售系数可以是云服务商将物理服务器上的物理核逻辑分为多个虚拟核,多个虚拟核共享同一物理核的功能,并采用按时间分片等方式实现对物理核的资源的使用。通过超售系数云服务商能够将资源分配给更多的租户,进而提高了资源利用率。
为了解决的容器排布问题,可以采用的解决方案为在K8S的Scheduler中增加过滤或者优选策略。在实现本公开构思的过程中,发现上述方案中至少存在着较难以实现容器的均衡排布的问题。
在实现本公开构思的过程中,发现存在上述问题的主要原因在于,上述解决方案没有考虑多可用区和多机架中的服务器节点的位置分布,而由于专有云所涉及的产品和服务众多,并且对服务高可用有非常严格的要求,因此,采用上述解决方案较难实现容器的均衡排布,这里所述的均衡排布是指同一应用下的容器在可用区、机架和服务器节点三个层面上的均衡排布,进而也就较难满足跨可用区、跨机架和服务器节点高可用的服务要求。
为了实现容器的均衡排布,以保证服务跨可用区、跨机架和服务器节点高可用,需要将同一应用下的不同容器优先分配到不同的可用区,将同一可用区上的容器优先分配到不同的机架上,将同一机架上的容器优先分配到不同的服务器节点上,基于上述,本公开实施例提供了一种实现容器均衡排布的方案。需要说明的是,由于在确定将容器分配到哪个服务器节点后,需要在对应的服务器节点创建容器,因此,实现容器的均衡创建即是实现容器的均衡排布。
为了更好地管理集群中的服务,本公开实施例采用高度为4的树形结构(即服务树)来存储完整的集群服务。图1示意性示出了根据本公开实施例的一种服务树的示意图。如图1所示,服务树可以包括由上至下的租户、应用程序、分组和实例。其中,最顶层的租户被配置用于管理整个集群中的配额信息。第二层的应用程序被配置用于管理部署模块和环境变量信息。第三层的分组被配置用于管理程序版本、配置版本、容器规格和环境变量,第四层的实例被配置用于管理容器和网络地址信息。服务树中的每个实例对应K8S中的一个Pod(即一组容器)。需要说明的是,本公开实施例中所述的实现容器的均衡排布即是实现实例的均衡排布。
图2示意性示出了相关技术中的一种实例排布的示意图。如图2所示,包括机架1、机架2和机架3,每个机架包括四个服务器节点。包括应用1、应用2和应用3。其中,应用2包括分组1、分组2和分组3。分组1包括实例1,分组2包括实例2,分组3包括实例3。采用相关技术将同属于应用2的实例1、实例2和实例3分别分配到机架1上的服务器节点、机架2上的服务器节点和机架2上的服务器节点。由此可见,采用相关技术将同属于应用2 的实例2和实例3分配到了同一机架,即采用相关技术没有实现容器的均衡排布。这是由于相关技术并不能够识别可用区和机架,因此,同一应用下的多个实例可能被分配到同一可用区或者同一机架上。而如果可用区的专线或者机架出现问题,则容易导致系统瘫痪而影响到服务的整体功能。本公开实施例所提供的技术方案即是用来解决上述问题。下面将结合具体实施例进行说明。
本公开的实施例提供了一种容器创建方法、装置、电子设备及存储介质。该方法包括容器创建过程。在容器创建过程中,获取可用机架列表和可用网络地址列表,对可用机架列表中的机架中的空余服务器节点进行定位,在空余服务器节点上,创建与可用网络地址对应的当前容器,更新可用网络地址列表,根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,并根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
图3示意性示出了根据本公开实施例的可以应用容器创建方法的示例性系统架构300。需要注意的是,图3所示仅为可以应用本公开实施例的系统架构的示例,以帮助本领域技术人员理解本公开的技术内容,但并不意味着本公开实施例不可以用于其他设备、系统、环境或场景。
如图3所示,根据该实施例的系统架构300可以包括智能排布系统、主节点(即Master节点)和工作节点(即Node节点)。其中,智能排布系统包括API网关、分布式键值数据库(即ETCD)、智能资源排布和资源调度。主节点包括主节点1、主节点2和主节点3。与主节点1对应的工作节点为工作节点1和工作节点2。每个主节点包括应用程序编程接口服务器(即API Server)、调度器(即Scheduler)、分布式键值数据库(即ETCD)和管理控制中心(即Controller Manager)。每个工作节点包括Kubelet、代理服务器(即Proxy)和Pod。每个Pod包括一个或多个容器。
现有的K8S架构包括图3中的主节点(即Master节点)和工作节点(即Node节点)。现有的基于K8S创建容器的流程如下:通过Kubectl生成RC请求信息,并将该RC请求信息通过API Server发送给ETCD,ETCD存储该RC请求信息,其中,RC请求信息包括待创建Pod、待创建Pod所对应的副本数量和待创建Pod的标签。
Controller Manager通过API Server中的监听资源变化接口监听到RC事件,则获取RC请求信息。如果确定当前集群中不存在待创建Pod,则根据RC请求信息创建Pod,并通过API Server发送给ETCD。ECTD存储Pod。
Scheduler通过API Server中的监听资源变化接口监听到RC事件,则执行调度流程,以生成分配关系,其中,分配关系为Pod与运行Pod的目标Node节点,并通过API Server将 分配关系发送给ETCD,ETCD存储分配关系。
在目标Node节点上运行的Kubelet通过API Server监测到Pod,则根据RC请求信息启动Pod,直至到达Pod的生命周期。
如图3所示,本公开实施例在现有的K8S架构上增加了智能排布系统。其中,智能排布系统中的API网关取代了K8S中的Master节点的API Server,作为整个集群的唯一入口。智能排布系统接管集群中容器的分配和部分调度工作。
由于本公开实施例中的智能排布系统能够独立实现,并且可以无侵入的加入到K8S中,因此,智能排布系统能够应用于各种K8S集群环境,而对原有系统没有影响。
本公开实施例所提供的容器创建方法一般可以由智能排布系统执行,智能排布系统可以设置于服务器或服务器集群中。相应地,本公开实施例所提供的容器创建装置一般可以设置于服务器或服务器集群中。
图4示意性示出了根据本公开实施例的一种容器创建方法的流程图。
如图4所示,该方法包括操作S410~S460。
在操作S410,获取可用机架列表和可用网络地址列表,其中,可用机架列表包括不同可用区的多个可用机架,每个可用机架中包括至少一个服务器节点,可用网络地址列表包括至少一个可用网络地址。
根据本公开的实施例,可用机架列表可以包括多个可用机架,不同可用机架可能属于不同的可用区,每个可用机架可以包括至少一个服务器节点。可用机架列表中的多个可用机架可以按照优先级排序。
示例性的,如可用机架列表包括可用机架1、可用机架2和可用机架3。其中,可用机架1和可用机架2属于可用区1,可用机架3属于可用区2。可用机架1上设置有服务器节点1、服务器节点2和服务器节点3。可用机架2上设置有服务器节点4和服务器节点5。可用机架3上设置有服务器节点6、服务器节点7和服务器节点8。
可用网络地址列表可以包括至少一个可用网络地址,其中,每个可用网络地址指可被配置用于设置Pod的网络地址但还未使用的网络地址。可用网络地址列表可以通过如下方式获得。
获取总网络地址列表。获取已分配网络地址列表。根据总网络地址列表和已分配网络地址列表,确定可用网络地址列表。其中,已分配网络地址列表包括至少一个已分配网络地址,每个已分配网络地址指已设置Pod的网络地址。总网络地址列表中的每个网络地址可以用于设置Pod。根据总网络地址列表和已分配网络地址列表,确定可用网络地址列表,可以包括,将总网络地址列表减去已分配网络地址列表,得到可用网络地址列表。
在操作S420,对可用机架列表中的可用机架中的空余服务器节点进行定位。
在操作S430,在空余服务器节点上,创建与可用网络地址对应的当前容器。
根据本公开的实施例,可用机架列表中的可用机架可能存在空余服务器节点,也可能不存在空余服务器节点。空余服务器节点可以指具有空余资源的服务器节点。空余资源可以理解为具有设置容器的资源。
为了在空余服务器节点上创建当前容器,需要确定可用机架列表中的可用机架是否存在空余服务器节点。如果存在空余服务器节点,则定位空余服务器节点。
由于可用机架列表中包括多个可用机架,因此,可以按照预设顺序依次确定每个可用机架是否存在空余服务器节点,直至确定出空余服务器节点。此外,由于可用机架列表中的多个可用机架可以按照优先级排序,因此,可以按照优先级由高到低的顺序依次确定每个可用机架是否存在空余服务器节点。
根据本公开的实施例,在确定空余服务器节点后,可以从可用网络地址列表中选择一个可用网络地址作为目标网络地址,在空余服务器节点上创建与目标网络地址对应的当前容器。在空余服务器节点上创建与目标网络地址对应的当前容器,可以包括,在空余服务器节点上创建与目标网络地址对应的当前Pod,在当前Pod中创建当前容器实例。
在操作S440,更新可用网络地址列表。
在本公开的实施例中,在空余服务器节点上,创建与可用网络地址对应的当前容器后,这里的可用网络地址可以指目标网络地址,由于在目标网络地址上创建了对应的当前容器,因此,目标网络地址由可用网络地址变成了已分配网络地址,相应的,可用网络地址列表中所包括的可用网络地址将发生变化,需要更新可用网络地址列表。
根据本公开的实施例,更新可用网络地址列表可以包括删除可用网络地址列表中目标网络地址,得到更新后的可用网络地址列表。
在操作S450,根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序。
根据本公开的实施例,可用机架的资源占用信息可以表示可用机架上设置的容器所占用的资源。可用机架的资源占用信息可以包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,其中,第一坑位数量可以为可用机架的总资源数量与全部创建的容器所使用资源数量的比值。
根据本公开的实施例,由于在空余服务器节点上,创建与可用网络地址对应的当前容器后,可用机架列表中的可用机架的资源占用信息便发生了变化,因此,需要对可用机架列表中的可用机架进行重新排序,以得到重新排序后的可用机架列表。
根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,可以包括,获取当前容器所属的应用和所属的分组。获取可用机架列表中的当前机架的上一资源占用信息和其他机架的上一资源占用信息。根据当前容器所属的应用、当前容器所属的分组和当前机架的上一资源占用信息,确定当前机架的当前资源占用信息。根据可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的机架进行重新排序。其中,当前机架可以指可用机架列表中的优先级最高的可用机架。
在操作S460,根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
根据本公开的实施例,每次创建一个容器后,便需要更新可用网络地址列表,以及,对可用机架列表中的机架进行重新排序,以进行下一容器的创建,直至完成全部容器的创建。由于是在对应的空余服务器节点上创建容器,因此,也相当于将各个容器分配到了对应的空余服务器节点上。
根据本公开的实施例,可以获取资源请求,其中,资源请求可以包括待创建容器数量。响应资源请求,获取当前可用机架列表和当前可用网络地址列表。对当前可用机架列表中的可用机架中的空余服务器节点进行定位。在空余服务器节点上,创建与当前可用网络地址对应的当前容器。更新当前可用网络地址列表,得到新的可用网络地址列表,并将新的网络地址列表作为当前可用网络地址列表。根据当前可用机架列表中的可用机架的资源占用信息,对当前可用机架列表中的可用机架进行重新排序,得到新的可用机架列表,并将新的可用机架列表作为当前可用机架列表。重复执行对当前可用机架列表中的可用机架中的空余服务器节点进行定位,在空余服务器节点上,创建与当前可用网络地址对应的当前容器,直至完成待创建容器数量的容器的创建。
根据本公开的实施例,资源请求还可以包括待创建容器规格、待创建容器所属的应用和待创建容器所属的分组。待创建容器规格可以指待创建容器所需要的CPU和内存。
根据本公开实施例的技术方案,通过获取可用机架列表和可用网络地址列表,可用机架列表包括不同可用区的多个可用机架,每个可用机架中包括至少一个服务器节点,可用网络地址列表包括至少一个可用网络地址,对可用机架列表中的可用机架中的空余服务器节点进行定位,在空余服务器节点上,创建与可用网络地址对应的当前容器,更新可用网络地址列表,根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,并根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。由于在空余服务器节点上,每创建一个容器后,便根据可 用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,再基于重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建下一个容器,其中,空余服务器节点来自不同可用区的可用机架,因此,实现了容器的均衡排布,因而,至少部分地克服了采用相关技术较难以实现容器的均衡排布的技术问题。此外,由于实现了容器的均衡排布,因此,满足了跨可用区、跨机架和服务器节点高可用的服务要求,进而有效避免了系统瘫痪情况的发生。
根据本公开的实施例,获取可用机架列表,可以包括如下操作。
获取每个机架中的每个服务器节点的总资源。获取每个服务器节点的已使用资源,其中,已使用资源为已创建容器所使用的资源。根据每个服务器节点的总资源和每个服务器节点的已使用资源,确定可用机架。根据可用机架生成可用机架列表。
根据本公开的实施例,每个服务器节点的总资源可以通过如下方式确定。获取服务器节点资源,其中,服务器节点资源包括CPU和内存。获取与服务器节点对应的超售系数。根据服务器节点资源和超售系数确定服务器节点的总资源,即可以为将服务器节点资源与超售系数相乘,得到服务器节点的总资源。
针对每个机架中的每个服务器节点,根据该服务器节点的总资源和该服务器节点的已使用资源,确定可用机架,可以包括,将该服务器节点的总资源与该服务器节点的已使用资源相减,得到该服务器节点的剩余资源。基于此,可以得到该机架上的各个服务器节点的剩余资源。根据该机架上的各个服务器节点的剩余资源,确定该机架是否为可用机架。如果该机架上的各个服务器节点的剩余资源大于等于剩余资源阈值,则可将该机架确定为可用机架。其中,剩余资源阈值可以根据实际情况确定,在此不作限定。
根据本公开的实施例,可用机架列表中的多个可用机架按照优先级进行排序。
根据本公开的实施例,为了实现容器的均衡排布,可以对可用机架列表中的多个可用机架按照优先级高低进行排序,以便后续可以按照可用机架的优先级选择空余服务器节点,并在空余服务器节点上创建容器。
根据本公开的实施例,通过如下方式实现可用机架列表中的多个可用机架按照优先级进行排序。获取已创建容器列表,其中,已创建容器列表包括多个已创建容器,每个已创建容器具有对应的服务器节点、所属应用和所属分组。确定与每个服务器节点对应的创建数量信息,其中,创建数量信息包括属于同一应用的已创建容器的数量和属于同一分组的已创建容器的数量。根据与每个服务器节点对应的创建数量信息对可用机架列表中的多个可用机架进行优先级排序。
根据本公开的实施例,为了实现对可用机架列表中多个可用机架进行优先级排序,可以 获取已创建容器列表,已创建容器列表可以包括多个已创建容器,已创建容器可以指已创建Pod。每个已创建容器具有对应的服务器节点是指每个已创建容器具有所属的服务器节点。同时,每个已创建容器具有所属应用和所属分组。
根据本公开的实施例,确定与每个服务器节点对应的创建数量信息,可以包括,针对每个已创建容器,将与该已创建容器对应的服务器节点上该已创建容器所属的应用的计数增加1和该已创建容器所属的分组的计数增加1。基于此,可以将各个已创建容器所属的应用和所属的分组关联到对应的服务器节点上。
根据本公开的实施例,针对每个服务器节点,确定与该服务器节点对应的创建数量信息,其中,每个创建数量信息可以包括属于同一应用的已创建容器的数量以及属于同一分组的已创建容器的数量。根据每个可用机架中包括的全部服务器节点的创建数量信息,可以确定该可用机架的创建数量信息,即该可用机架中属于同一应用的已创建容器的数量以及属于同一分组的已创建容器的数量。基于此,可以获得可用机架列表中各个可用机架的创建数量信息。
根据本公开的实施例,根据可用机架列表中各个可用机架的创建数量信息,对各个可用机架进行优先级排序,可以包括,根据预设机架优先级规则和可用机架列表中各个可用机架的创建数量信息,对可用机架列表中的各个可用机架进行优先级排序,其中,预设机架优先级规则,可以包括,属于同一应用下的容器数量越少的可用机架所对应的优先级越高。如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的可用机架所对应的优先级越高。如果属于同一分组的容器数量相同,则第一坑位数量越多的可用机架所对应的优先级越高。其中,第一坑位数量可以为可用机架的总资源与全部创建的容器所使用资源的比值。这里所述的容器数量指的是已创建容器数量。
示例性的,如已创建容器列表包括已创建容器1、已创建容器2和已创建容器3。可用机架列表包括可用机架1和可用机架2。可用机架1包括服务器节点1、服务器节点2和服务器节点3。可用机架2包括服务器节点4和服务器节点5。
已创建容器1对应的服务器节点为服务器节点1、所属应用为应用1和所属分组为分组1。
已创建容器2对应的服务器节点为服务器节点1、所属应用为应用1和所属分组为分组1。
已创建容器3对应的服务器节点为服务器节点4、所属应用为应用1和所属分组为分组2。
针对服务器节点1,确定与服务器节点1对应的创建数量信息。其中,创建数量信息包括属于应用1的已创建容器的数量为2,属于分组1的已创建容器的数量为2。
针对服务器节点2,确定与服务器节点2对应的创建数量信息。其中,创建数量信息为0。
针对服务器节点3,确定与服务器节点3对应的创建数量信息。其中,创建数量信息为0。
针对服务器节点4,确定与服务器节点4对应的创建数量信息。其中,创建数量信息包 括属于应用1的已创建容器的数量为1,属于分组2的已创建容器的数量为1。
针对服务器节点5,确定与服务器节点5对应的创建数量信息。其中,创建数量信息为0。
针对服务器节点6,确定与服务器节点6对应的创建数量信息。其中,创建数量信息为0。
根据服务器节点1、服务器节点2和服务器节点3的创建数量信息,确定可用机架1的创建数量信息包括属于应用1的已创建容器的数量为2,属于分组1的已创建容器的数量为2。
根据服务器节点4和服务器节点5,确定可用机架2的创建数量信息包括属于应用1的已创建容器的数量为1,属于分组2的已创建容器的数量为1。
根据预设机架优先级规则、可用机架1的创建数量信息和可用机架2的创建数量信息,对可用机架1和可用机架2进行优先级排序。由于可用机架1中属于同一应用1的数量大于可用机架1中属于同一应用1的数量,因此,可用机架2的优先级高于可用机架1的优先级。
根据本公开的实施例,通过对可用机架列表中的可用机架进行优先级排序,为容器在机架层面的均衡排布提供了基础。
根据本公开的实施例,对可用机架列表中的可用机架中的空余服务器节点进行定位,可以包括如下操作。
将可用机架列表中的优先级最高的可用机架确定为当前机架。确定当前机架的空余服务器节点数量是否大于预设阈值。在当前机架的空余服务器节点数量大于预设阈值的情况下,对当前机架中的空余服务器节点进行定位。在当前机架的空余服务器节点数量小于或等于预设阈值的情况下,将可用机架列表中的下一优先级的可用机架确定为当前机架。返回执行确定当前机架的空余服务器节点数量是否大于预设阈值的操作,直至对当前机架中的空余服务器节点进行定位。
在本公开的实施例中,由于可用机架列表中的多个可用机架是按照优先级排序的,因此,在确定空余服务器节点时,可以按照可用机架的优先级进行确定。
根据本公开的实施例,将可用机架列表中的优先级最高的可用机架确定为当前机架,确定当前机架中空余服务器节点数量是否大于预设阈值。如果当前机架中空余服务器节点数量大于预设阈值,则从当前机架中定位空余服务器节点。如果当前机架中空余服务器节点数量小于或等于预设阈值,则将可用机架列表中下一优先级的可用机架确定为当前机架,并执行当前机架中空余服务器节点数量是否大于预设阈值的操作,直至从当前机架中定位空余服务器节点。
根据本公开的实施例,可用机架列表中的每个可用机架所包括的多个服务器节点是按照优先级进行排序的。通过如下方式实现多个服务器节点按照优先级进行排序,即获取已创建容器列表,其中,已创建容器列表包括多个已创建容器,每个已创建容器具有对应的服务器 节点、所属应用和所属分组。确定与每个服务器节点对应的创建数量信息,其中,创建数量信息包括属于同一应用的已创建容器的数量和属于同一分组的已创建容器的数量。根据与每个服务器节点对应的创建数量信息对多个服务器节点进行优先级排序。
根据预设服务器节点优先级规则和与每个服务器节点对应的创建数量信息,对多个服务器节点进行优先级排序,其中,预设服务器节点优先级规则,可以包括,属于同一应用下的容器数量越少的服务器节点所对应的优先级越高。如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的服务器节点所对应的优先级越高。如果属于同一分组的容器数量相同,则第二坑位数量越多的服务器节点所对应的优先级越高。其中,第二坑位数量为服务器节点的总资源与全部创建的容器所使用资源的比值。这里的容器数量指的是已创建容器数量。
根据本公开的实施例,根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,可以包括如下操作。
获取当前容器所属的应用和所属的分组。获取可用机架列表中的当前机架的上一资源占用信息。获取可用机架列表中的其他机架的上一资源占用信息。根据当前容器所属的应用、当前容器所属的分组和当前机架的上一资源占用信息,确定当前机架的当前资源占用信息。根据可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的可用机架进行重新排序。
根据本公开的实施例,由于在当前机架上的空余服务器节点上创建当前容器后,当前机架的上一资源占用信息便发生了变化,因此,需要根据当前容器所属的应用和所属的分组,对当前机架的上一资源占用信息进行更新得到当前机架的当前资源占用信息。
为了实现对可用机架列表中的可用机架进行重新排序,还需要获取可用机架列表中除当前机架外的其他机架的上一资源占用信息。其他机架的数量为一个或多个。当前机架的上一资源占用信息和其他机架的上一资源占用信息均指在当前容器未创建前,当前机架和其他机架所对应的资源占用信息。
在获得当前机架的当前资源占用信息和其他机架的上一资源占用信息后,可以根据当前机架的当前资源占用信息和其他机架的上一资源占用信息对可用机架列表中的可用机架进行重新排序。
根据本公开的实施例,可用机架列表中的当前机架和其他机架的上一资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,其中,第一坑位数量为机架的总资源与全部创建的容器所使用资源的比值。
根据本公开的实施例,可用机架列表中的可用机架的资源占用信息包括属于同一应用的 容器数量、属于同一分组的容器数量和第一坑位数量。其中,可用机架包括当前机架和其他机架。资源占用信息包括当前机架的当前资源占用信息和其他机架的上一资源占用信息。第一坑位数量可以表征机架的资源信息。
根据本公开的实施例,根据可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的可用机架进行重新排序,可以包括如下操作。
根据预设机架优先级规则、可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的可用机架进行重新排序,其中,预设机架优先级规则,可以包括:属于同一应用下的容器数量越少的可用机架所对应的优先级越高。如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的可用机架所对应的优先级越高。如果属于同一分组的容器数量相同,则第一坑位数量越多的可用机架所对应的优先级越高。
根据本公开的实施例,为了实现容器在机架上的均衡排布,需要将同一可用区上的容器优先分配到不同的机架上。为了实现将同一可用区上的容器优先分配到不同的机架上,可以设置预设机架优先级规则。
由于当前机架的当前资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,其他机架的上一资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,因此,可以针对每个应用,按照属于同一应用下的容器数量越少的可用机架所对应的优先级越高。如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的可用机架所对应的优先级越高。如果属于同一分组的容器数量相同,则第一坑位数量越多的可用机架所对应的优先级越高的预设机架优先级规则对可用机架列表中的可用机架进行重新排序。其中,可用机架包括当前机架和其他机架。
根据本公开的实施例,通过对可用机架列表中的可用机架进行优先级排序,为容器在机架层面的均衡排布提供了基础。
根据本公开的实施例,上述容器创建方法还可以包括如下操作。
根据可用机架列表中的可用机架中的服务器节点的资源占用信息,对可用机架列表中的可用机架中的服务器节点进行重新排序。
根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表创建其他容器,可以包括如下操作。
根据重新排序后的可用机架列表中的可用机架和可用机架中的服务器节点,确定可用机架中的新的空余服务器节点。根据新的空余服务器节点和更新后的可用网络地址列表创建其 他容器。
根据本公开的实施例,可以获取当前容器所属的应用和所属的分组。获取可用机架列表中的服务器节点的上一资源占用信息。根据当前容器所属的应用和当前容器所属的分组对空余服务器节点的上一资源占用信息进行更新,得到空余服务器节点的当前资源占用信息。根据可用机架列表中的可用机架的空余服务器节点的当前资源占用信息和可用机架列表中的可用机架中除空余服务器节点外的其他服务器节点的上一资源占用信息,对可用机架列表中的可用机架中的服务器节点进行重新排序。
在获得重新排序后的可用机架列表中的可用机架和可用机架中的服务器节点后,可以根据上述确定可用机架中的新的空余服务器节点。
根据本公开的实施例,由于可用机架列表中的可用机架中的服务器节点可以按照优先级进行排序,因此,在定位空余服务器节点时,可以按照服务器节点的优先级进行定位。即将可用机架列表中的优先级最高的可用机架确定为当前机架。将当前机架中的优先级最高的服务器节点确定为当前服务器节点。确定当前服务器节点是否为空余服务器节点。如果当前服务器节点为空余服务器节点,则将当前服务器节点确定为空余服务器节点。如果当前服务器节点不为空余服务器节点,则将当前机架中的下一优先级对应的服务器节点确定为当前服务器节点,返回执行确定当前服务器节点是否为空余服务器节点的操作,直至对空余服务器节点进行定位。
如果在当前机架无法定位到空余服务器节点,则执行将可用机架列表中的下一优先级的可用机架确定为当前机架,返回执行将当前机架中的优先级最高的服务器节点确定为当前服务器节点的操作,直至对空余服务器节点进行定位。
根据本公开的实施例,可用机架列表中的可用机架中的服务器节点的资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第二坑位数量,其中,第二坑位数量为服务器节点的总资源与全部创建的容器所使用资源的比值。
根据本公开的实施例,第二坑位数量可以表征服务器节点的资源信息。
根据本公开的实施例,根据可用机架列表中的可用机架中的服务器节点的资源占用信息,对可用机架列表中的可用机架中的服务器节点进行重新排序,可以包括如下操作。
根据预设服务器节点优先级规则和可用机架列表中的可用机架中的服务器节点的资源占用信息,对可用机架列表中的可用机架中的服务器节点进行重新排序,其中,预设服务器节点优先级规则,可以包括:属于同一应用下的容器数量越少的服务器节点所对应的优先级越高。如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的服务器节点所对应的优先级越高。如果属于同一分组的容器数量相同,则第二坑位数量越多的服务器节点 所对应的优先级越高。
根据本公开的实施例,为了实现容器在服务器节点上的均衡排布,需要将同一机架上的容器优先分配到不同的服务器节点上。为了实现将同一机架上的容器优先分配到不同的服务器节点上,可以设置预设服务器优先级规则。
由于服务器节点的资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第二坑位数量,因此,可以针对每个应用,按照属于同一应用下的容器数量越少的服务器节点所对应的优先级越高。如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的服务器节点所对应的优先级越高。如果属于同一分组的容器数量相同,则第二坑位数量越多的服务器节点所对应的优先级越高的预设服务器节点优先级规则对可用机架列表中的可用机架中的服务器节点进行重新排序。
根据本公开的实施例,通过对可用机架列表中的可用机架中的服务器节点进行优先级排序,为容器在服务器节点层面的均衡排布提供了基础。
图5示意性示出了根据本公开的实施例的另一种容器创建方法的流程图。
如图5所示,该方法包括操作S501~S530。
在操作S501,获取资源请求,其中,资源请求包括待创建容器数量。
在操作S502,响应资源请求,获取每个机架中的每个服务器节点的总资源。
在操作S503,获取每个服务器节点的已使用资源,其中,已使用资源为已创建容器所使用的资源。
在操作S504,根据每个服务器节点的总资源和每个服务器节点的已使用资源,确定可用机架。
在操作S505,根据可用机架生成可用机架列表。
在操作S506,获取已创建容器列表,其中,已创建容器列表包括多个已创建容器,每个已创建容器具有对应的服务器节点、所属应用和所属分组。
在操作S507,确定与每个服务器节点对应的创建数量信息,其中,创建数量信息包括属于同一应用的已创建容器的数量和属于同一分组的已创建容器的数量。
在操作S508,根据预设服务器节点优先级规则和与每个服务器节点对应的创建数量信息,对可用机架列表中的可用机架中的多个服务器节点进行优先级排序。
在操作S509,根据每个可用机架中包括的全部服务器节点的创建数量信息,确定每个可用机架的创建数量信息。
在操作S510,根据预设机架优先级规则和可用机架列表中多个可用机架的创建数量信息,对可用机架列表中的多个可用机架进行优先级排序。
在操作S511,响应资源请求,获取可用网络地址列表,其中,可用网络地址列表包括至少一个可用网络地址。
在操作S512,将可用机架列表中的优先级最高的可用机架确定为当前机架。
在操作S513,当前机架的空余服务器节点数量是否大于预设阈值;若是,则执行操作S514;若否,则执行操作S515。
在操作S514,按照当前机架中的多个服务节点的优先级确定当前机架中的空余服务器节点,并执行操作S516。
在操作S515,可用机架列表中是否存在下一优先级的可用机架;若是,则执行操作S518;若否,则执行操作S519。
在操作S516,从可用网络地址列表中选择一个可用网络地址作为目标网络地址。
在操作S517,在空余服务器节点上,创建与目标网络地址对应的当前容器,并执行操作S520。
在操作S518,将可用机架列表中的下一优先级的可用机架确定为当前机架,并返回执行操作S513。
在操作S519,生成分配异常信息。
在操作S520,更新可用网络地址列表。
在操作S521,获取当前容器所属的应用和所属的分组。
在操作S522,获取可用机架列表中的当前机架的上一资源占用信息。
在操作S523,获取可用机架列表中的其他机架的上一资源占用信息。
在操作S524,根据当前容器所属的应用、当前容器所属的分组和当前机架的上一资源占用信息,确定当前机架的当前资源占用信息。
在操作S525,根据预设机架优先级规则、可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的可用机架进行重新排序。
在操作S526,根据预设服务器节点优先级规则和可用机架列表中的可用机架中的服务器节点的资源占用信息,对可用机架列表中的可用机架中的服务器节点进行重新排序。
在操作S527,已创建容器数量是否等于待创建容器数量;若否,则执行操作S528;若是,则执行操作S529。
在操作S528,根据重新排序后的可用机架列表中的可用机架和可用机架中的服务器节点,确定可用机架中的新的空余服务器节点,并执行操作S530。
在操作S529,结束创建容器操作。
在操作S530,根据新的空余服务器节点和更新后的可用网络地址列表创建下一容器,将下一容器作为当前容器,并返回执行操作S520。
根据本公开的实施例,本公开实施例基于K8S容器创建方法的实质即是根据部署环境的可用区、机架和服务器节点的落位信息和图1中的服务树中的集群服务信息,将同一应用下的不同容器(即服务树中的实例)按照调度策略分配到对应的服务器节点中,以实现容器的均衡排布。由于在确定将容器分配到哪个服务器节点后,需要在对应的服务器节点创建容器,因此,实现容器的均衡创建即是实现容器的均衡排布。
根据本公开的实施例,调度策略即是:1、针对多可用区场景,将同一应用下的不同容器优先分配到不同的可用区。2、在保证1的前提下,针对可用区包括多个机架且可用区上分配了多个同一应用下的容器,将同一可用区上的容器优先分配到不同的机架上。在保证2的前提下,针对机架包括多个服务器节点且机架上分配了多个同应用下的容器,将同一机架上的容器优先分配到不同的服务器节点上。通过上述调度策略实现同一应用下的容器在可用区、机架和服务器节点三个层面上的均衡排布。
图6示意性示出了根据本公开的实施例的一种计算资源流程的流程图。图6给出了可用机架列表的生成过程,其是对操作S502~S510的说明。
图6中K8S master即是前文所述的Master节点(即主节点)。node列表是指服务器节点列表。Node资源即是前文所述的服务器节点资源。Pod所在应用==待分配资源的应用是指如果Pod所在的应用即是待分配资源的应用,则同应用Pod计数增加1。也即针对每个已创建容器,将与该已创建容器对应的服务器节点上该已创建容器所属的应用的计数增加1。Pod所在分组==待分配资源的分组是指如果Pod所在的分组即是待分配资源的分组,则同分组Pod计数增加1。也即针对每个已创建容器,将与该已创建容器对应的服务器节点上该已创建容器所属的分组的计数增加1。
当全部Pod列表都遍历完成后,将服务器节点列表按服务器节点所在的机架情况统计出机架的资源情况,生成可用机架列表。此外,针对机架按照操作S510中的预设机架优先级规则进行优先级排序。针对机架中的服务器节点按照操作S508中的预设服务器节点优先级规则进行优先级排序。
此外,计算node坑位数量和总坑位数量,将总坑位数量与响应资源请求计算出的待分配数量比较,确定是否可以响应资源请求。即如果总坑位数量大于或等于待分配数量,则返回可用机架列表和已分配网络地址列表。如果总坑位数量小于待分配数量,则生成分配异常信息。
需要说明的是,每次创建容器后,便需要对可用机架列表中的可用机架进行重新排序, 以及,将可用机架列表中的可用机架中的服务器节点进行重新排序。
图7示意性示出了根据本公开的实施例的一种容器创建方法的应用示意图。图7中系统应用包括5层,分别为产品线、系统、应用、分组和实例。现需要将同一应用下的待创建实例1、待创建实例2和待创建实例2在对应的服务器节点上创建。
针对待创建实例1,由于可用区1和可用区2还没有被调度应用下的实例,因此,可以随机选择可用区。现选择可用区1,并根据操作S501和S530,在可用区1中的机架1中的服务器节点1上创建待创建实例1。
针对待创建实例2,由于同应用下的待创建实例1已经设置在可用区1上,因此,为了确保均衡排布,选择可用区2,并根据操作S501和S530,在可用区2中的机架3中的服务器节点5上创建待创建实例2。
针对待创建实例3,在可用区1中的机架2中的服务器节点3上创建待创建实例3。
上述实现了实例(即容器)在可用区、机架和服务器节点三个层面上的均衡排布。由于实现了容器的均衡排布,因此,即使可用区1或可用区2出现故障,如大面积停电,则采用本公开实施例的技术方案仍然能够确保有实例能够运行。
根据本公开实施例的技术方案,由于可用机架列表包括不同可用区的可用机架,且,可用机架列表中的可用机架和可用机架中的服务器节点均是按照优先级进行排序的,因此,定位出的空余服务器节点是满足容器均衡排布要求的服务器节点,在此基础上,便实现了容器在可用区、机架和服务器节点三个层面的均衡创建,也即实现了容器在可用区、机架和服务器节点三个层面的均衡排布,因而,至少部分地克服了采用相关技术较难以实现容器的均衡排布的技术问题。此外,由于实现了容器的均衡排布,因此,满足了跨可用区、跨机架和服务器节点高可用的服务要求,进而有效避免了系统瘫痪情况的发生。
图8示意性示出了根据本公开的实施例的一种容器创建装置的框图。
如图8所示,容器创建装置800包括获取模块810、定位模块820、第一创建模块830、更新模块840、第一排序模块850和第二创建模块860。
获取模块810,被配置用于获取可用机架列表和可用网络地址列表,其中,可用机架列表包括不同可用区的多个可用机架,每个可用机架中包括至少一个服务器节点,可用网络地址列表包括至少一个可用网络地址。
定位模块820,被配置用于对可用机架列表中的可用机架中的空余服务器节点进行定位。
第一创建模块830,被配置用于在空余服务器节点上,创建与可用网络地址对应的当前容器。
更新模块840,被配置用于更新可用网络地址列表。
第一排序模块850,被配置用于根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序。
第二创建模块860,被配置用于根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
根据本公开实施例的技术方案,通过获取可用机架列表和可用网络地址列表,可用机架列表包括不同可用区的多个可用机架,每个可用机架中包括至少一个服务器节点,可用网络地址列表包括至少一个可用网络地址,对可用机架列表中的可用机架中的空余服务器节点进行定位,在空余服务器节点上,创建与可用网络地址对应的当前容器,更新可用网络地址列表,根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,并根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。由于在空余服务器节点上,每创建一个容器后,便根据可用机架列表中的可用机架的资源占用信息,对可用机架列表中的可用机架进行重新排序,再基于重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建下一个容器,其中,空余服务器节点来自不同可用区的可用机架,因此,实现了容器的均衡排布,因而,至少部分地克服了采用相关技术较难以实现容器的均衡排布的技术问题。此外,由于实现了容器的均衡排布,因此,满足了跨可用区、跨机架和服务器节点高可用的服务要求,进而有效避免了系统瘫痪情况的发生。
根据本公开的实施例,获取可用机架列表,可以包括:获取每个机架中的每个服务器节点的总资源。获取每个服务器节点的已使用资源,其中,已使用资源为已创建容器所使用的资源。根据每个服务器节点的总资源和每个服务器节点的已使用资源,确定可用机架。根据可用机架生成可用机架列表。
根据本公开的实施例,可用机架列表中的多个可用机架按照优先级进行排序。
根据本公开的实施例,通过如下方式实现可用机架列表中的多个可用机架按照优先级进行排序:获取已创建容器列表,其中,已创建容器列表包括多个已创建容器,每个已创建容器具有对应的服务器节点、所属应用和所属分组。确定与每个服务器节点对应的创建数量信息,其中,创建数量信息包括属于同一应用的已创建容器的数量和属于同一分组的已创建容器的数量。根据与每个服务器节点对应的创建数量信息对可用机架列表中的多个可用机架进行优先级排序。
根据本公开的实施例,定位模块820可以包括第一确定子模块、第二确定子模块、第一定位子模块、第二定位子模块和返回子模块。
第一确定子模块,被配置用于将可用机架列表中的优先级最高的可用机架确定为当前机 架。
第二确定子模块,被配置用于确定当前机架的空余服务器节点数量是否大于预设阈值。
第一定位子模块,被配置用于在当前机架的空余服务器节点数量大于预设阈值的情况下,对当前机架中的空余服务器节点进行定位。
第二定位子模块,被配置用于在当前机架的空余服务器节点数量小于或等于预设阈值的情况下,将可用机架列表中的下一优先级的可用机架确定为当前机架。
返回子模块,被配置用于返回执行确定当前机架的空余服务器节点数量是否大于预设阈值的操作,直至对当前机架中的空余服务器节点进行定位。
根据本公开的实施例,第一排序模块840可以包括第一获取子模块、第二获取子模块、第三获取子模块和排序子模块。
第一获取子模块,被配置用于获取当前容器所属的应用和所属的分组。
第二获取子模块,被配置用于获取可用机架列表中的当前机架的上一资源占用信息。
第三获取子模块,被配置用于获取可用机架列表中的其他机架的上一资源占用信息。
第三确定子模块,被配置用于根据当前容器所属的应用、当前容器所属的分组和当前机架的上一资源占用信息,确定当前机架的当前资源占用信息。
第一排序子模块,被配置用于根据可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的可用机架进行重新排序。
根据本公开的实施例,可用机架列表中的当前机架和其他机架的上一资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,其中,第一坑位数量为机架的总资源与全部创建的容器所使用资源的比值。
根据本公开的实施例,第一排序子模块可以包括排序单元。
排序单元,被配置用于根据预设机架优先级规则、可用机架列表中的当前机架的当前资源占用信息和可用机架列表中的其他机架的上一资源占用信息,对可用机架列表中的可用机架进行重新排序,其中,预设机架优先级规则,包括:
属于同一应用下的容器数量越少的可用机架所对应的优先级越高。
如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的可用机架所对应的优先级越高。
如果属于同一分组的容器数量相同,则第一坑位数量越多的可用机架所对应的优先级越高。
根据本公开的实施例,该容器创建装置800还可以包括第二排序模块。
第二排序模块,被配置用于根据可用机架列表中的可用机架中的服务器节点的资源占用 信息,对可用机架列表中的可用机架中的服务器节点进行重新排序。
第二创建模块850可以包括第四确定子模块和创建子模块。
第四确定子模块,被配置用于根据重新排序后的可用机架列表中的可用机架和可用机架中的服务器节点,确定可用机架中的新的空余服务器节点。
创建子模块,被配置用于根据新的空余服务器节点和更新后的可用网络地址列表创建其他容器。
根据本公开的实施例,可用机架列表中的可用机架中的服务器节点的资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第二坑位数量,其中,第二坑位数量为服务器节点的总资源与全部创建的容器所使用资源的比值。
根据本公开的实施例,第二排序模块可以包括第二排序子模块。
第二排序子模块,被配置用于根据预设服务器节点优先级规则和可用机架列表中的可用机架中的服务器节点的资源占用信息,对可用机架列表中的可用机架中的服务器节点进行重新排序,其中,预设服务器节点优先级规则,包括:
属于同一应用下的容器数量越少的服务器节点所对应的优先级越高。
如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的服务器节点所对应的优先级越高。
如果属于同一分组的容器数量相同,则第二坑位数量越多的服务器节点所对应的优先级越高。
根据本公开的实施例的模块、子模块、单元中的任意多个、或其中任意多个的至少部分功能可以在一个模块中实现。根据本公开实施例的模块、子模块、单元中的任意一个或多个可以被拆分成多个模块来实现。根据本公开实施例的模块、子模块、单元中的任意一个或多个可以至少被部分地实现为硬件电路,例如现场可编程门阵列(Field Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Arrays,PLA)、片上系统、基板上的系统、封装上的系统、专用集成电路(Application Specific Integrated Circuit,ASIC),或可以通过对电路进行集成或封装的任何其他的合理方式的硬件或固件来实现,或以软件、硬件以及固件三种实现方式中任意一种或以其中任意几种的适当组合来实现。或者,根据本公开实施例的模块、子模块、单元中的一个或多个可以至少被部分地实现为计算机程序模块,当该计算机程序模块被运行时,可以执行相应的功能。
例如,获取模块810、定位模块820、第一创建模块830、更新模块840、第一排序模块850和第二创建模块860中的任意多个可以合并在一个模块/子模块/单元中实现,或者其中的任意一个模块/子模块/单元可以被拆分成多个模块/子模块/单元。或者,这些模块/子模块/单 元中的一个或多个模块/子模块/单元的至少部分功能可以与其他模块/子模块/单元的至少部分功能相结合,并在一个模块/子模块/单元中实现。根据本公开的实施例,获取模块810、定位模块820、第一创建模块830、更新模块840、第一排序模块850和第二创建模块860中的至少一个可以至少被部分地实现为硬件电路,例如现场可编程门阵列(FPGA)、可编程逻辑阵列(PLA)、片上系统、基板上的系统、封装上的系统、专用集成电路(ASIC),或可以通过对电路进行集成或封装的任何其他的合理方式等硬件或固件来实现,或以软件、硬件以及固件三种实现方式中任意一种或以其中任意几种的适当组合来实现。或者,获取模块810、定位模块820、第一创建模块830、更新模块840、第一排序模块850和第二创建模块860中的至少一个可以至少被部分地实现为计算机程序模块,当该计算机程序模块被运行时,可以执行相应的功能。
需要说明的是,本公开的实施例中容器创建装置部分与本公开的实施例中容器创建方法部分是相对应的,容器创建装置部分的描述具体参考容器创建方法部分,在此不再赘述。
图9示意性示出了根据本公开实施例的适于实现上文描述的方法的电子设备的框图。图9示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图9所示,根据本公开实施例的电子设备900包括处理器901,其可以根据存储在只读存储器(Read-Only Memory,ROM)902中的程序或者从存储部分908加载到随机访问存储器(Random Access Memory,RAM)903中的程序而执行各种适当的动作和处理。处理器901例如可以包括通用微处理器(例如CPU)、指令集处理器和/或相关芯片组和/或专用微处理器(例如,专用集成电路(ASIC)),等等。处理器901还可以包括用于缓存用途的板载存储器。处理器901可以包括被配置用于执行根据本公开实施例的方法流程的不同动作的单一处理单元或者是多个处理单元。
在RAM 903中,存储有系统900操作所需的各种程序和数据。处理器901、ROM 902以及RAM 903通过总线904彼此相连。处理器901通过执行ROM 902和/或RAM 903中的程序来执行根据本公开实施例的方法流程的各种操作。需要注意,所述程序也可以存储在除ROM 902和RAM 903以外的一个或多个存储器中。处理器901也可以通过执行存储在所述一个或多个存储器中的程序来执行根据本公开实施例的方法流程的各种操作。
根据本公开的实施例,电子设备900还可以包括输入/输出(I/O)接口905,输入/输出(I/O)接口905也连接至总线904。系统900还可以包括连接至I/O接口905的以下部件中的一项或多项:包括键盘、鼠标等的输入部分906;包括诸如阴极射线管(CRT)、液晶显示器(Liquid Crystal Display,LCD)等以及扬声器等的输出部分907;包括硬盘等的存储部分908;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分909。通信部分909经由诸如因特 网的网络执行通信处理。驱动器910也根据需要连接至I/0接口905。可拆卸介质911,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器910上,以便于从其上读出的计算机程序根据需要被安装入存储部分908。
根据本公开的实施例,根据本公开实施例的方法流程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读存储介质上的计算机程序,该计算机程序包含被配置用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分909从网络上被下载和安装,和/或从可拆卸介质911被安装。在该计算机程序被处理器901执行时,执行本公开实施例的系统中限定的上述功能。根据本公开的实施例,上文描述的系统、设备、装置、模块、单元等可以通过计算机程序模块来实现。
本公开还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例中描述的设备/装置/系统中所包含的;也可以是单独存在,而未装配入该设备/装置/系统中。上述计算机可读存储介质承载有一个或者多个程序,当上述一个或者多个程序被执行时,实现根据本公开实施例的方法。
根据本公开的实施例,计算机可读存储介质可以是非易失性的计算机可读存储介质。例如可以包括但不限于:便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM(Erasable Programmable Read Only Memory)或闪存)、便携式紧凑磁盘只读存储器(Computer Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
例如,根据本公开的实施例,计算机可读存储介质可以包括上文描述的ROM 902和/或RAM 903和/或ROM 902和RAM 903以外的一个或多个存储器。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。 本领域技术人员可以理解,本公开的各个实施例和/或权利要求中记载的特征可以进行多种组合和/或结合,即使这样的组合或结合没有明确记载于本公开中。特别地,在不脱离本公开精神和教导的情况下,本公开的各个实施例和/或权利要求中记载的特征可以进行多种组合和/或结合。所有这些组合和/或结合均落入本公开的范围。
以上对本公开的实施例进行了描述。但是,这些实施例仅仅是为了说明的目的,而并非为了限制本公开的范围。尽管在以上分别描述了各实施例,但是这并不意味着各个实施例中的措施不能有利地结合使用。本公开的范围由所附权利要求及其等同物限定。不脱离本公开的范围,本领域技术人员可以做出多种替代和修改,这些替代和修改都应落在本公开的范围之内。

Claims (14)

  1. 一种容器创建方法,包括:
    获取可用机架列表和可用网络地址列表,其中,所述可用机架列表包括不同可用区的多个可用机架,每个所述可用机架中包括至少一个服务器节点,所述可用网络地址列表包括至少一个可用网络地址;
    对所述可用机架列表中的可用机架中的空余服务器节点进行定位;
    在所述空余服务器节点上,创建与所述可用网络地址对应的当前容器;
    更新所述可用网络地址列表;
    根据所述可用机架列表中的可用机架的资源占用信息,对所述可用机架列表中的可用机架进行重新排序;以及
    根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
  2. 根据权利要求1所述的方法,其中,所述获取可用机架列表,包括:
    获取每个机架中的每个服务器节点的总资源;
    获取每个所述服务器节点的已使用资源,其中,所述已使用资源为已创建容器所使用的资源;
    根据每个所述服务器节点的总资源和每个所述服务器节点的已使用资源,确定可用机架;以及
    根据所述可用机架生成所述可用机架列表。
  3. 根据权利要求2所述的方法,其中,所述可用机架列表中的多个所述可用机架按照优先级进行排序。
  4. 根据权利要求3所述的方法,其中,通过如下方式实现所述可用机架列表中的多个所述可用机架按照优先级进行排序:
    获取已创建容器列表,其中,所述已创建容器列表包括多个已创建容器,每个所述已创建容器具有对应的服务器节点、所属应用和所属分组;
    确定与每个所述服务器节点对应的创建数量信息,其中,所述创建数量信息包括属于同一应用的已创建容器的数量和属于同一分组的已创建容器的数量;以及
    根据与每个所述服务器节点对应的创建数量信息对所述可用机架列表中的多个所述可用机架进行优先级排序。
  5. 根据权利要求3所述的方法,其中,所述对所述可用机架列表中的可用机架中的空余 服务器节点进行定位,包括:
    将所述可用机架列表中的优先级最高的可用机架确定为当前机架;
    确定所述当前机架的空余服务器节点数量是否大于预设阈值;
    在所述当前机架的空余服务器节点数量大于所述预设阈值的情况下,对所述当前机架中的空余服务器节点进行定位;
    在所述当前机架的空余服务器节点数量小于或等于所述预设阈值的情况下,将所述可用机架列表中的下一优先级的可用机架确定为当前机架;以及
    返回执行确定所述当前机架的空余服务器节点数量是否大于所述预设阈值的操作,直至对所述当前机架中的空余服务器节点进行定位。
  6. 根据权利要求5所述的方法,其中,所述根据所述可用机架列表中的可用机架的资源占用信息,对所述可用机架列表中的可用机架进行重新排序,包括:
    获取所述当前容器所属的应用和所属的分组;
    获取所述可用机架列表中的所述当前机架的上一资源占用信息;
    获取所述可用机架列表中的其他机架的上一资源占用信息;
    根据所述当前容器所属的应用、所述当前容器所属的分组和所述当前机架的上一资源占用信息,确定所述当前机架的当前资源占用信息;以及
    根据所述可用机架列表中的所述当前机架的当前资源占用信息和所述可用机架列表中的其他机架的上一资源占用信息,对所述可用机架列表中的可用机架进行重新排序。
  7. 根据权利要求6所述的方法,其中,所述可用机架列表中的所述当前机架和其他机架的上一资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第一坑位数量,其中,所述第一坑位数量为机架的总资源与全部创建的容器所使用资源的比值。
  8. 根据权利要求7所述的方法,其中,所述根据所述可用机架列表中的所述当前机架的当前资源占用信息和所述可用机架列表中的其他机架的上一资源占用信息,对所述可用机架列表中的可用机架进行重新排序,包括:
    根据预设机架优先级规则、所述可用机架列表中的所述当前机架的当前资源占用信息和所述可用机架列表中的其他机架的上一资源占用信息,对所述可用机架列表中的可用机架进行重新排序,其中,所述预设机架优先级规则,包括:
    属于同一应用下的容器数量越少的可用机架所对应的优先级越高;
    如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的可用机架所对应的优先级越高;以及
    如果属于同一分组的容器数量相同,则第一坑位数量越多的可用机架所对应的优先级越 高。
  9. 根据权利要求1所述的方法,还包括:
    根据所述可用机架列表中的可用机架中的服务器节点的资源占用信息,对所述可用机架列表中的可用机架中的服务器节点进行重新排序;
    所述根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表创建其他容器,包括:
    根据重新排序后的可用机架列表中的可用机架和可用机架中的服务器节点,确定可用机架中的新的空余服务器节点;以及
    根据所述新的空余服务器节点和更新后的可用网络地址列表创建其他容器。
  10. 根据权利要求9所述的方法,其中,所述可用机架列表中的可用机架中的服务器节点的资源占用信息包括属于同一应用的容器数量、属于同一分组的容器数量和第二坑位数量,其中,所述第二坑位数量为服务器节点的总资源与全部创建的容器所使用资源的比值。
  11. 根据权利要求10所述的方法,其中,所根据所述可用机架列表中的可用机架中的服务器节点的资源占用信息,对所述可用机架列表中的可用机架中的服务器节点进行重新排序,包括:
    根据预设服务器节点优先级规则和所述可用机架列表中的可用机架中的服务器节点的资源占用信息,对所述可用机架列表中的可用机架中的服务器节点进行重新排序,其中,所述预设服务器节点优先级规则,包括:
    属于同一应用下的容器数量越少的服务器节点所对应的优先级越高;
    如果属于同一应用下的容器数量相同,则属于同一分组的容器数量越少的服务器节点所对应的优先级越高;以及
    如果属于同一分组的容器数量相同,则第二坑位数量越多的服务器节点所对应的优先级越高。
  12. 一种容器创建装置,包括:
    获取模块,被配置用于获取可用机架列表和可用网络地址列表,其中,所述可用机架列表包括不同可用区的多个可用机架,每个所述可用机架中包括至少一个服务器节点,所述可用网络地址列表包括至少一个可用网络地址;
    定位模块,被配置用于对所述可用机架列表中的可用机架中的空余服务器节点进行定位;
    第一创建模块,被配置用于在所述空余服务器节点上,创建与所述可用网络地址对应的当前容器;
    更新模块,被配置用于更新所述可用网络地址列表;
    第一排序模块,被配置用于根据所述可用机架列表中的可用机架的资源占用信息,对所述可用机架列表中的可用机架进行重新排序;以及
    第二创建模块,被配置用于根据重新排序后的可用机架列表中的可用机架中的空余服务器节点和更新后的可用网络地址列表,创建其他容器。
  13. 一种电子设备,包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序,
    其中,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现权利要求1~11中任一项所述的方法。
  14. 一种计算机可读存储介质,其上存储有可执行指令,该指令被处理器执行时使处理器实现权利要求1~11中任一项所述的方法。
PCT/CN2021/115374 2020-08-31 2021-08-30 容器创建方法、装置、电子设备及存储介质 WO2022042724A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP21860556.6A EP4206915A4 (en) 2020-08-31 2021-08-30 METHOD AND DEVICE FOR PRODUCING CONTAINERS, ELECTRONIC DEVICE AND STORAGE MEDIUM
JP2023511608A JP7549132B2 (ja) 2020-08-31 2021-08-30 コンテナ作成方法、装置、電子機器、記憶媒体及びコンピュータプログラム
US18/041,689 US20230315531A1 (en) 2020-08-31 2021-08-30 Method of creating container, electronic device and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010900719.6A CN113760441A (zh) 2020-08-31 2020-08-31 容器创建方法、装置、电子设备及存储介质
CN202010900719.6 2020-08-31

Publications (1)

Publication Number Publication Date
WO2022042724A1 true WO2022042724A1 (zh) 2022-03-03

Family

ID=78785767

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/115374 WO2022042724A1 (zh) 2020-08-31 2021-08-30 容器创建方法、装置、电子设备及存储介质

Country Status (5)

Country Link
US (1) US20230315531A1 (zh)
EP (1) EP4206915A4 (zh)
JP (1) JP7549132B2 (zh)
CN (1) CN113760441A (zh)
WO (1) WO2022042724A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086334A (zh) * 2022-06-15 2022-09-20 北京奇艺世纪科技有限公司 一种服务器标记方法及相关装置

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230224223A1 (en) * 2022-01-12 2023-07-13 Oracle International Corporation Publishing physical topology network locality for general workloads

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105991478A (zh) * 2015-02-05 2016-10-05 阿里巴巴集团控股有限公司 服务器资源分配方法及其系统
US20180276031A1 (en) * 2015-09-15 2018-09-27 Alibaba Group Holding Limited Task allocation method and system
CN109885377A (zh) * 2018-11-23 2019-06-14 中国银联股份有限公司 统一资源调度协调器及其创建虚拟机和/或容器的方法、统一资源调度系统
CN110278288A (zh) * 2019-05-17 2019-09-24 平安科技(深圳)有限公司 预分配容器ip的方法、装置、计算机设备及存储介质
CN110515693A (zh) * 2019-07-26 2019-11-29 浪潮电子信息产业股份有限公司 一种基于机架感知的虚拟机横向扩展的方法和系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017152178A1 (en) * 2016-03-04 2017-09-08 Bladelogic, Inc. Provisioning of containers for virtualized applications
JP6962180B2 (ja) 2017-12-27 2021-11-05 富士通株式会社 情報処理システム、コンテナ管理装置及びコンテナ管理方法
CN110362398B (zh) 2018-04-09 2023-09-12 阿里巴巴集团控股有限公司 虚拟机的调度方法和系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105991478A (zh) * 2015-02-05 2016-10-05 阿里巴巴集团控股有限公司 服务器资源分配方法及其系统
US20180276031A1 (en) * 2015-09-15 2018-09-27 Alibaba Group Holding Limited Task allocation method and system
CN109885377A (zh) * 2018-11-23 2019-06-14 中国银联股份有限公司 统一资源调度协调器及其创建虚拟机和/或容器的方法、统一资源调度系统
CN110278288A (zh) * 2019-05-17 2019-09-24 平安科技(深圳)有限公司 预分配容器ip的方法、装置、计算机设备及存储介质
CN110515693A (zh) * 2019-07-26 2019-11-29 浪潮电子信息产业股份有限公司 一种基于机架感知的虚拟机横向扩展的方法和系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4206915A4 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086334A (zh) * 2022-06-15 2022-09-20 北京奇艺世纪科技有限公司 一种服务器标记方法及相关装置
CN115086334B (zh) * 2022-06-15 2024-05-28 北京奇艺世纪科技有限公司 一种服务器标记方法及相关装置

Also Published As

Publication number Publication date
JP2023538886A (ja) 2023-09-12
EP4206915A1 (en) 2023-07-05
US20230315531A1 (en) 2023-10-05
EP4206915A4 (en) 2024-08-14
JP7549132B2 (ja) 2024-09-10
CN113760441A (zh) 2021-12-07

Similar Documents

Publication Publication Date Title
US11409556B2 (en) Custom placement policies for virtual machines
CN112199194B (zh) 基于容器集群的资源调度方法、装置、设备和存储介质
US20200364608A1 (en) Communicating in a federated learning environment
US9027017B2 (en) Methods and apparatus for movement of virtual resources within a data center environment
US10305815B2 (en) System and method for distributed resource management
CN102971724B (zh) 与数据中心环境内的基于单元式虚拟资源的管理有关的方法和装置
CN110098946B (zh) 虚拟化网元设备的部署方法以及装置
WO2022042724A1 (zh) 容器创建方法、装置、电子设备及存储介质
US20160085589A1 (en) Method And Apparatus For Providing Isolated Virtual Space
CN110221920B (zh) 部署方法、装置、存储介质及系统
US20140059110A1 (en) Hierarchical dynamic scheduling
CN112052068A (zh) 一种Kubernetes容器平台CPU绑核的方法与装置
CN104679594B (zh) 一种中间件分布式计算方法
US11263054B2 (en) Memory-aware placement for virtual GPU enabled systems
US20220091763A1 (en) Storage capacity forecasting for storage systems in an active tier of a storage environment
WO2021259246A1 (zh) 资源调度方法和装置、电子设备、计算机可读存储介质
US11561824B2 (en) Embedded persistent queue
WO2022151951A1 (zh) 任务调度方法及管理系统
CN116401024A (zh) 基于云计算的集群扩缩容方法、装置、设备及介质
CN107528871A (zh) 存储系统中的数据分析
CN109257256A (zh) 设备监控方法、装置、计算机设备及存储介质
CN112612579B (zh) 虚拟机部署方法、存储介质及计算机设备
CN116339989A (zh) 一种混部服务器、混部服务器的资源管理方法及装置
US11579942B2 (en) VGPU scheduling policy-aware migration
Loganathan et al. Job scheduling with efficient resource monitoring in cloud datacenter

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21860556

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2023511608

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2021860556

Country of ref document: EP

Effective date: 20230331