WO2024016624A1 - 多集群访问方法和系统 - Google Patents

多集群访问方法和系统 Download PDF

Info

Publication number
WO2024016624A1
WO2024016624A1 PCT/CN2023/074093 CN2023074093W WO2024016624A1 WO 2024016624 A1 WO2024016624 A1 WO 2024016624A1 CN 2023074093 W CN2023074093 W CN 2023074093W WO 2024016624 A1 WO2024016624 A1 WO 2024016624A1
Authority
WO
WIPO (PCT)
Prior art keywords
cluster
pod
virtual
resources
sub
Prior art date
Application number
PCT/CN2023/074093
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 京东科技信息技术有限公司
Publication of WO2024016624A1 publication Critical patent/WO2024016624A1/zh

Links

Classifications

    • 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
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to a multi-cluster access method and system.
  • Ingress provides a collection of routing rules for requests entering the cluster.
  • k8s kubernetes cluster gateway solution
  • it can realize calls between services in the cluster, but multi-cluster access cannot be achieved using ingress.
  • a multi-cluster access method which includes: synchronizing resources between a main cluster and a sub-cluster; sending synchronized resource-related information to the data plane; receiving multiple virtual IP addresses fed back by the data plane; and Each resource is configured with a corresponding virtual IP address, where each virtual IP address corresponds to the access request of the cluster.
  • resource synchronization includes: using the cluster manager in the main cluster to interact with the cluster managers in each sub-cluster, obtaining the resources of each container instance pod in each sub-cluster, and synchronizing each container instance pod in the main cluster. The resources of the pod are synchronized to each sub-cluster.
  • resource synchronization also includes: storing the resources of each pod in a database, and saving the snapshot information corresponding to the resources of each pod in a user-defined resource CRD file.
  • configuring the corresponding virtual IP address includes: binding the snapshot information corresponding to the resources of each pod with a virtual IP address.
  • one or more operations of querying, creating, updating, and deleting CRD files are performed according to user instructions.
  • the virtual IP address of each pod is bound to the corresponding domain name.
  • load balancing rules are sent to the data plane, where virtual IP addresses are Generate information related to balancing rules and resources.
  • obtaining the resources of each pod in each sub-cluster includes: using the configmap method to obtain the kubeconfig file of each sub-cluster, where the clusterinfo crd in the kubeconfig file is used to store the configuration information of the corresponding cluster.
  • a multi-cluster access system including: a cluster manager configured to implement resource synchronization between a main cluster and a sub-cluster; and a load balancing controller configured to synchronize resources related to The information is sent to the data plane, receives multiple virtual IP addresses fed back by the data plane, and configures corresponding virtual IP addresses for each resource, where each virtual IP address corresponds to the access request of the cluster.
  • the cluster manager is configured to interact with the cluster manager in each sub-cluster, obtain the resources of each container instance pod in each sub-cluster, and synchronize the resources of each pod in the main cluster to in each subcluster.
  • the CRD file is configured to save snapshot information corresponding to the resources of each pod.
  • the load balancing controller is configured to bind the snapshot information corresponding to the resources of each pod with a virtual IP address.
  • the CRD file is subjected to one or more operations of querying, creating, updating, and deleting.
  • the global domain name system is configured to bind the virtual IP address of each pod to the corresponding domain name.
  • the load balancing controller is further configured to send the load balancing rule to the data plane, where the virtual IP address is generated based on the load balancing rule and related information of the resource.
  • the cluster manager is configured to use the configmap method to obtain the kubeconfig file of each sub-cluster, where the clusterinfo crd in the kubeconfig file is used to store the configuration information of the corresponding cluster.
  • a multi-cluster access system including: a memory; and a processor coupled to the memory, the processor being configured to execute the above-mentioned multi-cluster access method based on instructions stored in the memory.
  • a non-transitory computer-readable storage medium on which computer program instructions are stored, and when the instructions are executed by a processor, the above-mentioned multi-cluster access method is implemented.
  • a computer program including instructions that, when executed by a processor, cause the processor to perform the above-mentioned multi-cluster access method.
  • Figure 1 is a schematic flowchart of some embodiments of the multi-cluster access method of the present disclosure
  • Figure 2 is a schematic flowchart of other embodiments of the multi-cluster access method of the present disclosure.
  • Figure 3 is a schematic structural diagram of some embodiments of the multi-cluster access system of the present disclosure.
  • Figure 4 is a schematic structural diagram of other embodiments of the multi-cluster access system of the present disclosure.
  • Figure 5 is a schematic structural diagram of other embodiments of the multi-cluster access system of the present disclosure.
  • Figure 6 is a schematic structural diagram of other embodiments of the multi-cluster access system of the present disclosure.
  • any specific values are to be construed as illustrative only and not as limiting. Accordingly, other examples of the exemplary embodiments may have different values.
  • FIG. 1 is a schematic flowchart of some embodiments of the multi-cluster access method of the present disclosure. This embodiment is executed by the control plane.
  • step 110 the main cluster and the sub-cluster perform resource synchronization.
  • resource synchronization between the main cluster and sub-clusters can be achieved using a cluster manager located in the main cluster, and the main cluster can obtain resource information of each pod (container instance) in each sub-cluster.
  • the resources of each pod are stored in a database, and the snapshot information corresponding to the resources of each pod is saved in a CRD file.
  • step 120 the relevant information of the synchronized resources is sent to the data plane.
  • the load balancing controller monitors the snapshot information of each pod in the CRD file, and the pod's snapshot information is synchronized to the data plane.
  • the load balancing controller synchronizes the load balancing rule information stored in the CRD file to the data plane.
  • step 130 multiple virtual IP addresses fed back from the data plane are received.
  • the data plane generates multiple virtual IP addresses based on load balancing rules and snapshot information of each pod, and sends the virtual IP addresses to the load balancing controller.
  • step 140 a corresponding virtual IP address is configured for each resource, where each virtual IP address corresponds to an access request of the cluster.
  • the data plane can send the access request to the pod of the corresponding cluster based on the virtual IP address.
  • control plane synchronizes the resources of the main cluster and the sub-cluster, and sends the relevant information of the synchronized resources to the data plane.
  • the data plane generates multiple virtual IP addresses, and each resource is configured with a corresponding virtual IP. After obtaining the address, the data plane can forward the access request to the corresponding cluster, thereby solving the multi-cluster access problem.
  • Figure 2 is a schematic flowchart of other embodiments of the multi-cluster access method of the present disclosure.
  • step 210 use the cluster manager to synchronize resources between the main cluster and the sub-cluster.
  • the cluster manager in order to achieve global load balancing, the ability to collect multiple cluster containers is required.
  • the cluster manager can solve the problem of multi-cluster pod collection. For example, profit Use the cluster manager in the main cluster to interact with the cluster managers in each sub-cluster, obtain the resources of each pod in each sub-cluster, and synchronize the resources of each pod in the main cluster to each sub-cluster. In this way, the sub-cluster can also obtain the pod resources of other clusters.
  • the cluster manager uses the configmap method to obtain the kubeconfig file of each sub-cluster, where the clusterinfo crd in the kubeconfig file is used to store the configuration information of the corresponding cluster.
  • the CRD controller located in the main cluster generates a synchronized cluster manager pod based on the cluster information to synchronize resources with the sub-cluster.
  • the cluster manager uses the mount confgmap method to obtain the kubeconfig configuration information and use it through k8s
  • the locking method implements multiple pod master-slave backup mode.
  • configmap can implement configuration management of applications in containers;
  • the kubeconfig file is a k8s api server (application programming interface server) authentication file, which contains cluster, user, namespace (namespace) and authentication mechanism information;
  • spec .config stores the configuration files of the main cluster and sub-clusters.
  • step 220 the cluster manager stores the resources of each pod in the database and saves the snapshot information corresponding to the resources of each pod in the CRD file.
  • the pod resources are stored in the database, and the snapshot information corresponding to each pod resource is saved in the CRD file. Each pod information can be found by querying the CRD, which can reduce the storage pressure of the main cluster etcd.
  • load balancing rule information is also stored in the CRD file.
  • a four-layer load balancing CRD file, or L4CRD file, and a seven-layer load balancing CRD file, or L7CRD file are used in the main cluster to record the relationship between resources and load balancing in the cluster.
  • the federalEndpoint (federal endpoint) CRD file in the main cluster is responsible for recording sub-cluster pods.
  • the cluster manager when processing L4CRD files and L7CRD files, the cluster manager will create services in the sub-cluster and bind Endpoint information to federalEnpoin.
  • CRD files can be queried, created, updated, or deleted based on user instructions. That is to realize the query, creation, update and deletion of multi-cluster resources.
  • step 230 the load balancing controller sends the load balancing rule information stored in the CRD file and the snapshot information corresponding to the resources of each pod to the data plane.
  • step 240 the data plane generates multiple virtual IP addresses and feeds back the multiple virtual IP addresses to the load balancing controller.
  • the data plane generates multiple virtual IP addresses based on the load balancing rule information and the snapshot information corresponding to the resources of each pod, and feeds the multiple virtual IP addresses back to the load balancing controller.
  • step 250 the load balancing controller binds the snapshot information corresponding to the resources of each pod with a virtual IP address.
  • step 260 after receiving the access request, the data plane forwards the access request to the pod of the corresponding cluster according to the IP address.
  • the load balancing controller obtains the backend IP address through the federalEndpoint of the main cluster, obtains the load balancing rules from L4CRD and L7CRD, and binds the virtual IP address obtained from the data plane to L4CRD and L7CRD, thereby being able to distinguish public Internet IP and private IP.
  • kubernetes serves as a docker (container) scheduling solution to provide users with a good cloud service experience
  • the load balancing controller as an important component of kubernetes, provides users with a proxy means to access pods.
  • the docker IP address is fed back from the data plane, and the load balancing controller saves the corresponding relationship between the pod and the virtual IP address in the CRD file, which can simplify access services.
  • GDNS Global Domain Name System binds the virtual IP address of each pod to the corresponding domain name.
  • GDNS obtains the virtual IP address of each pod from the CRD file and binds it to the corresponding domain name, so that the data plane can forward access requests to the pods in the corresponding cluster based on the domain name.
  • out-of-cluster load balancing can mount ingresses of multiple clusters, but it requires two load balancing steps to reach the business container, and the traffic cannot be evenly distributed.
  • the access request can directly reach the pod of the corresponding cluster.
  • the main cluster obtains the information of each pod in the sub-cluster and sends each pod information to the data plane through the load balancing controller.
  • the data plane generates a virtual IP address
  • the load balancing controller configures a virtual IP for each pod. address, thereby enabling access to pods in multiple clusters. This process does not intrude on sub-clusters, and provides a unified access method to the management end, shielding underlying differences. No matter which management end the access request comes from, this disclosure can smoothly dock sub-clusters. Cluster to achieve load balancing.
  • FIG. 3 is a schematic structural diagram of some embodiments of the multi-cluster access system of the present disclosure.
  • the system includes a cluster manager 310 and a load balancing controller 310.
  • the cluster manager 310 and the load balancing controller 310 are located on the main cluster side.
  • the cluster manager 310 is configured to synchronize resources between the main cluster and the sub-clusters.
  • the cluster manager 310 located in the main cluster is configured to interact with the cluster managers in each sub-cluster, obtain the resources of each container instance pod in each sub-cluster, and transfer each pod in the main cluster to The resources are synchronized to each sub-cluster.
  • the cluster manager 310 is configured to use the configmap method to obtain the kubeconfig file of each sub-cluster, where the clusterinfo crd in the kubeconfig file is used to store the configuration information of the corresponding cluster.
  • the system also includes a CRD file 410 configured to save snapshot information corresponding to the resources of each pod.
  • the cluster manager 310 stores the resources of each pod in a database, and saves the snapshot information corresponding to the resources of each pod in the CRD file 410 .
  • the CRD file 410 also stores load balancing rule information.
  • the CRD file 410 is subjected to query, create, update and delete operations, etc.
  • the CRD file 410 is an L4CRD file or an L7CRD file.
  • the load balancing controller 320 is configured to send synchronized resource-related information to the data plane, receive multiple virtual IP addresses fed back by the data plane, and configure a corresponding virtual IP address for each resource, where each virtual IP address is related to Corresponds to cluster access requests.
  • the load balancing controller 320 sends the load balancing rule information stored in the CRD file and the snapshot information corresponding to the resources of each pod to the data plane.
  • the data plane generates multiple virtual IP addresses based on load balancing rules and resource related information, and feeds the multiple virtual IP addresses to the load balancing controller 320 .
  • the load balancing controller 320 is configured to bind the snapshot information corresponding to the resources of each pod with a virtual IP address. After the data plane receives the access request, it forwards the access request to the pod of the corresponding cluster based on the IP address.
  • the system also includes a global domain name system 420 configured to bind the virtual IP address of each pod to the corresponding domain name.
  • the data plane can forward the access request to the pod of the corresponding cluster based on the domain name.
  • the control plane synchronizes the resources of the main cluster and the sub-cluster, and sends the relevant information of the synchronized resources to the data plane.
  • the data plane generates multiple virtual IP addresses, and each resource is configured with a corresponding virtual IP. After obtaining the address, the data plane can forward the access request to the corresponding cluster, thus enabling multi-cluster access.
  • the present disclosure provides a unified access method for the management end, shielding the underlying differences. No matter which management end the access request comes from, it can smoothly connect to the sub-cluster and achieve load balancing.
  • the CRD controller generates synchronized clusters based on cluster information. manager pod. Administrators can create, update, and delete cluster managers. When the cluster manager processes L4CRD files and L7CRD files, it will create services in the sub-cluster and bind Endpoint information to federalEnpoin.
  • the API Server is responsible for communication between the functional modules of the cluster. Each functional module in the cluster stores information into etcd through the API Server.
  • CCM Cloud Provider Manager
  • CCM Cloud Provider Manager
  • cross-machine room/cross-region disaster recovery supports multiple deployment methods, such as gray release, canary release, a/b testing, etc., aiming at the differences of multi-cluster load balancing solutions and domain name servers.
  • this disclosure provides a unified access method to the management end, shields underlying differences, and can smoothly connect sub-cluster load balancing.
  • FIG. 6 is a schematic structural diagram of other embodiments of the multi-cluster access system of the present disclosure.
  • the system 600 includes a memory 610 and a processor 620.
  • the memory 610 may be a disk, flash memory or any other non-volatile storage medium.
  • the memory 610 is used to store instructions in the above embodiment.
  • Processor 620 is coupled to memory 610 and may be implemented as one or more integrated circuits, such as a microprocessor or microcontroller.
  • the processor 620 is used to execute instructions stored in the memory.
  • processor 620 is coupled to memory 610 via BUS bus 630 .
  • the system 600 can also be connected to an external storage device 650 through the storage interface 640 to call external data, and can also be connected to a network or another computer system (not shown) through the network interface 660, which will not be described in detail here.
  • multi-cluster access can be achieved by storing data instructions in the memory and then processing the above instructions by the processor.
  • a computer-readable storage medium has computer program instructions stored thereon, and when the instructions are executed by a processor, the steps of the methods in the above embodiments are implemented. It should be understood by those skilled in the art that embodiments of the present disclosure may be provided as methods, apparatuses, or computer program products. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk memory, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. .
  • These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
  • Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
  • a computer program including: instructions that, when executed by a processor, cause the processor to perform the multi-cluster access method as described above.

