Cross-cluster application scheduling method and device based on K3s and computer equipment
By using the K3s-based cross-cluster application scheduling method in multi-cluster scenarios, the optimal target cluster is selected and scheduled according to the application's scheduling preferences, the problem of low scheduling efficiency in multi-cluster scenarios is solved, and the optimal allocation of resources and the improvement of application operation efficiency is achieved.
Patent Information
- Application Number
- CN202411782251.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-28
AI Technical Summary
In multi-cluster scenarios, the scheduling of application services requires manual configuration, resulting in low scheduling efficiency.
A cross-cluster application scheduling method based on K3s is proposed. When receiving application scheduling requests, the optimal target cluster is selected from multiple surviving working clusters according to the application scheduling preferences, and scheduled using pre-reported access configuration information.
It improves scheduling efficiency, realizes optimal allocation of resources, reduces scheduling delays and resource waste, provides flexible scheduling strategies, and improves application operation efficiency and user experience.
Smart Images

Figure CN119728680A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and in particular, relates to a cross-cluster application scheduling method, device and computer equipment based on K3s. Background Art
[0002] Kubernetes is an open source container automation operation platform that runs containers to deploy application services by clustering multiple hosts. K3s is a lightweight Kubernetes system that focuses more on application scenarios such as edge computing and the Internet of Things. Job scheduling in clusters in the K3s system is generally considered a difficult decision-making problem, and multi-cluster scenarios make the job scheduling problem more complicated. Currently, in multi-cluster scenarios, the scheduling of application services requires manual configuration to gradually complete the distribution and scheduling of applications between clusters, and the scheduling efficiency is low. Summary of the invention
[0003] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes a cross-cluster application scheduling method, device and computer equipment based on K3s to improve scheduling efficiency.
[0004] In a first aspect, the present application provides a cross-cluster application scheduling method based on K3s, the method comprising:
[0005] When receiving a scheduling request for a first target application, determining a first target cluster among a plurality of working clusters currently in a surviving state in the distributed working cluster according to a scheduling preference of the first target application;
[0006] The first target application is scheduled to the first target cluster according to the access configuration information pre-reported by the first target cluster to the centralized control cluster.
[0007] According to an embodiment of the present application, determining a first target cluster among the multiple working clusters currently in a surviving state in the distributed working cluster according to the scheduling preference of the first target application includes:
[0008] Determine multiple working clusters that are currently alive in the distributed working cluster by collecting heartbeat data of multiple working clusters in the distributed working cluster;
[0009] Screening out a plurality of candidate working clusters from the plurality of working clusters currently in a normal state according to the scheduling preference of the first target application;
[0010] The indicator data disclosed by the multiple candidate working clusters through the indicator exposure service are captured, and a first target cluster is determined from the multiple candidate working clusters according to the indicator data.
[0011] According to an embodiment of the present application, the indicator data of the working cluster includes resource usage data and network status data, and determining the first target cluster from the multiple candidate working clusters according to the indicator data includes:
[0012] Evaluate each of the candidate work clusters according to the resource usage data to obtain a first evaluation score corresponding to each of the candidate work clusters;
[0013] Evaluate each of the candidate working clusters according to the network status data to obtain a second evaluation score corresponding to each of the candidate working clusters;
[0014] A first target cluster is determined from the plurality of candidate working clusters based on the first evaluation score and the second evaluation score.
[0015] In a second aspect, the present application provides a cross-cluster application scheduling device based on K3s, the device comprising: a determination module, for determining, when receiving a scheduling request for a first target application, a first target cluster among a plurality of working clusters currently in a surviving state in the distributed working cluster according to a scheduling preference of the first target application;
[0016] The scheduling module is used to schedule the first target application to the first target cluster according to the access configuration information pre-reported by the first target cluster to the centralized control cluster.
[0017] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the cross-cluster application scheduling method based on K3s as described in the first aspect above is implemented.
[0018] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the cross-cluster application scheduling method based on K3s as described in the first aspect above is implemented.
[0019] In a fifth aspect, the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the cross-cluster application scheduling method based on K3s as described in the first aspect.
[0020] In a sixth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the K3s-based cross-cluster application scheduling method as described in the first aspect above.
[0021] The cross-cluster application scheduling method, apparatus, computer equipment, chip, non-transitory computer-readable storage medium and computer program product based on K3s provided in the present application, when receiving a scheduling request for a first target application, the first target cluster is determined according to the scheduling preference of the first target application among the multiple working clusters currently in a surviving state in the distributed working cluster, thereby screening out the working cluster that meets the conditions, and by screening out the optimal target cluster among the currently surviving working clusters, the cluster resources can be effectively utilized to avoid load concentration, and at the same time, the cluster is accurately selected according to the scheduling preference, which helps to reduce scheduling delays and resource waste, achieve optimal allocation of resources, and meet the personalized needs of applications for specific resources, thereby providing a flexible scheduling strategy and improving the operating efficiency and user experience of the application; according to the access configuration information pre-reported by the first target cluster to the centralized control cluster, the first target application is scheduled to the first target cluster, and through the pre-saved access configuration information, a connection with the target cluster can be quickly established and the issuance of scheduling instructions can be completed without manual configuration or additional operations, thereby improving the automation level of the scheduling process and simplifying the operation and maintenance work.
[0022] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0024] Figure 1 It is a schematic diagram of an application scenario of a cross-cluster application scheduling method based on K3s provided in some embodiments of the present application;
[0025] Figure 2 It is a flowchart of a cross-cluster application scheduling method based on K3s provided in some embodiments of the present application;
[0026] Figure 3 It is a flowchart of a cross-cluster application scheduling method based on K3s provided in some other embodiments of the present application;
[0027] Figure 4 is a flowchart of a cross-cluster application scheduling method based on K3s provided in some other embodiments of the present application;
[0028] Figure 5 It is a schematic diagram of the overall framework of a system based on K3s provided in some embodiments of the present application;
[0029] Figure 6is a schematic diagram of a self-organizing network process provided in some embodiments of the present application;
[0030] Figure 7 is a schematic diagram of the process of application installation and application uninstallation provided in some embodiments of the present application;
[0031] Figure 8 It is a structural diagram of a cross-cluster application scheduling device based on K3s provided in some embodiments of the present application;
[0032] Fig. 9 It is a schematic diagram of the structure of a computer device provided in some embodiments of the present application. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0034] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0035] In combination with the accompanying drawings, the K3s-based cross-cluster application scheduling method, the K3s-based cross-cluster application scheduling device, the computer device and the readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0036] Among them, the cross-cluster application scheduling method based on K3s can be applied to a terminal device or a server, and can be specifically executed by hardware or software in the terminal device or the server.
[0037] The cross-cluster application scheduling method based on K3s provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the centralized control cluster 102 is connected to multiple distributed working clusters 104 for communication. The centralized control cluster 102 and the multiple distributed working clusters 104 can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0038] The centralized control cluster is responsible for running the control program, and the distributed working cluster is responsible for providing a unified operating environment for the application. The multiple distributed working clusters 104 include multiple working clusters, each of which includes multiple working nodes, and each working node can be a computer device. The computer device can be a terminal device or a server.
[0039] The terminal device may be, but is not limited to, one or more of various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, or portable wearable devices, etc. The IoT device may be one or more of smart speakers, smart TVs, smart air conditioners, or smart vehicle-mounted devices, etc. The portable wearable device may be one or more of smart watches, smart bracelets, or head-mounted devices, etc.
[0040] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0041] In one embodiment, Figure 2 As shown, a cross-cluster application scheduling method based on K3s is provided, which can be applied to a centralized control cluster. The method includes the following steps:
[0042] Step 210: When a scheduling request for a first target application is received, a first target cluster is determined from among multiple working clusters currently in a surviving state in the distributed working cluster according to a scheduling preference of the first target application.
[0043] The target application is the application service to be scheduled. The centralized control cluster (hereinafter referred to as the control cluster) can receive a new application scheduling request, that is, a scheduling request of the first target application, according to the pre-configured application distribution service, and create an application deployment task. When the control cluster detects a new application deployment task through the application scheduling service deployed by it, the application scheduling process is started.
[0044] Specifically, the control cluster first determines whether each work cluster in the distributed work cluster is currently alive. The control cluster can detect whether each work cluster is currently alive through the heartbeat mechanism, and exclude inactive or overloaded work cluster nodes to ensure that the scheduled cluster nodes are stable and reliable.
[0045] In this application, the working cluster is installed with an ad hoc network client, and through the ad hoc network program provided by the ad hoc network service, the multicast DNS and DNS service discovery functions in the UDP zero-configuration network are used to automatically multicast to the network to discover the control cluster. When the control cluster responds, the control cluster address is returned, and the working node sends a heartbeat request to the control cluster according to the control cluster address. Once the heartbeat service program of the control cluster responds and enables the working node to establish a long heartbeat connection with the control cluster, the working node uploads the access configuration information of the working cluster to which it belongs to the control cluster, and periodically reports the heartbeat data.
[0046] After determining multiple surviving working clusters, the control cluster screens the multiple surviving working clusters according to the scheduling preference of the first target application, thereby determining the first target cluster to which the first target application will be deployed.
[0047] Among them, the scheduling preference is used to reflect one or more of the deployment rules such as affinity, anti-affinity and priority of the application service scheduled in the application deployment. The affinity rule indicates that the application service prefers to be deployed in a specific working cluster to obtain a better operating environment. The influencing factors include but are not limited to the node resource usage, geographical location, latency requirements, bandwidth restrictions, etc. For example, the affinity rule ensures that the application service is more likely to be scheduled to a working cluster with a specific label. Or, when the access between an application service and another application service is relatively frequent, the affinity rule makes the working cluster deployed by the application service as close as possible to the working cluster deployed by the other application service in terms of physical location. The anti-affinity rule is just the opposite. The priority rule is similar to the affinity rule, which also indicates which working cluster the application service prefers to be deployed in. The difference from the affinity rule is that the affinity rule is mandatory, while the priority rule is non-mandatory. The working cluster determined based on the priority rule may not be the working cluster where the application service is most inclined to be deployed, because factors such as cluster load and cluster capacity also need to be considered.
[0048] Step 220: Schedule the first target application to the first target cluster according to the access configuration information pre-reported by the first target cluster to the centralized control cluster.
[0049] After determining the first target cluster, the control cluster obtains the access configuration information of the first target cluster from the registration center. The access configuration information is a Kubeconfig (Kube configuration) file, including but not limited to the network address, access permissions, API port, etc. of the cluster, to ensure that the control cluster can communicate smoothly with the target cluster. After joining the control cluster, the working node will report the Kubeconfig file of the working cluster to which it belongs to the registration center. In this way, the control cluster can schedule the first target application to the first target cluster through the Kubeconfig file stored in the registration center and through the component.
[0050] The cross-cluster application scheduling method based on K3s provided in the present application, when receiving a scheduling request for a first target application, determines the first target cluster among the multiple working clusters currently in a surviving state in the distributed working cluster according to the scheduling preference of the first target application, thereby screening out the working cluster that meets the conditions, and by screening out the optimal target cluster among the currently surviving working clusters, it is possible to effectively utilize cluster resources and avoid load concentration. At the same time, accurately selecting clusters according to scheduling preferences helps to reduce scheduling delays and resource waste, achieve optimal allocation of resources, and meet the personalized needs of applications for specific resources, thereby providing flexible scheduling strategies and improving the operating efficiency and user experience of applications; according to the access configuration information pre-reported by the first target cluster to the centralized control cluster, the first target application is scheduled to the first target cluster, and through the pre-saved access configuration information, it is possible to quickly establish a connection with the target cluster and complete the issuance of scheduling instructions without manual configuration or additional operations, thereby improving the degree of automation of the scheduling process and simplifying operation and maintenance work.
[0051] In some embodiments, Figure 3 As shown, among the multiple working clusters currently in a surviving state in the distributed working cluster, determining the first target cluster according to the scheduling preference of the first target application includes:
[0052] Step 310: Determine multiple working clusters that are currently alive in the distributed working cluster by collecting heartbeat data of multiple working clusters in the distributed working cluster.
[0053] The control cluster is installed with a heartbeat service. By running the heartbeat service, the survival status of the working cluster is updated in real time, and the network status of the working cluster is determined based on the heartbeat status. If the heartbeat data of the working node is normal, the control cluster knows that the working node is running well and in normal status. If the heartbeat data of the working node is interrupted or delayed, the control cluster believes that there may be a problem with this component, such as network connection interruption or component crash, and then triggers the fault handling mechanism, such as restarting the service or migrating the task to other healthy nodes. In Kubernetes, the control cluster regularly checks whether each working node is running normally through the heartbeat mechanism. If a working node does not respond to the heartbeat data within the predetermined time, the control cluster will mark the working node as unavailable and reschedule the container running on the working node to other healthy working nodes. The heartbeat mechanism is a simple but very important detection method used to ensure that each working node in the distributed system is working properly. Once a working node or service loses contact, the control cluster can respond quickly, thereby improving the reliability and stability of the entire system.
[0054] Step 320: Filter out multiple candidate working clusters from multiple working clusters currently in a normal state according to the scheduling preference of the first target application.
[0055] Based on the collected surviving cluster information, the control cluster selects multiple working clusters that are currently in normal state according to the application's scheduling preference, and preliminarily selects multiple candidate working clusters. For example, if the scheduling preference requires low latency, the cluster close to the application request source is preferred; if sufficient resources are required, the cluster with lower resource load is selected. The control cluster can use Kubernetes' scheduling algorithm and custom scheduling plug-ins to implement these scheduling rules and select a list of candidate clusters that meet the requirements from the surviving clusters.
[0056] Step 330: Capture the indicator data disclosed by the multiple candidate working clusters through the indicator exposure service respectively, and determine the first target cluster from the multiple candidate working clusters according to the indicator data.
[0057] For the selected candidate clusters, the control cluster is pre-deployed with a monitoring service to monitor the status and performance of each working cluster unit in real time by capturing the indicators exposed by the working cluster. Accordingly, the working cluster is configured with an indicator exposure service to expose its own resource status and application operation status. The indicator data includes one or more of resource usage data and network status data. Resource usage data includes but is not limited to one or more of CPU utilization, memory usage, network bandwidth, disk I / O, etc. Network status data includes but is not limited to one or more of bandwidth, packet loss rate, latency, etc.
[0058] Therefore, the control cluster matches these indicator data with the performance requirements of the application, for example, giving priority to clusters with low resource utilization and sufficient network bandwidth, and finally determines a first target cluster that meets the application performance requirements and schedules the first target application to the first target cluster.
[0059] Through the above embodiments, by monitoring the heartbeat data and various performance indicators, the current best working cluster can be dynamically selected for application scheduling. This can avoid excessive concentration of resources, improve the resource utilization of the entire distributed cluster, and thus improve the operating efficiency and stability of the application. In addition, by regularly collecting heartbeat signals and screening out surviving clusters, the scheduling strategy can be adjusted in time when a cluster node fails or is abnormal, and the faulty node can be automatically skipped. This dynamic monitoring and scheduling method can ensure the high availability of the system and avoid application interruptions due to a single cluster failure. Furthermore, by combining scheduling preferences and real-time performance indicator data to select the target cluster, more accurate intelligent scheduling is achieved. Resource scheduling will be dynamically adjusted according to the actual needs of the application, which can effectively reduce resource waste and optimize the overall resource configuration of the distributed cluster. In a large distributed environment, the optimal cluster can be automatically screened out according to scheduling preferences and real-time performance indicators, which is conducive to supporting large-scale, multi-regional deployment application requirements, reducing network latency, and improving user experience.
[0060] In some embodiments, Figure 4 As shown, according to the indicator data, a first target cluster is determined from multiple candidate working clusters, including:
[0061] Step 410: Evaluate each candidate work cluster according to the resource usage data to obtain a first evaluation score corresponding to each candidate work cluster.
[0062] For each candidate work cluster, the control cluster captures the resource usage data exposed by each candidate work cluster through the indicator exposure service, including CPU load, memory usage, disk I / O, etc., and calculates the first evaluation score, which represents the resource health status of each candidate cluster. The score can be based on the set resource threshold or formula, for example: first evaluation score = (100-CPU usage) + (100-memory usage). For another example, the first evaluation score = 100-(current CPU usage + current memory usage) / 2, and so on. The higher the score, the lighter the resource load of the cluster, and the more suitable it is to receive new tasks.
[0063] Step 420: Evaluate each candidate working cluster according to the network status data to obtain a second evaluation score corresponding to each candidate working cluster.
[0064] The network status data evaluation mainly involves parameters such as network delay, bandwidth, packet loss rate, etc. of the candidate clusters. When evaluating the network status, the control cluster can consider the specific requirements of the application for the network status, such as low delay or high bandwidth requirements, and generate a "second evaluation score" for each candidate cluster through weighted scoring and other methods. For example: the scoring calculation method can be: second evaluation score = (100-delay) + (bandwidth). For another example, different weights can be set for each network status data to control the relative importance of network delay, bandwidth, packet loss rate, etc., and then divided by the total weight to achieve the final weighted average. The higher the score of the candidate cluster, the better the network conditions.
[0065] Step 430: Determine a first target cluster from a plurality of candidate working clusters based on the first evaluation score and the second evaluation score.
[0066] After obtaining the first evaluation score and the second evaluation score of the candidate cluster, the two scores can be weighted and integrated to select the best cluster that meets the application requirements and finally determine the first target cluster. For example:
[0067] Comprehensive score = α*first evaluation score + β*second evaluation score. α and β are adjustable parameters, indicating the relative importance of resources and network status. Therefore, the control cluster can use the candidate cluster with the highest comprehensive score as the target cluster for application scheduling, ensuring that the cluster's resources and network status meet application requirements and provide optimal performance support.
[0068] Through the above embodiments, the scheduling decision is made more accurate through the dual evaluation of resources and networks. Clusters with high resource health scores can better ensure the stable operation of applications, while superior network status reduces the delay and instability of data transmission. The final target cluster selection is based on the comprehensive score, which can maximize resource utilization and ensure that resources and network status match the needs of applications. In addition, the weights of resource and network status scores can be flexibly adjusted in different application scenarios. For example, for computing-intensive applications, the weight of resource scores can be increased, while the weight of network scores can be increased for real-time communication applications. In this way, the scheduling service can be intelligently adjusted according to the characteristics of specific applications, so that the system has stronger adaptability and flexibility in resource scheduling. Evaluating the resources and network status of candidate clusters and selecting the best cluster for scheduling can help distributed systems maintain service quality when the load increases. This scoring and dynamic evaluation mechanism can also be automatically extended to new working clusters, providing a reliable scheduling method for cluster expansion and cross-regional cluster deployment.
[0069] In some embodiments, the method also includes: when an uninstall request for a second target application is received, uninstalling the second target application from the second target cluster according to the access configuration information pre-reported by the second target cluster where the second target application is deployed; updating the access configuration information in the registration center, and updating the access configuration information at least includes: deleting the association relationship between the second target application and the second target cluster; when a configuration update is detected in the registration center through the configuration delivery service, delivering the updated access configuration information to the gateway programs installed in multiple working clusters that are currently in a surviving state in the distributed working cluster.
[0070] When the control cluster receives an uninstall request for the second target application, it obtains the access configuration information reported by the current second target cluster from the registration center. The access configuration information may include the network address, port, service name, etc. of the second target application in the cluster. The access configuration information may be stored in the database of the registration center and periodically synchronized to the registration center by the K3s Agent to ensure the real-time nature of the information.
[0071] According to the access configuration information, the control cluster can locate the specific cluster and node where the second target application is located, and call the API or command provided by K3s to uninstall the second target application from the second target cluster.
[0072] After the configuration in the registration center is updated, the configuration delivery service of the control cluster continuously monitors the configuration status. When an update is detected that the second target application has been deleted, the control cluster notifies all the working clusters currently in the distributed cluster that are alive through the configuration delivery service of the updated access configuration information. After the gateway program in the working cluster in the alive state receives the updated access configuration information, it automatically updates the local routing table or access configuration to ensure that the request is no longer forwarded to the uninstalled second target cluster, avoiding access to the invalid application and traffic routing.
[0073] Through the above embodiments, by dynamically uninstalling the application according to the request and immediately deleting the association record between the application and the cluster in the registration center, efficient resource recovery is achieved. Especially in the lightweight distributed cluster environment of K3s, by immediately uninstalling idle or no longer needed applications, resources can be effectively released and the overall resource utilization of the cluster can be improved. And by synchronously deleting the associated information of the uninstalled application in the registration center and quickly notifying all gateway programs of the configuration change, the system can ensure that the application will not be accessed by mistake after being uninstalled, thereby avoiding access anomalies or request failures caused by untimely configuration updates, and improving the stability of the system and service reliability. Furthermore, through automated uninstallation and configuration synchronization, the need for manual maintenance and updates is reduced. The operation and maintenance personnel only need to send an uninstall request, and the system can automatically complete the uninstallation, update and synchronization process, simplifying the application management process in the K3s cluster and reducing the operation and maintenance cost. This implementation method allows flexible uninstallation and updating of application configurations in a multi-cluster environment, supporting large-scale and dynamic cluster management requirements. By automatically detecting and synchronizing configuration changes, the system can adapt to the dynamic deployment and uninstallation of different applications in real time to achieve efficient distributed management.
[0074] In some embodiments, the method also includes: when receiving a multicast registration request sent by any working cluster by calling a self-organizing network service, returning a request response, the request response is used for the working cluster to stop multicast and report access configuration information to the registration center; obtaining the access configuration information reported by the working cluster, and storing it in the registration center; sending a heartbeat request to the working cluster, so that after the working cluster responds to the heartbeat request, the heartbeat data of the working cluster is periodically obtained; after the heartbeat data of the working cluster is not obtained within a preset time period, it is determined that the working cluster is in an unavailable state.
[0075] In this application, the new working cluster sends a multicast registration request to the control center by calling the self-organizing network service to announce its intention to join the cluster. The multicast registration request contains the preliminary connection information of the cluster, such as network address, port, node identifier, etc. After receiving the multicast registration request, the control center returns a request response to instruct the working cluster to stop multicasting to avoid repeated broadcasting and occupying bandwidth. At the same time, the response information contains the next step of the registration process (such as reporting the interface address of the access configuration information). After receiving the response from the control center, the working cluster reports its access configuration information to the registration center according to the instructions. The access configuration information includes detailed network parameters (such as IP address, port), resource status (such as CPU, memory), service interface, etc. of the cluster node. The control center receives and stores the configuration information through the registration center to provide dynamic cluster routing and service discovery support for other clusters or services. This information will be frequently referenced in subsequent cluster management and traffic forwarding.
[0076] In order to monitor the survival status of the working cluster in real time, the control center regularly sends heartbeat requests to the surviving working clusters. After receiving the heartbeat request, the working cluster responds according to the regulations and returns its current health data (including CPU, memory, network latency, disk usage, etc.).
[0077] The control center periodically obtains heartbeat data through heartbeat requests and records it in the registration center's database to monitor the status and resource conditions of each working cluster in real time.
[0078] Under the heartbeat mechanism, the control center sets a preset duration (such as 30 seconds or 60 seconds). If the heartbeat data of a working cluster is not received within this duration, the cluster is determined to be unavailable and marked as unavailable in the registration center. After marking unavailable, other clusters or services will no longer forward traffic to the cluster to avoid service anomalies caused by unavailable nodes.
[0079] Through the above embodiments, through the self-organizing network service of multicast registration, the new working cluster can be quickly added to the distributed cluster of K3s. The multicast mechanism simplifies the process of initial registration. The control center can automatically identify new clusters and assign registration paths without manual configuration, thereby improving the scalability of the system. The heartbeat mechanism helps to timely discover and isolate faulty nodes by monitoring the survival status of each working cluster in real time. When a cluster loses response, the system can quickly mark it as unavailable, thereby preventing traffic from being incorrectly routed to the faulty node and improving the stability of the overall service.
[0080] In some embodiments, the method further includes: when receiving access configuration information reported by any working cluster after joining the centralized control cluster by calling a self-organizing network service, installing a gateway program in the working cluster; the gateway program is used for calling between application services deployed by different working clusters.
[0081] When any working cluster successfully joins the control cluster through the self-organizing network service, it will automatically report its own access configuration information, including the cluster's IP address, node port, network bandwidth, load status, etc. After receiving the access configuration information, the registration center of the control cluster stores it in the database, and marks this cluster as "registered" to prepare to allocate the corresponding gateway service resources. After confirming that the working cluster has been registered, the control cluster automatically sends the installation task of the gateway program to the working cluster. The gateway program can be distributed and deployed using K3s integrated Helm or by directly calling the K3s API. Each working cluster is installed with the corresponding gateway program, and listens to cross-cluster call requests from other working clusters through the gateway program.
[0082] After installation, the gateway program initializes the cross-cluster routing configuration by reading the configuration information of the registration center. This configuration includes the network addresses and ports of other working clusters and the access paths of application services within each cluster. After initialization, the gateway program reports its own listening port, API path and other information to the registration center again, so that the gateway programs of other clusters can accurately obtain the call routing information.
[0083] In other words, the gateway program acts as a proxy between application services within each working cluster. Whenever an application service initiates a cross-cluster request, the request will be routed to the gateway program of its own cluster. The gateway program of its own cluster will forward the request to the gateway program of the target cluster according to the routing configuration provided by the registration center. The gateway program of the target cluster will then pass the request to the target application service within the cluster, and return the response data after processing, thus realizing cross-cluster intercommunication of application services.
[0084] Through the above-mentioned embodiments, the gateway program is installed in each working cluster and used as a transit point, which reduces the complexity of direct access across clusters. Through the standardized gateway routing method, the communication between clusters is clearer and more efficient, and the reliability of application service intercommunication is improved. In addition, cross-cluster calls are implemented through the gateway program, which avoids the cluster directly exposing the network addresses of all application services and reduces the security risks of cross-cluster calls. The gateway program can implement security mechanisms such as request filtering, authentication, and encryption to protect application services within the cluster from illegal access by external clusters. Furthermore, when the cluster is expanded or reduced, the gateway program dynamically updates the routing information through the configuration of the registration center, so that the new working cluster can be automatically added to the service call network without manually configuring the access path of each cluster. The scalability of the K3s cluster has been significantly enhanced.
[0085] In the embodiment of the present application, in the K3s environment, the component definition and deployment steps to implement the above processes and functions are as follows:
[0086] Deploy a centralized control cluster as the core management unit of the system. The control cluster runs the control program to manage the resources, status, scheduling and monitoring tasks of each working cluster. The control cluster is responsible for providing core services such as application scheduling, monitoring, configuration delivery, and application distribution to ensure the coordinated operation of the system.
[0087] Deploy multiple distributed work clusters, each of which acts as a separate task execution unit to provide a consistent operating environment for applications. These work cluster units are responsible for hosting specific application services, providing resources and isolation to ensure independent operation of applications, and supporting load distribution and task switching.
[0088] Deploy the self-organizing program to realize the automatic networking of the control cluster and the working cluster. The self-organizing server runs in the control cluster, while the self-organizing client runs on each node of the working cluster. The client uses the UDP zero configuration network (Zeroconf) protocol, including multicast DNS (mDNS) and DNS service discovery (DNS-SD), to send multicast requests through the local network card. The working cluster node parses the broadcast data from the control cluster through the role filtering function, identifies the address information of the control cluster, and sends a heartbeat request to the address. After the heartbeat service program of the control cluster responds, the working cluster node stops the multicast registration request and uploads its own access configuration information to the control cluster. The server registers the received heartbeat and configuration information into the system so that the status of each node can be monitored at any time.
[0089] The indicator exposure service of the deployed working cluster collects the resource usage (such as CPU, memory, etc.) and application running status of each working cluster in real time. The service periodically collects the status information of each cluster and supports the data pulling of the control cluster monitoring module for monitoring, scheduling and resource management.
[0090] Deploy a monitoring service for the control cluster to capture and analyze the resources and application metrics exposed in the working cluster. The monitoring service aggregates and analyzes data based on the resource usage of each working cluster (such as CPU, memory, network, storage, etc.) and provides real-time system performance status. This module provides support for application scheduling in the control cluster to ensure system reliability and stability, especially under high load conditions.
[0091] The application scheduling service of the configuration control cluster realizes the automatic orchestration and dynamic allocation of applications. The service dynamically adjusts the deployment location of applications based on factors such as application deployment preferences, working cluster resource utilization, heartbeat data, etc. The system automatically selects the most suitable working cluster to run the application, ensuring high availability and optimizing resource utilization.
[0092] Deploy the application distribution service of the control cluster and distribute tasks by managing the configuration files of different working clusters (such as kubeconfig). The application distribution service reads the configuration files of the working cluster and distributes the application tasks to the target working cluster to achieve efficient task distribution and management.
[0093] Set up a registration center to manage the registration information of all deployed applications and services. The registration center stores the association between applications and clusters and provides an interface for querying application status. It can support services such as configuration synchronization and load distribution, so that the gateways and application services of each working cluster maintain consistent routing information.
[0094] The configuration delivery service of the deployment control cluster detects data changes in the registration center in real time and is responsible for automatically delivering the updated configuration content to the surviving working cluster. This service ensures that the configuration is unified and updated in real time in the distributed cluster, and the gateway program in the working cluster can dynamically load the new configuration to support the latest service routing or configuration information.
[0095] A high-performance gateway is deployed in each distributed working cluster as a communication bridge between internal and external services in the cluster. The service request of the working cluster only needs to be forwarded to the gateway program of this cluster, which will handle the traffic forwarding task across clusters, support the intercommunication of services in different working clusters, and ensure safe and efficient data transmission. The gateway also monitors the service status and pushes abnormal events to the registration center in a timely manner for troubleshooting and automated recovery.
[0096] Through the definition and implementation of the above components, a unified and efficient K3s-based system for distributed application scheduling and management can be built, realizing automated cluster management, resource monitoring, application deployment and uninstallation, inter-service communication and configuration synchronization.
[0097] In a specific example, illustratively, Figure 5 As shown in the figure, the interaction between the control cluster and the working cluster includes but is not limited to application scheduling, configuration delivery, self-organizing network, and heartbeat reporting. The working cluster discovers the control cluster by calling the self-organizing network service and establishes a connection using multicast. The self-organizing network service helps each working cluster to automatically discover the control cluster and report its own information. After the working cluster establishes a connection with the self-organizing network service of the control cluster, it encrypts its access information and reports it to the registration center of the control cluster. The registration center records the information of each working cluster and provides basic data for the scheduling and management of applications. The monitoring service of the control cluster regularly captures the resource status of each working cluster (such as CPU, memory, application running status, etc.) to grasp the real-time resource utilization of each working cluster. This information is used for decision support for application scheduling. The application scheduling module of the control cluster uses the resource data provided by the monitoring service and the configuration information of the working cluster to determine the deployment location of the application according to the scheduling requirements of the task. The application scheduling module deploys the application to the most suitable working cluster according to the load of the working cluster, network status and application deployment preference.
[0098] When the registration center or application scheduling module in the control cluster has new configuration information, the configuration delivery service will distribute these updated configuration information to each working cluster, so that it can update the service routing and deployment information in real time. A high-performance gateway is deployed in the working cluster to handle communication requests between services. Application services in the working cluster (such as service A accessing service B) achieve cross-cluster communication through a high-performance gateway. The gateway is responsible for service traffic forwarding to ensure cross-cluster communication efficiency. The indicator exposure module is used to expose the resources and status information of the working cluster to the control cluster, helping the monitoring service to grasp the operation of each working cluster in real time and ensure that the system can automatically adjust resource allocation when the load increases. When a service needs to call a service in another working cluster, the service call traffic will be forwarded to the high-performance gateway of the cluster, and the gateway will perform cross-cluster communication operations to ensure the reliability and real-time performance of the service.
[0099] For example, Figure 6 As shown, the self-organizing network process of the working cluster may include:
[0100] (1) Control cluster initialization:
[0101] The control cluster initializes the configuration information delivery service, ad hoc network service and other necessary components to ensure that the control cluster can accept registration and heartbeat requests from the working cluster.
[0102] (2) The working cluster starts the self-organizing network service: The working cluster starts the edge end of the self-organizing network service and broadcasts a multicast request to the network to discover the existence of the control cluster.
[0103] (3) The control cluster processes broadcast messages: The control cluster receives broadcast messages from the working cluster, parses and identifies the source of the request, and prepares for the next step of interaction.
[0104] (4) Returning a service registration response: The control cluster returns a response to the working cluster, informing it that it can register the service. The response contains the necessary information of the control cluster, enabling the working cluster to locate the control cluster address.
[0105] (5) The working cluster registers and reports configuration information: After receiving the response from the control cluster, the working cluster registers the service and encrypts its own configuration information (such as key content such as kubeconfig) and reports it to the control cluster.
[0106] (6) Control cluster confirms registration: The control cluster receives the registration information of the working cluster, completes the registration process and confirms that the registration is successful.
[0107] (7) The working cluster starts the heartbeat mechanism: After successful registration, the working cluster begins to periodically send heartbeat signals to the control cluster to maintain a long connection and ensure that the control cluster can monitor the status of the working cluster in real time.
[0108] (8) The control cluster monitors the heartbeat of the working cluster: The control cluster continuously receives and monitors the heartbeat information of the working cluster. If the heartbeat signal is not received within the preset time, the control cluster will mark the working cluster as unavailable and trigger the corresponding fault handling process.
[0109] Therefore, through the self-organizing network broadcast, registration and heartbeat mechanism, the automatic discovery and status monitoring of the working cluster are realized. The control cluster can grasp the status of each working cluster in time and provide real-time support for application scheduling and resource management.
[0110] When the control cluster application distribution service receives a new application installation, it creates an application deployment task; when the application scheduling service detects a new application deployment task, it schedules it according to the following process:
[0111] (1) Screening based on application deployment affinity / anti-affinity / priority and other rules;
[0112] (2) Scoring based on the usage of working cluster resources (CPU / memory, etc.);
[0113] (3) Scoring based on the working cluster network situation;
[0114] Based on the above process, the working cluster with the highest score is selected as the deployment target cluster, and the application is deployed to the working cluster through the target set kubeconfig identity information. When the application is installed, the service information and the target working cluster address information are updated to the registration center.
[0115] When the control cluster application distribution service receives an application uninstall, it uninstalls the application through the target set kubeconfig identity information and updates the registration center data. When the gateway control program detects a change in the registration center data, it sends the latest service data to the gateway service where each working cluster is located. The gateway program periodically detects the running status of the local application and synchronizes it to the registration center in real time. Access between working cluster services can be achieved by sending data such as the target service name and service port to the gateway of this cluster, without knowing the specific cluster where the service is located. The remaining network forwarding work is performed by the gateway program based on the service registration information. The control cluster scheduling service detects that the application status is abnormal or the working cluster is offline, and reschedules the application to an available working cluster.
[0116] For example, Figure 7 As shown in the figure, the application deployment process between the control cluster and the working cluster includes:
[0117] Initialize control cluster components: Initialize other components in the control cluster (such as configuration delivery services, monitoring registration center events, etc.) to ensure that the system is in a ready state.
[0118] Create a new application deployment task: The control cluster receives an application distribution event, triggers the creation of a new application deployment task, and passes the task information to the scheduling service.
[0119] The scheduling service obtains the working cluster status: The scheduling service requests the self-organizing network program for information about all currently active working clusters and waits for a response.
[0120] The ad hoc networking program returns the status information of the working cluster for further processing by the scheduling service.
[0121] The monitoring service obtains the resource data of the working cluster: The scheduling service requests the monitoring service to obtain the resource status information of the working cluster (such as CPU, memory and other indicators) in order to evaluate the load of the current working cluster. The monitoring service regularly obtains and returns the resource indicator data of the working cluster.
[0122] Application scheduling and task allocation: The scheduling service selects the appropriate working cluster based on the resource data provided by the monitoring service, the status information of the ad hoc network program, and the scheduling preference of the application. After the deployment cluster is determined, the application deployment information is recorded in the registration center and the data of the registration center is updated.
[0123] Configuration is sent to the working cluster: After the configuration sending service detects that the registration center information is updated, it sends the latest configuration information to the specified working cluster. After the working cluster receives the configuration, the gateway program loads the new configuration to complete the application deployment.
[0124] Still Figure 7 As shown in the figure, the application uninstallation process between the control cluster and the working cluster includes:
[0125] Create a new application uninstallation task: The control cluster receives an application uninstallation request, triggers the creation of a new application uninstallation task, and passes the task information to the scheduling service.
[0126] The scheduling service confirms the target cluster for uninstallation: The scheduling service confirms the target working cluster for uninstalling the application based on the information recorded by the registration center.
[0127] Update the registry information: When the control cluster performs the uninstallation task, it deletes the information associated with the application from the registry to ensure that the status of the registry is updated synchronously.
[0128] Configuration is sent to the working cluster: The configuration sending service detects changes in the data information of the registration center and sends the updated configuration information to the working cluster in real time.
[0129] The gateway program of the working cluster hot updates the configuration according to the new configuration information and completes the application uninstallation operation.
[0130] Through the above process, the system realizes the automatic deployment and uninstallation of applications between working clusters. The registration center is responsible for recording the configuration information of all applications, and the configuration delivery service ensures the real-time synchronization of configuration information. The monitoring service and the self-organizing network program ensure the real-time update of the status information of the working cluster, and the scheduling service realizes flexible application scheduling management on this basis.
[0131] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0132] The cross-cluster application scheduling method based on K3s provided in the embodiment of the present application can be executed by a cross-cluster application scheduling device based on K3s. In the embodiment of the present application, the cross-cluster application scheduling method based on K3s is executed by a cross-cluster application scheduling device based on K3s as an example to illustrate the cross-cluster application scheduling method based on K3s provided in the embodiment of the present application. Figure 8 As shown, the cross-cluster application scheduling device based on K3s includes:
[0133] A determination module 810 is configured to, when receiving a scheduling request for a first target application, determine a first target cluster from among multiple working clusters currently in a surviving state in the distributed working cluster according to a scheduling preference of the first target application;
[0134] The scheduling module 820 is configured to schedule the first target application to the first target cluster according to the access configuration information pre-reported by the first target cluster to the centralized control cluster.
[0135] According to the K3s-based cross-cluster application scheduling device provided in the embodiment of the present application, when a scheduling request for a first target application is received, the first target cluster is determined according to the scheduling preference of the first target application among the multiple working clusters that are currently surviving in the distributed working cluster, thereby screening out the working cluster that meets the conditions. By screening out the optimal target cluster from the currently surviving working clusters, the cluster resources can be effectively utilized to avoid load concentration. At the same time, the cluster is accurately selected according to the scheduling preference, which helps to reduce scheduling delays and resource waste, achieve optimal allocation of resources, and meet the personalized needs of applications for specific resources, thereby providing a flexible scheduling strategy and improving the operating efficiency and user experience of the application. According to the access configuration information pre-reported by the first target cluster to the centralized control cluster, the first target application is scheduled to the first target cluster. Through the pre-saved access configuration information, a connection with the target cluster can be quickly established and the issuance of scheduling instructions can be completed without manual configuration or additional operations, thereby improving the degree of automation of the scheduling process and simplifying operation and maintenance work.
[0136] In some embodiments, the determination module is also used to determine multiple work clusters that are currently in a surviving state within the distributed work cluster by collecting heartbeat data of multiple work clusters within the distributed work cluster; screen out multiple candidate work clusters from multiple work clusters that are currently in a normal state according to the scheduling preference of the first target application; capture the indicator data of multiple candidate work clusters that are respectively exposed through the indicator exposure service, and determine the first target cluster from the multiple candidate work clusters based on the indicator data.
[0137] In some embodiments, the indicator data of the work cluster includes resource usage data and network status data. The determination module is also used to evaluate each candidate work cluster according to the resource usage data to obtain a first evaluation score corresponding to each candidate work cluster; evaluate each candidate work cluster according to the network status data to obtain a second evaluation score corresponding to each candidate work cluster; and determine a first target cluster from multiple candidate work clusters based on the first evaluation score and the second evaluation score.
[0138] In some embodiments, the above-mentioned device also includes an uninstallation module, which is used to uninstall the second target application from the second target cluster when an uninstallation request for the second target application is received, according to the access configuration information pre-reported by the second target cluster where the second target application is deployed; update the access configuration information in the registration center, and updating the access configuration information at least includes: deleting the association relationship between the second target application and the second target cluster; when the configuration update is monitored in the registration center through the configuration delivery service, the updated access configuration information is sent to the gateway programs installed in multiple working clusters that are currently in a surviving state in the distributed working cluster.
[0139] In some embodiments, the above-mentioned device also includes a self-organizing network module, which is used to return a request response when receiving a multicast registration request sent by any working cluster by calling a self-organizing network service, and the request response is used for the working cluster to stop multicast and report access configuration information to the registration center; obtain the access configuration information reported by the working cluster and store it to the registration center; send a heartbeat request to the working cluster, so that the working cluster responds to the heartbeat request, and periodically obtain the heartbeat data of the working cluster; after the heartbeat data of the working cluster is not obtained within a preset time, it is determined that the working cluster is in an unavailable state.
[0140] In some embodiments, the above-mentioned device also includes a gateway installation module, which is used to install a gateway program in the working cluster when receiving access configuration information reported by any working cluster after joining the centralized control cluster by calling the self-organizing network service; the gateway program is used for calling between application services deployed by different working clusters.
[0141] Each module in the above-mentioned cross-cluster application scheduling device based on K3s can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0142] The cross-cluster application scheduling device based on K3s in the embodiment of the present application can be a computer device, or a component in a computer device, such as an integrated circuit or a chip. The computer device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the computer device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted computer device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (AugmentedReality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (Ultra-mobile Personal Computer, UMPC), a netbook or a personal digital assistant (PersonalDigital Assistant, PDA), etc., and can also be a server, a network attached storage (Network AttachedStorage, NAS), a personal computer (Personal Computer, PC), a television (Television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0143] The cross-cluster application scheduling device based on K3s in the embodiment of the present application may be a device having an operating system. The operating system may be a Microsoft (Windows) operating system, an Android (Android) operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0144] The cross-cluster application scheduling device based on K3s provided in the embodiment of the present application can achieve Figures 2 to 4 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0145] In some embodiments, Fig. 9 As shown, an embodiment of the present application also provides a computer device 900, including a processor 901, a memory 902, and a computer program stored in the memory 902 and executable on the processor 901. When the program is executed by the processor 901, each process of the above-mentioned K3s-based cross-cluster application scheduling method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0146] It should be noted that the computer device in the embodiment of the present application includes the mobile computer device and the non-mobile computer device mentioned above.
[0147] An embodiment of the present application also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned K3s-based cross-cluster application scheduling method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0148] The processor is the processor in the computer device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0149] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned K3s-based cross-cluster application scheduling method when executed by a processor.
[0150] The processor is the processor in the computer device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0151] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned K3s-based cross-cluster application scheduling method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0152] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0153] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0154] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0155] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0156] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0157] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
Claims
1. A cross-cluster application scheduling method based on K3s, characterized in that: The method is applied to a centralized control cluster based on K3s, wherein the centralized control cluster includes a distributed working cluster of multiple working clusters, and the method includes: When receiving a scheduling request for a first target application, determining a first target cluster among a plurality of working clusters currently in a surviving state in the distributed working cluster according to a scheduling preference of the first target application; The first target application is scheduled to the first target cluster according to the access configuration information pre-reported by the first target cluster to the centralized control cluster.
2. The method according to claim 1, characterized in that The step of determining a first target cluster among the multiple working clusters currently in a surviving state in the distributed working cluster according to the scheduling preference of the first target application includes: Determine multiple working clusters that are currently alive in the distributed working cluster by collecting heartbeat data of multiple working clusters in the distributed working cluster; Screening out a plurality of candidate working clusters from the plurality of working clusters currently in a normal state according to the scheduling preference of the first target application; The indicator data disclosed by the multiple candidate working clusters through the indicator exposure service are captured, and a first target cluster is determined from the multiple candidate working clusters according to the indicator data.
3. The method according to claim 2, characterized in that The indicator data of the working cluster includes resource usage data and network status data, and determining a first target cluster from the plurality of candidate working clusters according to the indicator data includes: Evaluate each of the candidate work clusters according to the resource usage data to obtain a first evaluation score corresponding to each of the candidate work clusters; Evaluate each of the candidate working clusters according to the network status data to obtain a second evaluation score corresponding to each of the candidate working clusters; A first target cluster is determined from the plurality of candidate working clusters based on the first evaluation score and the second evaluation score.
4. The method according to claim 1, characterized in that: The method further comprises: When receiving an uninstallation request for the second target application, uninstalling the second target application from the second target cluster according to the access configuration information pre-reported by the second target cluster where the second target application is deployed; Updating access configuration information in the registration center, wherein updating the access configuration information at least includes: deleting an association relationship between the second target application and the second target cluster; When a configuration update is detected in the registration center through the configuration delivery service, the updated access configuration information is delivered to the gateway programs installed in the multiple working clusters currently in the surviving state in the distributed working cluster.
5. The method according to claim 1, characterized in that The method further comprises: When receiving a multicast registration request sent by any working cluster by calling an ad hoc network service, returning a request response, wherein the request response is used for the working cluster to stop multicasting and report access configuration information to the registration center; Obtaining access configuration information reported by the working cluster and storing it in the registration center; Sending a heartbeat request to the working cluster, so that after the working cluster responds to the heartbeat request, the heartbeat data of the working cluster is periodically obtained; After the heartbeat data of the working cluster is not obtained within a preset time period, it is determined that the working cluster is in an unavailable state.
6. The method according to claim 1, characterized in that The method further comprises: When receiving access configuration information reported by any working cluster after joining the centralized control cluster by calling the self-organizing network service, a gateway program is installed in the working cluster; the gateway program is used for calling between application services deployed by different working clusters.
7. A cross-cluster application scheduling device based on K3s, characterized in that: The device is applied to a centralized control cluster based on K3s, wherein the centralized control cluster includes a distributed working cluster of multiple working clusters, and the device includes: a determination module, configured to, when receiving a scheduling request for a first target application, determine a first target cluster from among a plurality of working clusters currently in a surviving state in the distributed working cluster according to a scheduling preference of the first target application; The scheduling module is used to schedule the first target application to the first target cluster according to the access configuration information pre-reported by the first target cluster to the centralized control cluster.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the cross-cluster application scheduling method based on K3s as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the cross-cluster application scheduling method based on K3s as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by the processor, the K3s-based cross-cluster application scheduling method as described in any one of claims 1 to 6 is implemented.