WO2021135545A1 - 一种 kubernetes 多集群管理系统、方法、终端及存储介质 - Google Patents

一种 kubernetes 多集群管理系统、方法、终端及存储介质 Download PDF

Info

Publication number
WO2021135545A1
WO2021135545A1 PCT/CN2020/123184 CN2020123184W WO2021135545A1 WO 2021135545 A1 WO2021135545 A1 WO 2021135545A1 CN 2020123184 W CN2020123184 W CN 2020123184W WO 2021135545 A1 WO2021135545 A1 WO 2021135545A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
tasks
directed acyclic
acyclic graph
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2020/123184
Other languages
English (en)
French (fr)
Inventor
王竹云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2021135545A1 publication Critical patent/WO2021135545A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/5083Techniques for rebalancing the load in a distributed system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5017Task decomposition

Definitions

  • This application relates to the technical field of cluster management, and in particular to a kubernetes multi-cluster management system, method, terminal and storage medium.
  • Kubernetes (k8s for short, which is an abbreviation of 8 instead of 8 characters "ubernete") is an open source, used to manage containerized applications on multiple hosts in the cloud platform.
  • Kubernetes cluster management is relatively complex, especially when deploying, it requires a lot of pre-installation and pre-configuration processes for the operating system and software, which imposes technical requirements on cluster administrators. Higher.
  • Kubespray an open source project based on ansible.
  • Kubespray automates the installation process of the entire k8s cluster, and the deployment steps are more rigorous, the system and software configuration are optimized, and the production is available.
  • Kubespray's disadvantages are also more obvious, and the specific manifestations are as follows:
  • ssh Secure Shell, secure shell protocol
  • the installation process is task serial, and the installation time is too long when there are too many tasks
  • the template rendering work is performed on the server side, and then distributed to the target server, which is low in efficiency and large in network overhead;
  • This application provides a kubernetes multi-cluster management system, method, terminal and storage medium, which can solve the deficiencies in the prior art to a certain extent.
  • the multi-cluster management system is a system based on a distributed task scheduling framework and grpc protocol; the system includes a client and a server, and the client includes:
  • Task decomposition module used to decompose kubernete cluster tasks into a set number of tasks, divide tasks and task nodes according to task roles, generate task scheduling files and list files, and send the task scheduling files and list files to the service End; wherein, the task organization file is a file used to describe tasks and task roles, the list file is a file used to describe task nodes and task roles, and the task organization file and the task roles in the list file are one by one correspond;
  • Task execution module used to receive the task distributed by the server through the Agent on the task node, execute the task according to the task function, and return the task execution result to the server;
  • the server includes:
  • Data analysis module used to parse the task arrangement file and the list file through a parser to generate a directed acyclic graph composed of the tasks;
  • Task distribution module used to call the controller to distribute the tasks in the directed acyclic graph to the task nodes corresponding to the task roles of the tasks in the client.
  • a kubernetes multi-cluster management method including:
  • the task arrangement file is a file used to describe tasks and task roles
  • the list file is a file used to describe task nodes and task roles
  • the task arrangement files and the task roles in the list file are in one-to-one correspondence
  • the server parses the task scheduling file and the list file through a parser, generates a directed acyclic graph composed of the tasks, and calls the controller to distribute the tasks in the directed acyclic graph to all The task node corresponding to the task role of the task in the client;
  • the client receives the task distributed by the server through the Agent on the task node, executes the task according to the task function, and returns the task execution result to the server.
  • a terminal includes a processor and a memory coupled to the processor, wherein:
  • the memory stores program instructions
  • the task arrangement file is a file used to describe tasks and task roles
  • the list file is a file used to describe task nodes and task roles
  • the task arrangement files and the task roles in the list file are in one-to-one correspondence
  • the server parses the task scheduling file and the list file through a parser, generates a directed acyclic graph composed of the tasks, and calls the controller to distribute the tasks in the directed acyclic graph to all The task node corresponding to the task role of the task in the client;
  • the client receives the task distributed by the server through the Agent on the task node, executes the task according to the task function, and returns the task execution result to the server.
  • a storage medium storing program instructions executable by a processor, and when the program instructions are executed by the processor, the processor executes the following steps:
  • the task arrangement file is a file used to describe tasks and task roles
  • the list file is a file used to describe task nodes and task roles
  • the task arrangement files and the task roles in the list file are in one-to-one correspondence
  • the server parses the task scheduling file and the list file through a parser, generates a directed acyclic graph composed of the tasks, and calls the controller to distribute the tasks in the directed acyclic graph to all the tasks.
  • the task node corresponding to the task role of the task in the client;
  • the client receives the task distributed by the server through the Agent on the task node, executes the task according to the task function, and returns the task execution result to the server.
  • the embodiment of this application uses the self-developed distributed task scheduling framework of the golang language, and adopts the server-agent architecture based on grpc protocol to construct the kubernetes multi-cluster management system, by decomposing the kubernetes cluster task into multiple tasks , Divide Tasks and TaskNodes according to roles, so that Tasks of different roles are distributed to TaskNodes corresponding to their task roles for execution, thereby realizing parallel deployment, deletion, expansion and shrinking operations of multiple k8s clusters, improving operations Efficiency, task status and progress can be checked at any time; at the same time, the use of grpc instead of ssh connection method solves the problem that ssh cannot be used in many network environments, and supports custom plugins, which increases the scalability of operations.
  • FIG. 1 is a schematic diagram of the first structure of a kubernetes multi-cluster management system according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of the second structure of the kubernetes multi-cluster management system according to an embodiment of the present application
  • Fig. 3 is a schematic flowchart of a kubernetes multi-cluster management method according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of a terminal structure according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of the structure of a storage medium according to an embodiment of the present application.
  • first”, “second”, and “third” in this application are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined with “first”, “second”, and “third” may explicitly or implicitly include at least one of the features.
  • "a plurality of” means at least two, such as two, three, etc., unless otherwise specifically defined. All directional indications (such as up, down, left, right, front, back%) in the embodiments of this application are only used to explain the relative positional relationship between the components in a specific posture (as shown in the figure) , Movement status, etc., if the specific posture changes, the directional indication will also change accordingly.
  • FIG. 1 is a schematic diagram of the first structure of a kubernetes multi-cluster management system according to an embodiment of the present application.
  • This application uses the distributed task scheduling framework of the golang language, and uses the Server-Agent architecture based on the grpc protocol to construct a kubernetes multi-cluster management system, which can simultaneously implement operations such as deployment, deletion, and expansion of multiple k8s clusters, and Use grpc instead of ssh for task scheduling, which solves the problem of limited ssh connection.
  • the kubernetes multi-cluster management system includes the Server (server) side and the Agent (client) side.
  • the Server side includes the following components:
  • Task metadata Used to describe the structure of task metadata.
  • Task metadata includes task ID, name, status, dependencies, parameters, running results, etc.;
  • Task has a state machine, which is composed of state registers and combinational logic circuits , It can perform state transition according to the preset state according to the control signal. It is the control center that coordinates the actions of related signals and completes specific operations.
  • TaskGraph A directed acyclic graph composed of Tasks with its own state machine. TaskGraph is used to put multiple Tasks into multiple threads for execution, and can set the dependencies between multiple Tasks; TaskGraph includes Information about the status, dependencies, parameters and execution results of each Task. The status of TaskGraph and Task includes not ready (not ready), ready (ready), running (running), succuss (success), failed (failure) And the status of canceled (cancelled).
  • Parser Used to parse the TaskFile and Inventory sent by the Agent into TaskGraph;
  • Controller It is used to control and manage the life cycle of TaskGraph and Task through the state machine, and assign tasks with ready status to the corresponding TaskNode on the Agent side;
  • Cache (memory): used to cache TaskGraph;
  • the Agent side includes the following components:
  • TaskNode used to describe the structure of the task running node, including two channels (channels), which are respectively used for distributing tasks and receiving task execution results;
  • Agent runs on the real node described by TaskNode, executes the task after receiving the task distributed by the server through the grpc interface, and returns the execution result of the task to the server;
  • TaskStore (task warehouse): Agent side is used to store the mapping relationship between task name and task function;
  • TaskRole Used to divide Task and TaskNode by role
  • TaskFile task arrangement file: Json used to describe Task and TaskRole ((JavaScript Object Notation, JS object notation) file;
  • Inventory Json file used to describe TaskNode and TaskRole.
  • the operation process of the kubernetes multi-cluster management system in the embodiment of the present application is specifically as follows:
  • the Agent side decomposes the k8s cluster tasks (including but not limited to deployment, deletion, expansion and contraction, etc.) into a set number of Tasks, and assigns tasks and tasks by role through TaskRole.
  • TaskNode is divided so that Tasks of different roles are distributed to TaskNodes corresponding to their task roles, TaskFile and Inventory are generated, and TaskFile and inventory are sent to Server;
  • Server side starts http server and grpc at the same time Server and Controller components, and initialize the Cache; among them, the http server is used to receive TaskFile and inventory requests sent by the Agent side; the grpc server is used to distribute tasks to the Agent side and receive the execution results of the tasks.
  • Controller After the Server receives the TaskFile and Inventory requests, Paster automatically parses the dependencies of the Task and converts it to TaskGraph, and then calls the Controller's StartGraph function to initialize the TaskTgraph, update the state machine, and create a corresponding Pool for TaskGraph, and Add TaskNode in Inventory to Pool; Controller creates two coroutines after TaskGraph is started, one constantly refreshes the status of each task in TaskGraph, and distributes tasks with the status of Ready to the corresponding TaskNode; the other continuously starts from Get the Task result (execution result) of each task from the TaskNode in the pool.
  • the state machine of TaskGraph updates the state of the corresponding task in TaskGraph according to Task result.
  • the Agent on the TaskNode When the Agent on the TaskNode obtains the Task that needs to be executed, it retrieves the corresponding task function from the TaskStore and executes the task, and finally returns the task execution result to the Server side through the grpc interface.
  • the Controller on the server side stops refreshing the TaskGraph when the TaskGraph reaches the final state (Success/Failed/Canneled/Timeout), and the result of this k8s deployment task.
  • the multi-cluster management system of the embodiment of the present application also includes a task orchestration system and a resource pool system.
  • the task orchestration system automatically resolves the dependencies between tasks and uses Task as The node uses the dependency point as an edge to build a directed acyclic graph of Task; then the Controller divides the Task and the resource according to the role, so that the Task of different roles is scheduled to different resources for installation, such as the deployment of k8s
  • the task is divided into three roles: kube-master-primary, kube-master-slave and kube-node, and the installation tasks of the master master, slave master, and load node are performed respectively.
  • the embodiment of this application implements task parallelism through directed acyclic graphs, and can divide tasks according to roles, so that when developing tasks, you don’t need to care about task dependencies, you only need to care about the realization of functions, and then arrange them into Taskfile can achieve orderly scheduling.
  • this application can also perform custom plugin operations in TaskGraph and Task states, such as sending notifications, recording task execution time, triggering another TaskGraph, etc., which increases the scalability of functions.
  • the embodiment of this application uses the self-developed distributed task scheduling framework of the golang language, and uses the server-agent architecture based on the grpc protocol to construct the kubernetes multi-cluster management system, which realizes the parallel deployment, deletion, and expansion of multiple k8s clusters.
  • the operation efficiency is improved, and the task status and progress can be checked at any time.
  • grpc is used to replace the ssh connection method, which solves the problem that ssh cannot be used in many network environments.
  • the user in the deployment process of K8s, using the context feature of golang, the user can cancel the cluster deployment process by sending a signal.
  • this application can generate various yaml files on the Agent side through template rendering, which solves the problem of extra network overhead caused by kubespray after rendering on the server side and then transmitting to the target server.
  • the underlying distributed task scheduling framework of the embodiments of this application is universal and can be referenced to other golang projects as a library; at the same time, it is extensible.
  • the executor on the Agent side can extend to support kubernetes pods, and schedule scheduling by orchestrating Taskfile. pod. Based on the above two points, this application is also applicable to multiple distributed batch task scheduling application scenarios.
  • FIG. 2 is a schematic diagram of the second structure of the kubernetes multi-cluster management system according to an embodiment of the present application.
  • the system includes a Server end and an Agent end, where the Agent end is located on the node where the k8s cluster is to be deployed.
  • the Server side includes:
  • Component startup module used to start the Server side and start http at the same time server, grpc server, and Controller components, and initialize the Cache; among them, the http server is used to receive TaskFile and inventory requests sent by the agent; the grpc server is used to distribute tasks to the agent and receive the execution results of the tasks.
  • Task distribution module Used to call the StartGraph function of the Controller to initialize TaskTGraph, update the state machine, create a corresponding Pool for TaskGraph, and add TaskNode in Inventory to the Pool; and after TaskGraph is started, call Controller to create two A coroutine, one constantly refreshes the status of each task in the TaskGraph, and distributes the tasks whose status is Ready to the corresponding TaskNode; the other continuously obtains the Task result of each task from the TaskNode in the Pool, and the state machine of TaskGraph is based on Task result updates the status of the corresponding task in the TaskGraph; among them, when the Controller detects that the TaskGraph reaches the final state (Success/Failed/Canneled/Timeout), it stops refreshing the TaskGraph, the result of this k8s deployment task; users can query through the http interface on the server side The status of TaskGraph.
  • the Agent side includes:
  • Task decomposition module used to decompose k8s cluster tasks (including but not limited to deployment, deletion, expansion and contraction, etc.) into a set number of Tasks, and divide Tasks and TaskNodes by role through TaskRole, so that tasks of different roles are distributed to On the TaskNode corresponding to the task role, generate TaskFile and Inventory, and send TaskFile and inventory to the Server side; among them, the example of TaskFile and Inventory generation is as follows:
  • Task execution module used to obtain the Task to be executed through the Agent on the TaskNode, retrieve the corresponding task function from the TaskStore and execute the task, and finally return the task execution result to the Server side through the grpc interface.
  • FIG. 3 is a schematic flowchart of a kubernetes multi-cluster management method according to an embodiment of the present application.
  • the kubernetes multi-cluster management method of the embodiment of the application includes the following steps:
  • S1 Start the Server side, and start the http server, grpc server and Controller components at the same time, and initialize the Cache;
  • the http server is used to receive the TaskFile and inventory requests sent by the agent;
  • the grpc server is used to distribute tasks to the agent and receive the execution results of the tasks.
  • S2 Install and start the Agent side on the node where the k8s cluster is to be deployed.
  • the Agent side divides the k8s cluster tasks (including but not limited to deployment, deletion, expansion and contraction, etc.) into a set number of tasks, and assigns tasks by role through TaskRole Divide with TaskNode, generate TaskFile and Inventory, and send TaskFile and inventory to Server;
  • TaskFile and Inventory generation examples are as follows:
  • the Controller After the TaskGraph is started, the Controller creates two coroutines, one constantly refreshes the status of each task in the TaskGraph, and distributes the tasks with the status Ready to the corresponding TaskNode; the other continuously obtains each from the TaskNode in the Pool Task result of the task, the state machine of TaskGraph updates the state of the corresponding task in TaskGraph according to the task result;
  • TaskGraph the status of TaskGraph can be queried through the http interface on the server side.
  • FIG. 4 is a schematic diagram of a terminal structure according to an embodiment of the application.
  • the terminal 50 includes a processor 51 and a memory 52 coupled to the processor 51.
  • the memory 52 stores program instructions for implementing the above-mentioned kubernetes multi-cluster management method.
  • the task arrangement file is a file used to describe tasks and task roles
  • the list file is a file used to describe task nodes and task roles
  • the task arrangement files and the task roles in the list file are in one-to-one correspondence
  • the server parses the task scheduling file and the list file through a parser, generates a directed acyclic graph composed of the tasks, and calls the controller to distribute the tasks in the directed acyclic graph to all the tasks.
  • the task node corresponding to the task role of the task in the client;
  • the client receives the task distributed by the server through the Agent on the task node, executes the task according to the task function, and returns the task execution result to the server.
  • the processor 51 may also be referred to as a CPU (Central Processing Unit, central processing unit).
  • the processor 51 may be an integrated circuit chip with signal processing capability.
  • the processor 51 may also be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA off-the-shelf programmable gate array
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • FIG. 5 is a schematic structural diagram of a storage medium according to an embodiment of the application.
  • the storage medium of the embodiment of the present application stores a program file 61 that can implement all the above methods.
  • the program file 61 can be stored in the above storage medium in the form of a software product, and includes a number of instructions to enable a computer device (which can Is a personal computer, server, or network device, etc.) or processor performs the following steps:
  • the task arrangement file is a file used to describe tasks and task roles
  • the list file is a file used to describe task nodes and task roles
  • the task arrangement files and the task roles in the list file are in one-to-one correspondence
  • the server parses the task scheduling file and the list file through a parser, generates a directed acyclic graph composed of the tasks, and calls the controller to distribute the tasks in the directed acyclic graph to all the tasks.
  • the task node corresponding to the task role of the task in the client;
  • the client receives the task distributed by the server through the Agent on the task node, executes the task according to the task function, and returns the task execution result to the server.
  • the aforementioned storage medium may be non-volatile or volatile.
  • the storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory). ), various media that can store program codes, such as magnetic disks or optical discs, or terminal devices such as computers, servers, mobile phones, and tablets.
  • the embodiment of this application uses the self-developed distributed task scheduling framework of golang language, and adopts the server-agent architecture based on grpc protocol to construct the kubernetes multi-cluster management system.
  • the tasks and TaskNodes are assigned according to roles. Divide, so that the tasks of different roles are distributed to the TaskNode corresponding to the task role, so as to realize the parallel deployment, deletion, expansion and contraction of multiple k8s clusters, and improve the operation efficiency; at the same time, use grpc instead of ssh
  • the connection method solves the problem that ssh cannot be used in many network environments, and supports custom plugins, which increases the scalability of operations.
  • the disclosed system, device, and method can be implemented in other ways.
  • the system embodiment described above is only illustrative.
  • the division of units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. The above are only implementations of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly applied to other related technical fields, The same reasoning is included in the scope of patent protection of this application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种kubernetes多集群管理系统、方法、终端及存储介质,所述多集群管理系统为基于分布式任务调度框架和grpc协议构建的系统;所述系统包括客户端和服务端,所述客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,所述服务端通过解析器生成由任务组成的有向无环图,调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点。上述系统实现了多个k8s集群并行的部署、删除、扩缩容等操作,提升了操作效率,且任务状态、进度随时可查;同时使用grpc取代ssh的连接方式,解决了ssh在诸多网络环境中无法使用的问题。