Abstract

本公开提供了一种多集群访问方法和系统,涉及计算机技术领域。该方法包括:主集群与子集群进行资源同步;将同步的资源的相关信息发送至数据面;接收数据面反馈的多个虚拟IP地址;以及为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。

Description

多集群访问方法和系统
相关申请的交叉引用
本申请是以CN申请号为202210847314.X,申请日为2022年7月19日的申请为基础,并主张其优先权,该CN申请的公开内容在此作为整体引入本申请中。
技术领域
本公开涉及计算机技术领域,尤其涉及一种多集群访问方法和系统。
背景技术
Ingress(入口)为进入集群的请求提供路由规则的集合,作为k8s(kubernetes)集群网关解决方案,能够实现集群内服务之间的调用,但利用ingress不能实现多集群访问。
发明内容
根据本公开一方面,提出一种多集群访问方法,包括:主集群与子集群进行资源同步;将同步的资源的相关信息发送至数据面;接收数据面反馈的多个虚拟IP地址;以及为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。
在一些实施例中,资源同步包括:利用主集群内的集群管理器与各个子集群内的集群管理器进行交互,获取各个子集群内每个容器实例pod的资源,以及将主集群中每个pod的资源同步到各个子集群中。
在一些实施例中,资源同步还包括:将每个pod的资源存储在数据库中,并在用户自定义资源CRD文件中保存每个pod的资源对应的快照信息。
在一些实施例中,配置对应的虚拟IP地址包括:将每个pod的资源对应的快照信息与一个虚拟IP地址进行绑定。
在一些实施例中,根据用户指令,执行查询、创建、更新和删除CRD文件中的一项或多项操作。
在一些实施例中,将各个pod的虚拟IP地址与对应的域名绑定。
在一些实施例中,将负载均衡规则发送至数据面,其中,虚拟IP地址基于负载均 衡规则和资源的相关信息生成。
在一些实施例中,获取各个子集群内每个pod的资源包括:利用configmap方式,获取每个子集群的kubeconfig文件,其中,kubeconfig文件中的clusterinfo crd用于存储对应的集群的配置信息。
根据本公开的另一方面,还提出一种多集群访问系统,包括:集群管理器,被配置实现主集群与子集群的资源同步;以及负载均衡控制器,被配置为将同步的资源的相关信息发送至数据面,接收数据面反馈的多个虚拟IP地址,为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。
在一些实施例中,集群管理器,被配置为与各个子集群内的集群管理器进行交互,获取各个子集群内每个容器实例pod的资源,以及将主集群中每个pod的资源同步到各个子集群中。
在一些实施例中,CRD文件,被配置为保存每个pod的资源对应的快照信息。
在一些实施例中,负载均衡控制器被配置为将每个pod的资源对应的快照信息与一个虚拟IP地址进行绑定。
在一些实施例中,根据用户指令,CRD文件被执行查询、创建、更新和删除中的一项或多项操作。
在一些实施例中,全局域名系统,被配置为将各个pod的虚拟IP地址与对应的域名绑定。
在一些实施例中,负载均衡控制器还被配置为将负载均衡规则发送至数据面,其中,虚拟IP地址基于负载均衡规则和资源的相关信息生成。
在一些实施例中,集群管理器,被配置为利用configmap方式,获取每个子集群的kubeconfig文件,其中,kubeconfig文件中的clusterinfo crd用于存储对应的集群的配置信息。
根据本公开的另一方面,还提出一种多集群访问系统,包括:存储器;以及耦接至存储器的处理器,处理器被配置为基于存储在存储器的指令执行如上述的多集群访问方法。
根据本公开的另一方面,还提出一种非瞬时性计算机可读存储介质,其上存储有计算机程序指令,该指令被处理器执行时实现上述的多集群访问方法。
根据本公开的另一方面,还提出一种计算机程序,包括:指令,所述指令当由处理器执行时使所述处理器执行上述的多集群访问方法。
通过以下参照附图对本公开的示例性实施例的详细描述,本公开的其它特征及其优点将会变得清楚。
附图说明
构成说明书的一部分的附图描述了本公开的实施例,并且连同说明书一起用于解释本公开的原理。
参照附图,根据下面的详细描述,可以更加清楚地理解本公开,其中:
图1为本公开的多集群访问方法的一些实施例的流程示意图;
图2为本公开的多集群访问方法的另一些实施例的流程示意图;
图3为本公开的多集群访问系统的一些实施例的结构示意图;
图4为本公开的多集群访问系统的另一些实施例的结构示意图;
图5为本公开的多集群访问系统的另一些实施例的结构示意图;以及
图6为本公开的多集群访问系统的另一些实施例的结构示意图。
具体实施方式
现在将参照附图来详细描述本公开的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本公开的范围。
同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。
以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本公开及其应用或使用的任何限制。
对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为授权说明书的一部分。
在这里示出和讨论的所有示例中,任何具体值应被解释为仅仅是示例性的,而不是作为限制。因此,示例性实施例的其它示例可以具有不同的值。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。
为使本公开的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本公开进一步详细说明。
需要说明的是,本公开的技术方案中,所涉及的用户个人信息的收集、使用、保存、共享和转移等处理,均符合相关法律法规的规定,且需要告知用户并获得用户的同意或授权,当适用时,对用户个人信息进行了去标识化和/或匿名化和/或加密的技术处理。
图1为本公开的多集群访问方法的一些实施例的流程示意图,该实施例由控制面执行。
在步骤110,主集群与子集群进行资源同步。
在一些实施例中,利用位于主集群内的集群管理器,能够实现主集群与子集群之间的资源同步,主集群能够获得各个子集群内每个pod(容器实例)的资源信息。
在一些实施例中,将每个pod的资源存储在数据库中,并在CRD文件中保存每个pod的资源对应的快照信息。
在步骤120,将同步的资源的相关信息发送至数据面。
在一些实施例中,负载均衡控制器监控CRD文件中的每个pod的快照信息,并pod的快照信息将同步至数据面。
在一些实施例中,负载均衡控制器将CRD文件中存储的负载均衡规则信息同步至数据面。
在步骤130,接收数据面反馈的多个虚拟IP地址。
在一些实施例中,数据面根据负载均衡规则和每个pod的快照信息,生成多个虚拟IP地址,并将虚拟IP地址发送至负载均衡控制器。
在步骤140,为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。
在一些实施例中,用户向数据面发送访问请求后,数据面能够基于虚拟IP地址,将访问请求发送至对应集群的pod。
在上述实施例中,控制面通过主集群与子集群的资源同步,并将同步的资源的相关信息被发送至数据面,由数据面生成多个虚拟IP地址,每个资源配置对应的虚拟IP地址后,数据面能够将访问请求转发至对应的集群,从而解决了多集群的访问问题。
图2为本公开的多集群访问方法的另一些实施例的流程示意图。
在步骤210,利用集群管理器,实现主集群与子集群同步资源。
在一些实施例中,为了实现全局负载均衡,需要收集多个集群容器的能力。集群管理器(cluster manager)作为核心组件,能够解决多集群pod采集问题。例如,利 用主集群内的集群管理器与各个子集群内的集群管理器进行交互,获取各个子集群内每个pod的资源,以及将主集群中每个pod的资源同步到各个子集群中。这样,子集群中也能够获得其他集群的pod资源。
在一些实施例中,集群管理器利用configmap方式,获取每个子集群的kubeconfig文件,其中,kubeconfig文件中的clusterinfo crd用于存储对应的集群的配置信息。
在一些实施例中,位于主集群的CRD控制器根据集群信息,生成同步的集群管理器pod,用于跟子集群同步资源,集群管理器采用挂载confgmap方式,获取kubeconfig配置信息,并通过k8s加锁方式实现多个pod主从备份模式。
在一些实施例中,configmap能够实现对容器中应用的配置管理;kubeconfig文件是k8s api server(应用程序编程接口服务器)认证文件,包含了集群、用户、namespace(命名空间)和认证机制信息;spec.config:存储主集群和子集群的配置文件。
在步骤220,集群管理器将每个pod的资源存储在数据库中,并在CRD文件中保存每个pod的资源对应的快照信息。
单个pod与多集群进行数据交互时,若数据量大,例如,集群数据量大,则etcd(分布式键值存储系统)支持大数据存储的性能也会下降。该实施例中,将pod的资源存储在数据库中,并在CRD文件中保存每个pod的资源对应的快照信息,通过查询CRD能够找到各个pod信息,能够减少主集群etcd存储压力。
在一些实施例中,CRD文件中还存储有负载均衡规则信息。
在一些实施例中,在主集群中采用四层负载均衡CRD文件,即L4CRD文件,以及七层负载均衡CRD文件,即L7CRD文件来记录集群内的资源与负载均衡的关系。主集群中的federalEndpoint(联邦端点)CRD文件负责记录子集群pod。
在一些实施例中,集群管理器在处理L4CRD文件和L7CRD文件时,会在子集群创建服务,并将Endpoint信息绑定到federalEnpoin。
在一些实施例中,根据用户指令,能够查询、创建、更新或删除CRD文件。即实现多集群资源的查询、创建、更新和删除。
在步骤230,负载均衡控制器将CRD文件中存储的负载均衡规则信息,以及各个pod的资源对应的快照信息发送至数据面。
在步骤240,数据面生成多个虚拟IP地址,并将多个虚拟IP地址反馈至负载均衡控制器。
在一些实施例中,数据面根据负载均衡规则信息,以及各个pod的资源对应的快照信息,生成多个虚拟IP地址,并将多个虚拟IP地址反馈至负载均衡控制器。
在步骤250,负载均衡控制器将每个pod的资源对应的快照信息与一个虚拟IP地址进行绑定。
在步骤260,数据面接收到访问请求后,根据IP地址,将访问请求转发至对应集群的pod。
在一些实施例中,负载均衡控制器通过主集群的federalEndpoint获得后端IP地址,从L4CRD和L7CRD中获得负载均衡规则,将数据面获得的虚拟IP地址绑定到L4CRD和L7CRD,从而能够区分公网IP和私网IP。
在一些实施例中,kubernetes作为docker(容器)调度方案,为用户提供很好的云服务的体验,负载均衡控制器作为kubernetes重要的组件为用户提供访问pod的代理手段。但docker IP地址变化会造成业务使用不方便问题。该实施例中,由数据面反馈虚拟IP地址,负载均衡控制器将pod和虚拟IP地址的对应关系保存在CRD文件中,能够简化访问业务。
在一些实施例中,GDNS(Global Domain Name System,全局域名系统)将各个pod的虚拟IP地址与对应的域名绑定。
例如,GDNS从CRD文件中获取每个pod的虚拟IP地址,并与对应的域名进行绑定,从而使得数据面能够根据域名,将访问请求转发至对应集群的pod。
相关技术中,集群外负载均衡,虽然能够挂载多个集群的ingress,但需经过两次负载均衡才能达到业务容器,流量无法达到均分。该实施例中,访问请求能够直接到达对应集群的pod。
在上述实施例中,主集群获取子集群内各pod信息,并通过负载均衡控制器将每个pod信息发送至数据面,数据面生成虚拟IP地址,负载均衡控制器为每个pod配置虚拟IP地址,从而能够实现多集群内pod的访问,该过程对子集群没有侵入,并且对管理端提供了统一接入方式,屏蔽底层差异,无论访问请求来自哪个管理端,本公开均能够平滑对接子集群,实现负载均衡。
图3为本公开的多集群访问系统的一些实施例的结构示意图,该系统包括集群管理器310和负载均衡控制器310,集群管理器310和负载均衡控制器310位于主集群侧。
集群管理器310被配置实现主集群与子集群的资源同步。
在一些实施例中,位于主集群的集群管理器310被配置为与各个子集群内的集群管理器进行交互,获取各个子集群内每个容器实例pod的资源,以及将主集群中每个pod的资源同步到各个子集群中。
在一些实施例中,集群管理器310被配置为利用configmap方式,获取每个子集群的kubeconfig文件,其中,kubeconfig文件中的clusterinfo crd用于存储对应的集群的配置信息。
在一些实施例中,如图4所示,该系统还包括CRD文件410,被配置为保存每个pod的资源对应的快照信息。例如,集群管理器310将每个pod的资源存储在数据库中,并在CRD文件410中保存每个pod的资源对应的快照信息。
在一些实施例中,CRD文件410中还存储有负载均衡规则信息。
在一些实施例中,根据用户指令,CRD文件410被执行查询、创建、更新和删除操作等。该CRD文件410为L4CRD文件或L7CRD文件。
负载均衡控制器320被配置为将同步的资源的相关信息发送至数据面,接收数据面反馈的多个虚拟IP地址,为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。
在一些实施例中,负载均衡控制器320将CRD文件中存储的负载均衡规则信息,以及各个pod的资源对应的快照信息发送至数据面。数据面基于负载均衡规则和资源的相关信息,生成多个虚拟IP地址,并将多个虚拟IP地址反馈至负载均衡控制器320。
在一些实施例中,负载均衡控制器320被配置为将每个pod的资源对应的快照信息与一个虚拟IP地址进行绑定。数据面接收到访问请求后,根据IP地址,将访问请求转发至对应集群的pod。
在本公开的另一些实施例中,该系统还包括全局域名系统420,被配置为将各个pod的虚拟IP地址与对应的域名绑定。数据面能够根据域名,将访问请求转发至对应集群的pod。
在上述实施例中,控制面实现主集群与子集群的资源同步,并将同步的资源的相关信息被发送至数据面,由数据面生成多个虚拟IP地址,每个资源配置对应的虚拟IP地址后,数据面能够将访问请求转发至对应的集群,从而能够实现了多集群的访问。另外,本公开对管理端提供了统一接入方式,屏蔽底层差异,无论访问请求来自哪个管理端,均能够平滑对接子集群,实现负载均衡。
在一些具体实施例中,如图5所示,CRD控制器根据集群信息,生成同步的集群 管理器pod。管理员能够创建、更新和删除集群管理器。集群管理器在处理L4CRD文件和L7CRD文件时,会在子集群创建服务,并将Endpoint信息绑定到federalEnpoin。API Server作为集群的核心,负责集群各功能模块之间的通信,集群内各个功能模块通过API Server将信息存入etcd。CCM(Cloud Provider Manager,云提供商管理器)为单集群的负载均衡器,实现负载均衡功能。
在kubernetes在推广过程中,跨机房/跨地域容灾,支持多种部署方式,例如灰色发布,金丝雀发布.a/b测试等,针对多集群负载均衡方案的差异性,以及域名服务器的差异性等业务场景,本公开对管理端提供统一接入方式,屏蔽了底层差异,能够平滑对接子集群负载均衡。
图6为本公开的多集群访问系统的另一些实施例的结构示意图。该系统600包括存储器610和处理器620。其中:存储器610可以是磁盘、闪存或其它任何非易失性存储介质。存储器610用于存储上实施例中的指令。处理器620耦接至存储器610,可以作为一个或多个集成电路来实施,例如微处理器或微控制器。该处理器620用于执行存储器中存储的指令。
在一些实施例中,处理器620通过BUS总线630耦合至存储器610。该系统600还可以通过存储接口640连接至外部存储装置650以便调用外部数据,还可以通过网络接口660连接至网络或者另外一台计算机系统(未标出),此处不再进行详细介绍。
在该实施例中,通过存储器存储数据指令,再通过处理器处理上述指令,能够实现多集群访问。
在另一些实施例中,一种计算机可读存储介质,其上存储有计算机程序指令,该指令被处理器执行时实现上述实施例中的方法的步骤。本领域内的技术人员应明白,本公开的实施例可提供为方法、装置、或计算机程序产品。因此,本公开可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用非瞬时性存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本公开是参照根据本公开实施例的方法、设备(系统)和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理 设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在本公开的一些实施例中,还提供了一种计算机程序,包括:指令,所述指令当由处理器执行时使所述处理器执行如前所述的多集群访问方法。
至此,已经详细描述了本公开。为了避免遮蔽本公开的构思,没有描述本领域所公知的一些细节。本领域技术人员根据上面的描述,完全可以明白如何实施这里公开的技术方案。
虽然已经通过示例对本公开的一些特定实施例进行了详细说明,但是本领域的技术人员应该理解,以上示例仅是为了进行说明,而不是为了限制本公开的范围。本领域的技术人员应该理解,可在不脱离本公开的范围和精神的情况下,对以上实施例进行修改。本公开的范围由所附权利要求来限定。