Description

一种kubernetes多集群管理系统、方法、终端及存储介质
本申请要求于2020年6月30日提交中国专利局、申请号为202010620870.4,发明名称为“一种kubernetes多集群管理系统、方法、终端及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及集群管理技术领域,特别是涉及一种kubernetes多集群管理系统、方法、终端及存储介质。
背景技术
Kubernetes(简称k8s,是用8代替8个字符“ubernete”而成的缩写)是一个开源的,用于管理云平台中多个主机上的容器化的应用。虽然利用Kubernetes可以实现简单并且高效的部署容器化,然而Kubernetes的集群管理复杂度较高,尤其部署时需要对操作系统、软件进行很多的预安装、预配置的过程,对集群管理员的技术要求较高。
目前使用较为广泛的、生产可用的Kubernetes集群管理方案为基于ansible的开源项目Kubespray。Kubespray对整个k8s集群的安装过程实现了自动化,并且部署步骤较为严谨,对系统、软件配置进行了优化,生产可用。但发明人发现Kubespray的劣势也较为明显,具体表现为:
1. Kuberspray使用ssh(Secure Shell,安全外壳协议)连接目标服务器,在某些对ssh限制较多的网络环境中,无法使用或连接缓慢;
2. 安装过程为任务串行,任务量较多时,安装时间过长;
3. 模版渲染工作在server端进行,然后分发至目标服务器,效率较低、网络开销较大;
4. 只支持单集群安装;
5. 安装过程中无法查询安装进度,且无法取消。
技术问题
本申请提供了一种kubernetes多集群管理系统、方法、终端及存储介质,能够在一定程度上解决现有技术中存在的不足。
技术解决方案
为解决上述技术问题,本申请采用的技术方案为:
一种kubernetes多集群管理系统,所述多集群管理系统为基于分布式任务调度框架和grpc协议构建的系统;所述系统包括客户端和服务端,所述客户端包括:
任务分解模块:用于将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
任务执行模块:用于通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端;
所述服务端包括:
数据解析模块:用于通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图;
任务分发模块:用于调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点。
本申请实施例采取的另一技术方案为:一种kubernetes多集群管理方法,包括:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
本申请实施例采取的又一技术方案为:一种终端,所述终端包括处理器、与所述处理器耦接的存储器,其中,
所述存储器存储有程序指令;
所述处理器执行所述存储器存储的所述程序指令时,执行以下步骤:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
本申请实施例采取的又一技术方案为:一种存储介质,存储有处理器可运行的程序指令,所述程序指令被处理器执行时,使得处理器执行以下步骤:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
有益效果
本申请的有益效果是:本申请实施例利用golang语言自研的分布式任务调度框架,并采用基于grpc协议的server-agent架构构建kubernetes多集群管理系统,通过将kubernetes集群任务分解成多个Task,按角色对Task及TaskNode进行划分,使得不同角色的Task分发到与之任务角色相对应的TaskNode上执行,从而实现了多个k8s集群并行的部署、删除、扩缩容等操作,提升了操作效率,且任务状态、进度随时可查;同时使用grpc取代ssh的连接方式,解决了ssh在诸多网络环境中无法使用的问题,并支持自定义plugin,增加了操作的可扩展性。
附图说明
图1是本申请实施例的kubernetes多集群管理系统第一结构示意图;
图2是本申请实施例的kubernetes多集群管理系统第二结构示意图;
图3是本申请实施例的kubernetes多集群管理方法流程示意图;
图4是本申请实施例的终端结构示意图;
图5是本申请实施例的存储介质结构示意图。
本发明的实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请中的术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”、“第三”的特征可以明示或者隐含地包括至少一个该特征。本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。本申请实施例中所有方向性指示(诸如上、下、左、右、前、后……)仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
请参阅图1,是本申请实施例的kubernetes多集群管理系统第一结构示意图。本申请利用golang语言的分布式任务调度框架,并采用基于grpc协议的Server-Agent架构构建kubernetes多集群管理系统,该系统可同时实现多个k8s集群的部署、删除、扩缩容等操作,并使用grpc替代ssh进行任务调度,解决了ssh连接受限的问题。具体的,kubernetes多集群管理系统包括Server(服务)端和Agent(客户)端,其中,Server端包括以下组件:
Task(任务):用于描述任务元数据的结构体,任务元数据包括任务ID、名称、状态、依赖、参数、运行结果等;Task带有状态机,状态机由状态寄存器和组合逻辑电路构成,能够根据控制信号按照预先设定的状态进行状态转移,是协调相关信号动作,完成特定操作的控制中心。
TaskGraph(任务图): 由Task组成的自带状态机的有向无环图,TaskGraph用于将多个Task放入多个线程执行,并且可以设定多个Task之间的依赖关系;TaskGraph包含每一个Task的状态、依赖关系、参数及执行结果等信息,TaskGraph及Task的状态包括not ready(未就绪)、ready(已就绪)、running(运行中)、succuss(成功)、 failed(失败)及canceled(取消)等状态。
Parser(解析器):用于将Agent端发送的TaskFile和Inventory解析为TaskGraph;
Controller(控制器): 用于通过状态机控制、管理TaskGraph及Task的生命周期,并将状态为ready 的Task分配给Agent端相应的TaskNode;
Cache(存储器):用于缓存TaskGraph;
Pool:由TaskNode组成的任务节点池。
Agent端包括以下组件:
TaskNode(任务节点):用于描述Task所运行节点的结构体,包括两个channel(通道),分别用于分发Task以及接收Task的执行结果;
Agent(代理):运行在TaskNode描述的真实节点上,通过grpc接口接收Server端分发的Task后执行Task,并将Task的执行结果返回给Server 端;
TaskStore(任务仓库):Agent端用于储存任务名称与任务函数的映射关系的任务仓库;
TaskRole(任务角色): 用于按角色划分Task及TaskNode;
TaskFile(任务编排文件):用于描述Task与TaskRole的Json((JavaScript Object Notation, JS 对象简谱) )文件;
Inventory(清单文件):用于描述TaskNode与TaskRole的Json文件。
基于上述结构,本申请实施例的kubernetes多集群管理系统的操作过程具体为:
首先在待部署k8s集群的节点上安装并启动Agent端,Agent端将k8s集群任务(包括但不限于部署、删除、扩缩容等)分解成设定数量的Task,通过TaskRole按角色对Task及TaskNode进行划分,使得不同角色的Task分发到与之任务角色相对应的TaskNode上,生成TaskFile及Inventory,并将TaskFile及inventory发送至Server端;
Server端同时启动http server、grpc server以及Controller组件,并初始化Cache;其中,http server用于接收Agent端发送的TaskFile及inventory请求;grpc server用于向Agent端分发Task,以及接收Task的执行结果。Server端接收到TaskFile及Inventory请求后,通过Paster自动解析Task的依赖关系,并转化为TaskGraph,然后调用Controller的StartGraph函数,对TaskTgraph进行初始化,更新状态机,同时为TaskGraph创建一个对应的Pool,并将Inventory中的TaskNode添加到Pool中;Controller在TaskGraph启动之后,创建两个协程,一个不断刷新TaskGraph中每一个任务的状态,并将状态为Ready的任务分发给相应的TaskNode;另一个不断从Pool中的TaskNode中获取每一个任务的Task result(执行结果)。TaskGraph的状态机根据Task result更新TaskGraph中对应任务的状态。
TaskNode上的Agent获取到需要执行的Task时,从TaskStore中检索出相应的任务函数并执行任务,最后将任务执行结果通过grpc接口返回至Server端。
Server端的Controller在TaskGraph达到最终状态(Success/Failed/Canneled/Timeout)时,停止刷新TaskGraph,本次k8s部署任务结果。
上述中,本申请实施例的多集群管理系统还包括任务编排系统和资源池系统,当Agent端提供一个Json格式的Taskfile以及Inventory时,任务编排系统自动解析Task间依赖关系,并将Task做为节点,将依赖指向做为边,构建一个Task的有向无环图;然后通过Controller按照角色将Task和资源进行划分,使得不同角色的Task调度到不同的资源上进行安装,例如将k8s的部署任务分解为kube-master-primary、kube-master-slave及kube-node三种角色,并分别进行主master、从master及负载节点的安装任务。相较于ansible而言,本申请实施例通过有向无环图实现了任务并行,并可按角色对任务进行划分,使得开发任务时无需关心任务依赖,只需关心功能的实现,随后编排成Taskfile即可实现有序调度。
基于上述结构,本申请还可以在TaskGraph及Task的各种状态中执行自定义plugin(插件)的操作,例如发送通知、记录任务执行时间、触发另一个TaskGraph等,增加了功能的可扩展性。
基于上述,本申请实施例利用golang语言自研的分布式任务调度框架,并采用基于grpc协议的server-agent架构构建kubernetes多集群管理系统,实现了多个k8s集群并行的部署、删除、扩缩容等操作,提升了操作效率,且任务状态、进度随时可查;同时使用grpc取代ssh的连接方式,解决了ssh在诸多网络环境中无法使用的问题。
本申请实施例中,在K8s的部署过程中,利用golang的context特性,用户可通过发送信号来取消集群部署过程。
在K8s的部署过程,本申请可在Agent端通过模版渲染的方式生成各种yaml文件,解决了kubespray在Server端渲染后再传输给目标服务器带来的额外网络开销的问题。
本申请实施例的底层分布式任务调度框架本身具有通用性,可作为library被引用到其他golang项目中;同时具有可扩展性,Agent端的executor可以扩展支持kubernetes的pod,通过编排Taskfile的方式编排调度pod。基于以上两点,本申请同样适用于多种分布式批量任务调度的应用场景。
请参阅图2,是本申请实施例的kubernetes多集群管理系统第二结构示意图。该系统包括Server端和Agent端,其中Agent端按照于待部署k8s集群的节点上。
具体的,Server端包括:
组件启动模块:用于启动Server端,同时启动http server、grpc server以及Controller组件,并初始化Cache;其中,http server用于接收Agent端发送的TaskFile及inventory请求;grpc server用于向Agent端分发Task,以及接收Task的执行结果。
数据解析模块:用于在接收到Agent端的TaskFile及Inventory请求后,通过Paster自动解析Task的依赖关系,并生成TaskGraph;
任务分发模块:用于调用Controller的StartGraph函数对TaskTGraph进行初始化,更新状态机,同时为TaskGraph创建一个对应的Pool,并将Inventory中的TaskNode添加到Pool中;并在TaskGraph启动之后,调用Controller创建两个协程,一个不断刷新TaskGraph中每一个任务的状态,并将状态为Ready的任务分发给相应的TaskNode;另一个不断从Pool中的TaskNode中获取每一个任务的Task result,TaskGraph的状态机根据Task result更新TaskGraph中对应任务的状态;其中,当Controller监测到TaskGraph达到最终状态(Success/Failed/Canneled/Timeout)时,停止刷新TaskGraph,本次 k8s部署任务结果;用户可通过server端的http接口查询TaskGraph的状态。
相应地,Agent端包括:
任务分解模块:用于将k8s集群任务(包括但不限于部署、删除、扩缩容等)分解成设定数量的Task,通过TaskRole按角色对Task及TaskNode进行划分,使得不同角色的Task分发到与之任务角色相对应的TaskNode上,生成TaskFile及Inventory,并将TaskFile及inventory发送至Server端;其中,TaskFile及Inventory生成示例如下:
TaskFile示例:
[
{
  “role”: “kube-master-primary”,  //任务角色
  “Tasks”: [
{
  “name”: “create-etcd-cert-file”, // 任务名称
  “params”: {….} // 运行参数
  “deps”: [..]   // 依赖任务
},
{
  “name”: “etcd-start”,
  “params”: {…}
  “deps”: []
},
{
  “name”: “install-apiserver”,
  “params”: {}
  “deps”: []
}
]
}
]
Inventory示例:
[
  {
    "role": "kube-master-primary",
    "nodes": [
      "30.99.141.77"
    ]
  },
  {
    "role": "kube-master-slave",
    "nodes": [
      "30.99.141.78",
      "30.99.141.79"
    ]
  },
{
    "role": "kube-node",
    "nodes": [
      "30.99.141.80",
      "30.99.141.81"
    ]
  }
]
任务执行模块:用于通过TaskNode上的Agent获取到需要执行的Task,从TaskStore中检索出相应的任务函数并执行任务,最后将任务执行结果通过grpc接口返回至Server端。
请参阅图3,是本申请实施例的kubernetes多集群管理方法的流程示意图。本申请实施例的kubernetes多集群管理方法包括以下步骤:
S1:启动Server端,并同时启动http server、grpc server以及Controller组件,并初始化Cache;
其中,http server用于接收Agent端发送的TaskFile及inventory请求;grpc server用于向Agent端分发Task,以及接收Task的执行结果。
S2:在待部署k8s集群的节点上安装并启动Agent端,Agent端将k8s集群任务(包括但不限于部署、删除、扩缩容等)分解成设定数量的Task,通过TaskRole按角色对Task及TaskNode进行划分,生成TaskFile及Inventory,并将TaskFile及inventory发送至Server端;
其中,Taskfile及Inventory中的role(角色)一一对应,使得不同角色的Task可以分发到与之任务角色相对应的TaskNode上,Agent端通过POST接口将TaskFile及inventory发送至Server端。TaskFile及Inventory生成示例如下:
TaskFile示例:
[
{
  “role”: “kube-master-primary”,  //任务角色
  “Tasks”: [
{
  “name”: “create-etcd-cert-file”, // 任务名称
  “params”: {….} // 运行参数
  “deps”: [..]   // 依赖任务
},
{
  “name”: “etcd-start”,
  “params”: {…}
  “deps”: []
},
{
  “name”: “install-apiserver”,
  “params”: {}
  “deps”: []
}
]
}
]
Inventory示例:
[
  {
    "role": "kube-master-primary",
    "nodes": [
      "30.99.141.77"
    ]
  },
  {
    "role": "kube-master-slave",
    "nodes": [
      "30.99.141.78",
      "30.99.141.79"
    ]
  },
{
    "role": "kube-node",
    "nodes": [
      "30.99.141.80",
      "30.99.141.81"
    ]
  }
]
S3:Server端接收到TaskFile及Inventory请求后,通过Paster自动解析Task的依赖关系,并转化为TaskGraph,然后调用Controller的StartGraph函数对TaskTGraph进行初始化,更新状态机,同时为TaskGraph创建一个对应的Pool,并将Inventory中的TaskNode添加到Pool中;
S4:Controller在TaskGraph启动之后,创建两个协程,一个不断刷新TaskGraph中每一个任务的状态,并将状态为Ready的任务分发给相应的TaskNode;另一个不断从Pool中的TaskNode中获取每一个任务的Task result,TaskGraph的状态机根据Task result更新TaskGraph中对应任务的状态;
S5:TaskNode上的Agent获取到需要执行的Task时,从TaskStore中检索出相应的任务函数执行Task,并将执行结果通过grpc接口返回至Server端;
S6:Controller在TaskGraph达到最终状态(Success/Failed/Canneled/Timeout)时,停止刷新TaskGraph,本次 k8s部署任务结果;
其中,可通过server端的http接口查询TaskGraph的状态。
请参阅图4,为本申请实施例的终端结构示意图。该终端50包括处理器51、与处理器51耦接的存储器52。
存储器52存储有用于实现上述kubernetes多集群管理方法的程序指令。
处理器51执行存储器52存储的程序指令时,执行以下步骤:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
其中,处理器51还可以称为CPU(Central Processing Unit,中央处理单元)。处理器51可能是一种集成电路芯片,具有信号的处理能力。处理器51还可以是通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
请参阅图5,图5为本申请实施例的存储介质的结构示意图。本申请实施例的存储介质存储有能够实现上述所有方法的程序文件61,其中,该程序文件61可以以软件产品的形式存储在上述存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行以下步骤:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
而前述的存储介质可以是非易失性,也可以是易失性,存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质,或者是计算机、服务器、手机、平板等终端设备。
本申请实施例利用golang语言自研的分布式任务调度框架,并采用基于grpc协议的server-agent架构构建kubernetes多集群管理系统,通过将kubernetes集群任务分解成多个Task,按角色对Task及TaskNode进行划分,使得不同角色的Task分发到与之任务角色相对应的TaskNode上执行,从而实现了多个k8s集群并行的部署、删除、扩缩容等操作,提升了操作效率;同时使用grpc取代ssh的连接方式,解决了ssh在诸多网络环境中无法使用的问题,并支持自定义plugin,增加了操作的可扩展性。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。以上仅为本申请的实施方式,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

1. 一种kubernetes多集群管理系统,其中,所述多集群管理系统为基于分布式任务调度框架和grpc协议构建的系统;所述系统包括客户端和服务端,所述客户端包括:
任务分解模块:用于将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
任务执行模块:用于通过所述任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端;
所述服务端包括:
数据解析模块:用于通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图;
任务分发模块:用于调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点。
2. 根据权利要求1所述的kubernetes多集群管理系统,其中,
所述任务为用于描述任务元数据的结构体,所述任务带有状态机;
所述有向无环图包含每一个任务的状态、依赖关系、参数及执行结果,所述每一个任务的状态分别包括未就绪、已就绪、运行中、成功、失败及取消。
3. 根据权利要求2所述的kubernetes多集群管理系统,其中,所述控制器用于通过状态机控制、管理所述有向无环图及任务的生命周期,并将状态为已就绪的任务分配给客户端对应的任务节点。
4. 根据权利要求1所述的kubernetes多集群管理系统,其中,所述服务端还包括:
组件启动模块:用于在服务端启动时,启动http server、grpc server以及控制器,并初始化存储器;其中,所述http server用于接收客户端发送的任务编排文件及清单文件;所述grpc server用于向所述客户端分发任务,并接收所述客户端返回的任务执行结果;所述存储器用于缓存所述有向无环图。
5. 根据权利要求4所述的kubernetes多集群管理系统,其中,所述任务分发模块调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点具体为:
调用所述控制器的StartGraph函数对所述有向无环图进行初始化,更新状态机,同时为所述有向无环图创建一个对应的Pool,并将所述清单文件中的任务节点添加到Pool中;所述Pool为由所述任务节点组成的任务节点池;在所述有向无环图启动之后,调用所述控制器创建两个协程,一个协程不断刷新所述有向无环图中所述任务的状态,并将状态为已就绪的任务分发给相应的任务节点;另一个协程不断从所述Pool的任务节点中获取所述任务的执行结果,所述有向无环图的状态机根据每个任务的执行结果更新所述有向无环图中所述任务的状态。
6. 一种kubernetes多集群管理方法,其中,包括:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
7. 根据权利要求6所述的kubernetes多集群管理方法,其中,所述任务为用于描述任务元数据的结构体,所述任务带有状态机;
所述有向无环图包含每一个任务的状态、依赖关系、参数及执行结果,所述每一个任务的状态分别包括未就绪、已就绪、运行中、成功、失败及取消。
8. 根据权利要求7所述的kubernetes多集群管理方法,其中,所述调用控制器将所述有向无环图中的任务分发给所述Agent端对应的任务节点包括:
调用所述控制器的StartGraph函数对所述有向无环图进行初始化,更新状态机,同时为所述有向无环图创建一个对应的Pool,并将所述清单文件中的任务节点添加到Pool中;
所述Pool为由所述任务节点组成的任务节点池;
在所述有向无环图启动之后,调用所述控制器创建两个协程,一个协程不断刷新所述有向无环图中所述任务的状态,并将状态为已就绪的任务分发给相应的任务节点;另一个协程不断从所述Pool的任务节点中获取所述任务的执行结果,所述有向无环图的状态机根据每个任务的执行结果更新所述有向无环图中所述任务的状态。
9. 一种终端,其中,所述终端包括处理器、与所述处理器耦接的存储器,其中,
所述存储器存储有程序指令;
所述处理器执行所述存储器存储的所述程序指令时,执行以下步骤:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
10. 根据权利要求9所述的终端,其中,所述任务为用于描述任务元数据的结构体,所述任务带有状态机。
11. 根据权利要求10所述的终端,其中,所述有向无环图包含每一个任务的状态、依赖关系、参数及执行结果,所述每一个任务的状态分别包括未就绪、已就绪、运行中、成功、失败及取消。
12. 根据权利要求11所述的终端,其中,所述控制器用于通过状态机控制、管理所述有向无环图及任务的生命周期,并将状态为已就绪的任务分配给客户端对应的任务节点。
13. 根据权利要求11所述的终端,其中,所述调用控制器将所述有向无环图中的任务分发给所述Agent端对应的任务节点包括:
调用所述控制器的StartGraph函数对所述有向无环图进行初始化,更新状态机,同时为所述有向无环图创建一个对应的Pool,并将所述清单文件中的任务节点添加到Pool中;
所述Pool为由所述任务节点组成的任务节点池;
在所述有向无环图启动之后,调用所述控制器创建两个协程,一个协程不断刷新所述有向无环图中所述任务的状态,并将状态为已就绪的任务分发给相应的任务节点;另一个协程不断从所述Pool的任务节点中获取所述任务的执行结果,所述有向无环图的状态机根据每个任务的执行结果更新所述有向无环图中所述任务的状态。
14. 根据权利要求13所述的终端,其中,所述调用所述控制器的StartGraph函数对所述有向无环图进行初始化之前,还包括:
在服务端启动时,启动http server、grpc server以及控制器,并初始化存储器;其中,所述http server用于接收客户端发送的任务编排文件及清单文件;所述grpc server用于向所述客户端分发任务,并接收所述客户端返回的任务执行结果;所述存储器用于缓存所述有向无环图。
15. 一种存储介质,其中,存储有处理器可运行的程序指令,所述程序指令被处理器执行时,使得处理器执行以下步骤:
通过客户端将kubernete集群任务分解为设定数量的任务,按照任务角色对任务及任务节点进行划分,生成任务编排文件及清单文件,并将所述任务编排文件及清单文件发送至服务端;其中,所述任务编排文件为用于描述任务与任务角色的文件,所述清单文件为用于描述任务节点与任务角色的文件,所述任务编排文件及清单文件中的任务角色一一对应;
所述服务端通过解析器对所述任务编排文件及清单文件进行解析,生成由所述任务组成的有向无环图,并调用控制器将所述有向无环图中的任务分发给所述客户端中与所述任务的任务角色相对应的任务节点;
所述客户端通过任务节点上的Agent接收所述服务端分发的任务,根据任务函数执行所述任务,并将所述任务执行结果返回至服务端。
16. 根据权利要求15所述的存储介质,其中,所述任务为用于描述任务元数据的结构体,所述任务带有状态机。
17. 根据权利要求16所述的存储介质,其中,所述有向无环图包含每一个任务的状态、依赖关系、参数及执行结果,所述每一个任务的状态分别包括未就绪、已就绪、运行中、成功、失败及取消。
18. 根据权利要求17所述的存储介质,其中,所述控制器用于通过状态机控制、管理所述有向无环图及任务的生命周期,并将状态为已就绪的任务分配给客户端对应的任务节点。
19. 根据权利要求17所述的存储介质,其中,所述调用控制器将所述有向无环图中的任务分发给所述Agent端对应的任务节点包括:
调用所述控制器的StartGraph函数对所述有向无环图进行初始化,更新状态机,同时为所述有向无环图创建一个对应的Pool,并将所述清单文件中的任务节点添加到Pool中;
所述Pool为由所述任务节点组成的任务节点池;
在所述有向无环图启动之后,调用所述控制器创建两个协程,一个协程不断刷新所述有向无环图中所述任务的状态,并将状态为已就绪的任务分发给相应的任务节点;另一个协程不断从所述Pool的任务节点中获取所述任务的执行结果,所述有向无环图的状态机根据每个任务的执行结果更新所述有向无环图中所述任务的状态。
20. 根据权利要求19所述的存储介质,其中,所述调用所述控制器的StartGraph函数对所述有向无环图进行初始化之前,还包括:
在服务端启动时,启动http server、grpc server以及控制器,并初始化存储器;其中,所述http server用于接收客户端发送的任务编排文件及清单文件;所述grpc server用于向所述客户端分发任务,并接收所述客户端返回的任务执行结果;所述存储器用于缓存所述有向无环图。
PCT/CN2020/123184 2020-06-30 2020-10-23 一种 kubernetes 多集群管理系统、方法、终端及存储介质 Ceased WO2021135545A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010620870.4A CN111782370B (zh) 2020-06-30 2020-06-30 一种kubernetes多集群管理系统、方法、终端及存储介质
CN202010620870.4 2020-06-30