Claims (19)

  1. 一种多集群访问方法,包括:
    主集群与子集群进行资源同步;
    将同步的资源的相关信息发送至数据面;
    接收所述数据面反馈的多个虚拟IP地址;以及
    为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。
  2. 根据权利要求1所述的多集群访问方法,其中,资源同步包括:
    利用主集群内的集群管理器与各个子集群内的集群管理器进行交互,获取各个子集群内每个容器实例pod的资源,以及将所述主集群中每个pod的资源同步到各个子集群中。
  3. 根据权利要求2所述的多集群访问方法,其中,资源同步还包括:
    将每个pod的资源存储在数据库中,并在用户自定义资源CRD文件中保存每个pod的资源对应的快照信息。
  4. 根据权利要求3所述的多集群访问方法,其中,配置对应的虚拟IP地址包括:
    将每个pod的资源对应的快照信息与一个虚拟IP地址进行绑定。
  5. 根据权利要求3或4所述的多集群访问方法,其中,
    根据用户指令,执行查询、创建、更新和删除所述CRD文件中的一项或多项操作。
  6. 根据权利要求2至4任一所述的多集群访问方法,还包括:
    将各个pod的虚拟IP地址与对应的域名绑定。
  7. 根据权利要求1至4任一所述的多集群访问方法,还包括:
    将负载均衡规则发送至所述数据面,其中,所述虚拟IP地址基于所述负载均衡规 则和资源的相关信息生成。
  8. 根据权利要求2至4任一所述的多集群访问方法,其中,获取各个子集群内每个pod的资源包括:
    利用configmap方式,获取每个子集群的kubeconfig文件,其中,所述kubeconfig文件中的clusterinfo crd用于存储对应的集群的配置信息。
  9. 一种多集群访问系统,包括:
    集群管理器,被配置实现主集群与子集群的资源同步;以及
    负载均衡控制器,被配置为将同步的资源的相关信息发送至数据面,接收所述数据面反馈的多个虚拟IP地址,为每个资源配置对应的虚拟IP地址,其中,每个虚拟IP地址与集群的访问请求对应。
  10. 根据权利要求9所述的多集群访问系统,其中,
    所述集群管理器,被配置为与各个子集群内的集群管理器进行交互,获取各个子集群内每个容器实例pod的资源,以及将所述主集群中每个pod的资源同步到各个子集群中。
  11. 根据权利要求10所述的多集群访问系统,还包括:
    CRD文件,被配置为保存每个pod的资源对应的快照信息。
  12. 根据权利要求11所述的多集群访问系统,其中,
    所述负载均衡控制器被配置为将每个pod的资源对应的快照信息与一个虚拟IP地址进行绑定。
  13. 根据权利要求11或12所述的多集群访问系统,其中,
    根据用户指令,所述CRD文件被执行查询、创建、更新和删除中的一项或多项操作。
  14. 根据权利要求10至12任一所述的多集群访问系统,还包括:
    全局域名系统,被配置为将各个pod的虚拟IP地址与对应的域名绑定。
  15. 根据权利要求9至12任一所述的多集群访问系统,其中,
    所述负载均衡控制器还被配置为将负载均衡规则发送至所述数据面,其中,所述虚拟IP地址基于所述负载均衡规则和资源的相关信息生成。
  16. 根据权利要求10至12任一所述的多集群访问系统,其中,
    所述集群管理器,被配置为利用configmap方式,获取每个子集群的kubeconfig文件,其中,所述kubeconfig文件中的clusterinfo crd用于存储对应的集群的配置信息。
  17. 一种多集群访问系统,包括:
    存储器;以及
    耦接至所述存储器的处理器,所述处理器被配置为基于存储在所述存储器的指令执行如权利要求1至8任一项所述的多集群访问方法。
  18. 一种非瞬时性计算机可读存储介质,其上存储有计算机程序指令,该指令被处理器执行时实现权利要求1至8任一项所述的多集群访问方法。
  19. 一种计算机程序,包括:
    指令,所述指令当由处理器执行时使所述处理器执行根据权利要求1至8任一项所述的多集群访问方法。