Publications (1)

Publication Number Publication Date
WO2021135545A1 true WO2021135545A1 (zh) 2021-07-08

Family

ID=72760869

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/123184 Ceased WO2021135545A1 (zh) 2020-06-30 2020-10-23 一种 kubernetes 多集群管理系统、方法、终端及存储介质

Country Status (2)

Country Link
CN (1) CN111782370B (zh)
WO (1) WO2021135545A1 (zh)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377030A (zh) * 2021-08-12 2021-09-10 腾讯科技(深圳)有限公司 一种路口信号控制模型的确定方法和相关装置
CN113742033A (zh) * 2021-09-08 2021-12-03 广西东信数建信息科技有限公司 一种kubernetes集群联邦系统及其实现方法
CN114048011A (zh) * 2021-11-04 2022-02-15 安徽博微广成信息科技有限公司 多任务处理方法和系统
CN114064205A (zh) * 2021-10-30 2022-02-18 郑州云海信息技术有限公司 一种应用组件调度的方法、系统、存储介质及设备
CN114116066A (zh) * 2021-11-30 2022-03-01 湖南麒麟信安科技股份有限公司 一种云平台集群控制方法、系统及存储介质
CN114217949A (zh) * 2021-11-05 2022-03-22 新浪网技术(中国)有限公司 一种面向应用的容器服务管理方法及系统
CN114461147A (zh) * 2022-01-28 2022-05-10 新浪网技术(中国)有限公司 一种为kubernetes集群提供不同存储类型的方法及系统
CN114546588A (zh) * 2022-02-15 2022-05-27 浙江大华技术股份有限公司 任务的部署方法、装置、存储介质及电子装置
CN114564326A (zh) * 2022-02-14 2022-05-31 新浪网技术(中国)有限公司 一种对kubernetes集群的应用程序进行异常扫描的方法及系统
CN114610502A (zh) * 2022-03-24 2022-06-10 阿里巴巴(中国)有限公司 应用工作负载调度方法以及装置
CN114640709A (zh) * 2022-03-31 2022-06-17 苏州浪潮智能科技有限公司 一种边缘节点的处理方法、装置及介质
CN114816345A (zh) * 2022-04-01 2022-07-29 上海孪影科技有限公司 一种用于边缘智能管理平台的分析模型一键下发的方法
CN115002514A (zh) * 2022-05-27 2022-09-02 浙江大学 基于云原生控制器的spark视频转码系统及视频转码方法
CN116089027A (zh) * 2022-06-14 2023-05-09 浙江保融科技股份有限公司 一种基于jvm的非阻塞分布式计划任务调度方法
CN116166343A (zh) * 2022-12-23 2023-05-26 中国联合网络通信集团有限公司 一种集群进程编排方法、系统、装置及介质
CN116204287A (zh) * 2023-01-10 2023-06-02 上海申挚医疗科技有限公司 用于ngs生信分析流程的算法调度装置及调度方法
CN116483394A (zh) * 2023-04-26 2023-07-25 北京远舢智能科技有限公司 一种基于容器的Kubernetes离线安装方法及装置
US12248810B2 (en) 2022-06-15 2025-03-11 International Business Machines Corporation Automatically orchestrating a computerized workflow
CN119960916A (zh) * 2025-01-24 2025-05-09 北京林业大学 基于可弹性伸缩分布式负载均衡的容器镜像扫描方法及系统
CN120087357A (zh) * 2025-05-06 2025-06-03 山东浪潮科学研究院有限公司 一种rag多模态文档解析方法、设备及介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111782370B (zh) * 2020-06-30 2022-12-06 平安科技(深圳)有限公司 一种kubernetes多集群管理系统、方法、终端及存储介质
CN112241314B (zh) * 2020-10-29 2022-08-09 浪潮通用软件有限公司 多Kubernetes集群管理方法、装置和可读介质
CN113094164B (zh) * 2021-04-27 2024-07-12 上海商汤科技开发有限公司 一种任务处理装置、方法、计算机设备及存储介质
CN113485792B (zh) * 2021-07-08 2023-05-26 厦门服云信息科技有限公司 一种kubernetes集群内Pod调度方法、终端设备及存储介质
CN114237858A (zh) * 2022-02-22 2022-03-25 北京云歌科技有限责任公司 一种基于多集群网络的任务调度方法及系统
CN116009898A (zh) * 2022-12-29 2023-04-25 网易(杭州)网络有限公司 K8s部署任务的状态确定方法、装置、设备及介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109067828A (zh) * 2018-06-22 2018-12-21 杭州才云科技有限公司 基于Kubernetes和OpenStack容器云平台多集群构建方法、介质、设备
CN109842642A (zh) * 2017-11-24 2019-06-04 中兴通讯股份有限公司 一种容器化集群系统的部署方法及装置、容器化集群系统
US20190391844A1 (en) * 2018-11-06 2019-12-26 Beijing Baidu Netcom Science And Technology Co., Ltd. Task orchestration method and system
CN110673935A (zh) * 2019-08-23 2020-01-10 苏州浪潮智能科技有限公司 一种基于Kubernetes系统的作业调度方法、设备以及存储介质
CN110780998A (zh) * 2019-09-29 2020-02-11 武汉大学 基于Kubernetes的动态负载均衡资源调度方法
CN111782370A (zh) * 2020-06-30 2020-10-16 平安科技(深圳)有限公司 一种kubernetes多集群管理系统、方法、终端及存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108809722B (zh) * 2018-06-13 2022-03-22 郑州云海信息技术有限公司 一种部署Kubernetes集群的方法、装置和存储介质
US11329885B2 (en) * 2018-06-21 2022-05-10 International Business Machines Corporation Cluster creation using self-aware, self-joining cluster nodes
US10389704B1 (en) * 2018-09-12 2019-08-20 Cohesity, Inc. Cluster claim
CN110389836A (zh) * 2019-07-17 2019-10-29 腾讯科技(深圳)有限公司 一种多集群管理方法、装置、服务器及存储介质
CN110531987A (zh) * 2019-07-30 2019-12-03 平安科技(深圳)有限公司 基于Kubernetes集群的管理方法、装置及计算机可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109842642A (zh) * 2017-11-24 2019-06-04 中兴通讯股份有限公司 一种容器化集群系统的部署方法及装置、容器化集群系统
CN109067828A (zh) * 2018-06-22 2018-12-21 杭州才云科技有限公司 基于Kubernetes和OpenStack容器云平台多集群构建方法、介质、设备
US20190391844A1 (en) * 2018-11-06 2019-12-26 Beijing Baidu Netcom Science And Technology Co., Ltd. Task orchestration method and system
CN110673935A (zh) * 2019-08-23 2020-01-10 苏州浪潮智能科技有限公司 一种基于Kubernetes系统的作业调度方法、设备以及存储介质
CN110780998A (zh) * 2019-09-29 2020-02-11 武汉大学 基于Kubernetes的动态负载均衡资源调度方法
CN111782370A (zh) * 2020-06-30 2020-10-16 平安科技(深圳)有限公司 一种kubernetes多集群管理系统、方法、终端及存储介质

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377030A (zh) * 2021-08-12 2021-09-10 腾讯科技(深圳)有限公司 一种路口信号控制模型的确定方法和相关装置
CN113377030B (zh) * 2021-08-12 2021-10-29 腾讯科技(深圳)有限公司 一种路口信号控制模型的确定方法和相关装置
CN113742033A (zh) * 2021-09-08 2021-12-03 广西东信数建信息科技有限公司 一种kubernetes集群联邦系统及其实现方法
CN114064205A (zh) * 2021-10-30 2022-02-18 郑州云海信息技术有限公司 一种应用组件调度的方法、系统、存储介质及设备
CN114048011A (zh) * 2021-11-04 2022-02-15 安徽博微广成信息科技有限公司 多任务处理方法和系统
CN114217949A (zh) * 2021-11-05 2022-03-22 新浪网技术(中国)有限公司 一种面向应用的容器服务管理方法及系统
CN114116066A (zh) * 2021-11-30 2022-03-01 湖南麒麟信安科技股份有限公司 一种云平台集群控制方法、系统及存储介质
CN114116066B (zh) * 2021-11-30 2024-05-07 湖南麒麟信安科技股份有限公司 一种云平台集群控制方法、系统及存储介质
CN114461147A (zh) * 2022-01-28 2022-05-10 新浪网技术(中国)有限公司 一种为kubernetes集群提供不同存储类型的方法及系统
CN114564326A (zh) * 2022-02-14 2022-05-31 新浪网技术(中国)有限公司 一种对kubernetes集群的应用程序进行异常扫描的方法及系统
CN114546588A (zh) * 2022-02-15 2022-05-27 浙江大华技术股份有限公司 任务的部署方法、装置、存储介质及电子装置
CN114610502A (zh) * 2022-03-24 2022-06-10 阿里巴巴(中国)有限公司 应用工作负载调度方法以及装置
CN114610502B (zh) * 2022-03-24 2025-11-11 阿里巴巴(中国)有限公司 应用工作负载调度方法以及装置
CN114640709B (zh) * 2022-03-31 2023-07-25 苏州浪潮智能科技有限公司 一种边缘节点的处理方法、装置及介质
CN114640709A (zh) * 2022-03-31 2022-06-17 苏州浪潮智能科技有限公司 一种边缘节点的处理方法、装置及介质
CN114816345A (zh) * 2022-04-01 2022-07-29 上海孪影科技有限公司 一种用于边缘智能管理平台的分析模型一键下发的方法
CN115002514B (zh) * 2022-05-27 2023-07-21 浙江大学 基于云原生控制器的spark视频转码系统及视频转码方法
CN115002514A (zh) * 2022-05-27 2022-09-02 浙江大学 基于云原生控制器的spark视频转码系统及视频转码方法
CN116089027A (zh) * 2022-06-14 2023-05-09 浙江保融科技股份有限公司 一种基于jvm的非阻塞分布式计划任务调度方法
US12248810B2 (en) 2022-06-15 2025-03-11 International Business Machines Corporation Automatically orchestrating a computerized workflow
CN116166343A (zh) * 2022-12-23 2023-05-26 中国联合网络通信集团有限公司 一种集群进程编排方法、系统、装置及介质
CN116204287A (zh) * 2023-01-10 2023-06-02 上海申挚医疗科技有限公司 用于ngs生信分析流程的算法调度装置及调度方法
CN116483394A (zh) * 2023-04-26 2023-07-25 北京远舢智能科技有限公司 一种基于容器的Kubernetes离线安装方法及装置
CN119960916A (zh) * 2025-01-24 2025-05-09 北京林业大学 基于可弹性伸缩分布式负载均衡的容器镜像扫描方法及系统
CN120087357A (zh) * 2025-05-06 2025-06-03 山东浪潮科学研究院有限公司 一种rag多模态文档解析方法、设备及介质