PCT/CN2023/074093 2022-07-19 2023-02-01 多集群访问方法和系统 WO2024016624A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210847314.XA CN115150410A (zh) 2022-07-19 2022-07-19 多集群访问方法和系统
CN202210847314.X 2022-07-19

Publications (1)

Publication Number Publication Date
WO2024016624A1 true WO2024016624A1 (zh) 2024-01-25

Family

ID=83412007

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/074093 WO2024016624A1 (zh) 2022-07-19 2023-02-01 多集群访问方法和系统

Country Status (2)

Country Link
CN (1) CN115150410A (zh)
WO (1) WO2024016624A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150410A (zh) * 2022-07-19 2022-10-04 京东科技信息技术有限公司 多集群访问方法和系统
CN116033010A (zh) * 2023-02-16 2023-04-28 北京有竹居网络技术有限公司 远程访问方法、装置、电子设备及存储介质
CN116455911B (zh) * 2023-03-28 2024-03-22 安超云软件有限公司 一种异构集群互通方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110795503A (zh) * 2019-10-18 2020-02-14 北京达佳互联信息技术有限公司 分布式存储系统的多集群数据同步方法及相关装置
CN112003961A (zh) * 2020-08-14 2020-11-27 苏州浪潮智能科技有限公司 一种kubernetes中资源暴露方法、系统、设备以及介质
US20210258266A1 (en) * 2018-06-15 2021-08-19 Nec Corporation Orchestrating apparatus, vnfm apparatus, managing method and program
CN113742033A (zh) * 2021-09-08 2021-12-03 广西东信数建信息科技有限公司 一种kubernetes集群联邦系统及其实现方法
CN115150410A (zh) * 2022-07-19 2022-10-04 京东科技信息技术有限公司 多集群访问方法和系统

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7480737B2 (en) * 2002-10-25 2009-01-20 International Business Machines Corporation Technique for addressing a cluster of network servers
US7454489B2 (en) * 2003-07-01 2008-11-18 International Business Machines Corporation System and method for accessing clusters of servers from the internet network
US7930427B2 (en) * 2008-03-03 2011-04-19 Microsoft Corporation Client-side load balancing
US20110110377A1 (en) * 2009-11-06 2011-05-12 Microsoft Corporation Employing Overlays for Securing Connections Across Networks
CN109302498B (zh) * 2018-11-29 2021-03-23 杭州迪普科技股份有限公司 一种网络资源访问方法及装置
CN113572831B (zh) * 2021-07-21 2024-03-15 重庆星环人工智能科技研究院有限公司 Kubernetes集群间的通信方法、计算机设备及介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210258266A1 (en) * 2018-06-15 2021-08-19 Nec Corporation Orchestrating apparatus, vnfm apparatus, managing method and program
CN110795503A (zh) * 2019-10-18 2020-02-14 北京达佳互联信息技术有限公司 分布式存储系统的多集群数据同步方法及相关装置
CN112003961A (zh) * 2020-08-14 2020-11-27 苏州浪潮智能科技有限公司 一种kubernetes中资源暴露方法、系统、设备以及介质
CN113742033A (zh) * 2021-09-08 2021-12-03 广西东信数建信息科技有限公司 一种kubernetes集群联邦系统及其实现方法
CN115150410A (zh) * 2022-07-19 2022-10-04 京东科技信息技术有限公司 多集群访问方法和系统