Also Published As

Publication number Publication date
CN111782370A (zh) 2020-10-16
CN111782370B (zh) 2022-12-06

Similar Documents

Publication Publication Date Title
WO2021135545A1 (zh) 一种 kubernetes 多集群管理系统、方法、终端及存储介质
US11157304B2 (en) System for peering container clusters running on different container orchestration systems
US11221866B2 (en) Accelerator loading method, system, and apparatus
US11456914B2 (en) Implementing affinity and anti-affinity with KUBERNETES
CN116155978B (zh) 多注册中心适配方法、装置、电子设备及存储介质
CN105512083A (zh) 基于yarn的资源管理方法、装置及系统
CN109213571B (zh) 一种内存共享方法、容器管理平台及计算机可读存储介质
CN110719311B (zh) 分布式协调服务方法、系统及计算机可读存储介质
CN116805946B (zh) 一种消息请求处理方法、装置、电子设备及存储介质
WO2018191849A1 (zh) 云管理平台、虚拟机管理方法及其系统
JP2024512209A (ja) IoT機器に基づく情報処理方法、関連機器及び記憶媒体
CN114844911B (zh) 数据存储方法、装置、电子设备及计算机可读存储介质
CN111582824A (zh) 云资源同步方法、装置、设备及存储介质
US9106676B1 (en) Grid-based server messaging infrastructure
CN118708542A (zh) 文件系统的加速方法、装置、设备、存储介质及程序产品
CN111897667A (zh) 一种基于事件驱动和lua协程的异步通信方法及装置
CN114610439B (zh) 一种实现多cpu架构容器本地存储分布式复制的系统及方法
CN117076404A (zh) 混合大数据计算平台、计算方法、设备及存储介质
JP2024541872A (ja) コンテナ・エンジン及びコンテナ・エンジンの実現方法
CN103577264A (zh) 一种时间控制方法及系统
HK40030809B (zh) 一种kubernetes多集群管理系统、方法、终端及存储介质
HK40030809A (zh) 一种kubernetes多集群管理系统、方法、终端及存储介质
CN104980510A (zh) 一种corba分布式应用的透明集群化的方法
CN119496815B (zh) 基于AutosarAP平台动态加载服务的通道和实例的方法和装置
CN114860488B (zh) 容错方法、性能校验方法、电子设备及介质

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: 20908670

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20908670

Country of ref document: EP

Kind code of ref document: A1