Also Published As

Publication number Publication date
CN115150410A (zh) 2022-10-04

Similar Documents

Publication Publication Date Title
US11928029B2 (en) Backup of partitioned database tables
US10528390B2 (en) Idempotent task execution in on-demand network code execution systems
US20210081233A1 (en) Execution of auxiliary functions in an on-demand network code execution system
US11036591B2 (en) Restoring partitioned database tables from backup
US10817331B2 (en) Execution of auxiliary functions in an on-demand network code execution system
WO2024016624A1 (zh) 多集群访问方法和系统
US9553782B2 (en) Dynamically modifying quality of service levels for resources running in a networked computing environment
US9632878B1 (en) Verification of database table partitions during backup
US8769269B2 (en) Cloud data management
US11119813B1 (en) Mapreduce implementation using an on-demand network code execution system
JP7461471B2 (ja) クロス・クラウド・オペレーションのためのクラウド・サービス
US10678657B1 (en) Reversion operations for virtual computing environments
US10708379B1 (en) Dynamic proxy for databases
CN112714018B (zh) 基于网关的ElasticSearch搜索服务方法、系统、介质及终端
US20180324132A1 (en) System and method for automating actions in distributed computing
CN114281263B (zh) 容器集群管理系统的存储资源处理方法、系统和设备
US10785056B1 (en) Sharing a subnet of a logically isolated network between client accounts of a provider network
WO2020252724A1 (zh) 日志处理方法、设备及计算机可读存储介质
CN101789963A (zh) 数据同步系统
CN112035062B (zh) 云计算的本地存储的迁移方法、计算机设备及存储介质
US11258860B2 (en) System and method for bot detection and classification
US11157454B2 (en) Event-based synchronization in a file sharing environment
CN112910796A (zh) 流量管理方法、装置、设备、存储介质以及程序产品
US11900152B1 (en) Controlled automatic updates to disk image layers with compatibility verification
US20230418805A1 (en) Tenantification of database management systems

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

Country of ref document: EP

Kind code of ref document: A1