Service configuration method and device for Kubernetes container cluster
By analyzing and processing service configuration requests, dynamically selecting the service configuration dimensions and working modes of Kubernetes container clusters, the problem that the existing technology cannot meet the needs of different application scenarios is solved, and the full play of cluster capabilities and performance improvement is achieved.
Patent Information
- Application Number
- CN202210870893.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-07-22
AI Technical Summary
The existing Kubernetes container cluster service configuration method cannot meet the needs of different application scenarios, resulting in the inability to fully utilize the cluster capabilities.
By receiving and parsing service configuration requests, determine the target service configuration dimensions and working modes, and configure the Kubernetes container cluster according to these dimensions and modes. The supported service configuration dimensions include cluster dimensions, node dimensions, namespace dimensions and service dimensions, and the working modes include iptables, ipvs, ebpf and fully automatic modes.
It realizes dynamic selection of service configuration dimensions and working modes according to application scenario requirements, so that the cluster capabilities can be fully utilized and the performance and availability of the cluster are improved.
Smart Images

Figure CN115061783B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtualization technology, and in particular to a service configuration method, device, equipment and computer-readable storage medium for a Kubernetes container cluster. Background Art
[0002] The popular Kubernetes container cluster service implementation methods are mainly based on iptables mode, ipvs mode and the recently popular ebpf mode. Since the forwarding and load capacity of these three modes are gradually enhanced, especially the ebpf mode can effectively improve the efficiency of service forwarding, but the ebpf mode has high requirements for the kernel version and system architecture version. Therefore, if a node does not support this advanced mode, it cannot be enabled. When using the Kubernetes container cluster, you can only choose one of the modes to enable and use it according to the cluster dimension. The simple way of enabling service implementation according to the cluster dimension cannot meet the needs of users to use multiple service implementation methods in a cluster at the same time to meet the needs of different application scenarios, which greatly limits the performance of cluster capabilities.
[0003] In summary, how to effectively solve the problem that the existing Kubernetes container cluster service configuration method cannot meet the needs of different application scenarios and greatly limits the performance of cluster capabilities is an issue that technical personnel in this field urgently need to solve. Summary of the invention
[0004] The purpose of the present invention is to provide a service configuration method for a Kubernetes container cluster, which realizes the selection of service configuration dimensions according to application scenario requirements so that the cluster capabilities can be fully utilized; another purpose of the present invention is to provide a service configuration device, equipment and computer-readable storage medium for a Kubernetes container cluster.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] A service configuration method for a Kubernetes container cluster, comprising:
[0007] Receive service configuration request for target Kubernetes container cluster;
[0008] Parsing the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension;
[0009] The target Kubernetes container cluster is configured according to the target service configuration dimension and the target service working mode.
[0010] In a specific implementation of the present invention, the service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including:
[0011] When the service configuration request is a cluster deployment request, determining that the target service configuration dimension is the cluster dimension;
[0012] Parsing the cluster deployment request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0013] Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes:
[0014] The target Kubernetes container cluster is configured for service according to the cluster dimension and the target service working mode.
[0015] In a specific implementation of the present invention, the service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including:
[0016] When the service configuration request is a cluster maintenance node request, determining that the target service configuration dimension is the node dimension;
[0017] Parsing the cluster maintenance node request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0018] Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes:
[0019] The target Kubernetes container cluster is configured for service according to the node dimension and the target service working mode.
[0020] In a specific implementation of the present invention, the service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including:
[0021] When the service configuration request is a cluster maintenance namespace request, determining that the target service configuration dimension is the namespace dimension;
[0022] Parsing the cluster maintenance namespace request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0023] Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes:
[0024] The target Kubernetes container cluster is configured for service according to the namespace dimension and the target service working mode.
[0025] In a specific implementation of the present invention, the service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including:
[0026] When the service configuration request is a cluster maintenance service request, determining that the target service configuration dimension is the service dimension;
[0027] Parsing the cluster maintenance service request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0028] Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes:
[0029] The target Kubernetes container cluster is configured for service according to the service dimension and the target service working mode.
[0030] In a specific implementation of the present invention, when the service configuration request is a cluster maintenance service request, determining that the target service configuration dimension is the service dimension includes:
[0031] When the service configuration request is a service creation request, determining the target service configuration dimension in descending order of dimension priority as service dimension, namespace dimension, node dimension, and cluster dimension;
[0032] Parsing the cluster maintenance service request to obtain the target service working mode includes:
[0033] Parsing the service creation request to obtain target service working modes corresponding to each target service configuration dimension; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0034] Performing service configuration on the target Kubernetes container cluster according to the service dimension and the target service working mode includes:
[0035] The service creation operation is performed according to the dimension priority and the target service working mode corresponding to each of the target service configuration dimensions.
[0036] In a specific implementation of the present invention, when it is determined that the target service working mode is a fully automatic mode, the target Kubernetes container cluster is configured for service according to the target service configuration dimension and the target service working mode, including:
[0037] Obtain the node architecture and operating system of the target Kubernetes container cluster;
[0038] Determine whether the node architecture and the operating system support ebpf mode;
[0039] If yes, the ebpf mode is determined as the target service working mode;
[0040] If not, the iptables mode or the ipvs mode is determined as the target service working mode;
[0041] The target Kubernetes container cluster is configured according to the target service configuration dimension and the target service working mode.
[0042] A service configuration device for a Kubernetes container cluster, comprising:
[0043] The request receiving module is used to receive the service configuration request for the target Kubernetes container cluster;
[0044] A dimension and mode acquisition module, used to parse the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension;
[0045] A service configuration module is used to perform service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode.
[0046] A service configuration device for a Kubernetes container cluster, comprising:
[0047] Memory for storing computer programs;
[0048] A processor is used to implement the steps of the service configuration method of the Kubernetes container cluster as described above when executing the computer program.
[0049] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the service configuration method for a Kubernetes container cluster as described above.
[0050] The service configuration method of a Kubernetes container cluster provided by the present invention receives a service configuration request for a target Kubernetes container cluster; parses the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension; and performs service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode.
[0051] It can be seen from the above technical solution that by pre-dividing the service configuration dimension into cluster dimension, node dimension, namespace dimension, and service dimension, a corresponding service configuration request can be generated according to the configuration dimension needs. After obtaining the target service configuration dimension and the target service working mode by parsing the service configuration request, the target Kubernetes container cluster is configured according to the target service configuration dimension and the target service working mode. This enables the selection of service configuration dimensions according to the application scenario requirements, so that the cluster capabilities can be fully utilized.
[0052] Correspondingly, the present invention also provides a service configuration device, equipment and computer-readable storage medium for a Kubernetes container cluster corresponding to the service configuration method of the above-mentioned Kubernetes container cluster, which has the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1This is an implementation flow chart of the service configuration method of the Kubernetes container cluster in an embodiment of the present invention;
[0055] Figure 2 Another implementation flow chart of the service configuration method of the Kubernetes container cluster in an embodiment of the present invention;
[0056] Figure 3 A service configuration framework diagram of a Kubernetes container cluster in an embodiment of the present invention;
[0057] Figure 4 This is a structural block diagram of a service configuration device for a Kubernetes container cluster in an embodiment of the present invention;
[0058] Figure 5 This is a structural block diagram of a service configuration device for a Kubernetes container cluster in an embodiment of the present invention;
[0059] Figure 6 A schematic diagram of the specific structure of a service configuration device for a Kubernetes container cluster provided in this embodiment. DETAILED DESCRIPTION
[0060] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0061] See also Figure 1 , Figure 1 This is an implementation flow chart of a method for configuring a service of a Kubernetes container cluster in an embodiment of the present invention. The method may include the following steps:
[0062] S101: Receive a service configuration request for a target Kubernetes container cluster.
[0063] When service configuration is required for the target Kubernetes container cluster, a service configuration request is generated and sent to the service configuration control center, which receives the service configuration request for the target Kubernetes container cluster.
[0064] Kubernetes (often referred to as K8s, K8s is an abbreviation that replaces the eight letters "ubernete" with "8") is a container-centric infrastructure that can schedule and run containers on physical clusters or virtual machine clusters, and provides an open source platform for automatic container deployment, expansion, and management. It meets some common requirements of applications in production environments, such as application instance replicas, horizontal automatic expansion, naming and discovery, load balancing, rolling upgrades, resource monitoring, etc.
[0065] The target Kubernetes container cluster can be any Kubernetes container cluster that needs to be configured for service. The target Kubernetes container cluster contains multiple nodes, and each node is configured with multiple container pods. It can be preset that all containers in the target Kubernetes container cluster can access each other, or the containers can be divided into different namespaces so that the containers divided into different namespaces cannot access each other.
[0066] S102: Parse the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension.
[0067] The service configuration request contains the target service configuration dimension and target service working mode corresponding to this service configuration. The target service configuration dimension is one of the cluster dimension, node dimension, namespace dimension, and service dimension. The target service working mode can be one of the iptables mode, ipvs mode, ebpf mode, and fully automatic mode. After receiving the service configuration request for the target Kubernetes container cluster, the service configuration request is parsed to obtain the target service configuration dimension and target service working mode.
[0068] K8s namespace: All containers in a kubernetes cluster can access each other. However, in practice, you may not want two containers to access each other, so you can divide the two containers into different namespaces. By allocating resources within the cluster to different namespaces, kubernetes can form logical "groups" to facilitate the isolation and management of resources in different groups. It can be simply understood as logical grouping.
[0069] K8s service: k8s provides service resources. Service aggregates multiple containers that provide the same service and provides a unified entry address. By accessing the entry address of the service, you can access the container service behind it. In many cases, service is just an abstract concept. What really works is the kube-proxy service process. A kube-proxy service process runs on each node. When a service is created, the platform application interface service api-server writes the created service information to etcd. Kube-proxy will discover changes in this service based on the monitoring mechanism, and then it will convert the latest service information into corresponding access rules.
[0070] iptables (netfilter): The main function of iptables is to control the entry and exit of network packets and forwarding. When packets need to enter a device, flow out of a device, or be forwarded or routed by the device, iptables can be used to control them.
[0071] ipvs: ip virtual server, ip virtual server is a technology based on netfilter that implements transport layer load balancing as part of the linux kernel, usually called layer 4 lan (local area network) switching. ipvs is integrated in LVS (Linux Virtual Server), which runs in the host and acts as a load balancer in front of the real server cluster. ipvs can forward requests for TCP (Transmission Control Protocol) / UDP (User Datagram Protocol) services to the real servers at the backend, and make the services of the real servers appear as virtual services on a single IP (Internet Protocol Address). Therefore, ipvs naturally supports Kubernetes Service.
[0072] Both iptables and ipvs can achieve load balancing, but ipvs provides better scalability and performance for large clusters, supports more complex load balancing algorithms than iptables (minimum load, least connections, location, weighted, etc.), supports server health checks and connection retries, etc.
[0073] ebpf: is a hook function that can be mounted on the kernel path and executed by event triggering. For example, it can be mounted on the Linux kernel network path. When a network request (event) is received, network packets can be filtered and forwarded, etc., which can be used for load balancing of k8s service. BPF hooks are located as early as possible in the network driver, and the best packet processing performance can be achieved without copying the original packet. The mounted BPF program is an ideal choice for running filtering.
[0074] S103: Perform service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode.
[0075] After parsing the target service configuration dimensions and target service working mode, the target Kubernetes container cluster is configured according to the target service configuration dimensions and target service working mode. This enables the selection of service configuration dimensions according to application scenario requirements. The service services of each node in the same cluster can coexist in iptables, ipvs and ebpf. This policy-based model, especially in scenarios where the nodes of a hybrid heterogeneous K8s cluster are quite different, can give full play to the distribution and load capacity of the cluster service discovery, thereby improving the performance and availability of the cluster, giving full play to the cluster capabilities and improving the user experience.
[0076] In a specific implementation of the present invention, step S102 may include the following steps:
[0077] Step 1: When the service configuration request is a cluster deployment request, determine that the target service configuration dimension is a cluster dimension;
[0078] Step 2: Parse the cluster deployment request to obtain the target service working mode; the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0079] Accordingly, step S103 may include the following steps:
[0080] Configure services for the target Kubernetes container cluster according to the cluster dimensions and target service working mode.
[0081] When the service configuration request is a cluster deployment request, it indicates that cluster dimension configuration is required. The target service configuration dimension is determined to be the cluster dimension. The cluster deployment request is parsed to obtain the target service working mode. Among them, the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode. The target Kubernetes container cluster is configured according to the cluster dimension and the target service working mode. In this way, the target Kubernetes container cluster is configured in the cluster dimension according to the selected target service working mode.
[0082] In a specific implementation of the present invention, step S102 may include the following steps:
[0083] Step 1: When the service configuration request is a cluster maintenance node request, determine that the target service configuration dimension is the node dimension;
[0084] Step 2: Parse the cluster maintenance node request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0085] Accordingly, step S103 may include the following steps:
[0086] Configure services for the target Kubernetes container cluster according to the node dimension and target service working mode.
[0087] When the service configuration request is a cluster maintenance node request, it indicates that the node dimension needs to be configured. The target service configuration dimension is determined to be the node dimension. The cluster maintenance node request is parsed to obtain the target service working mode, where the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode. The target Kubernetes container cluster is configured for service according to the node dimension and the target service working mode. In this way, the node dimension configuration of the target Kubernetes container cluster is realized according to the selected target service working mode.
[0088] In a specific implementation of the present invention, step S102 may include the following steps:
[0089] Step 1: When the service configuration request is a cluster maintenance namespace request, determine that the target service configuration dimension is the namespace dimension;
[0090] Step 2: Parse the cluster maintenance namespace request to obtain the target service working mode; the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0091] Accordingly, step S103 may include the following steps:
[0092] Configure services for the target Kubernetes container cluster according to the namespace dimension and target service working mode.
[0093] When the service configuration request is a cluster maintenance namespace request, it indicates that the namespace dimension needs to be configured. The target service configuration dimension is determined to be the namespace dimension. The cluster maintenance namespace request is parsed to obtain the target service working mode, where the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode. The target Kubernetes container cluster is configured for service according to the namespace dimension and the target service working mode. In this way, the namespace dimension configuration of the target Kubernetes container cluster is realized according to the selected target service working mode.
[0094] In a specific implementation of the present invention, step S102 may include the following steps:
[0095] Step 1: When the service configuration request is a cluster maintenance service request, determine that the target service configuration dimension is a service dimension;
[0096] Step 2: Parse the cluster maintenance service request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0097] Accordingly, step S103 may include the following steps:
[0098] Configure services for the target Kubernetes container cluster according to the service dimensions and target service working mode.
[0099] When the service configuration request is a cluster maintenance service request, the target service configuration dimension is determined to be the service dimension, the cluster maintenance service request is parsed, and the target service working mode is obtained, wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode, and the target Kubernetes container cluster is configured according to the service dimension and the target service working mode. Thus, the service dimension configuration of the target Kubernetes container cluster is realized according to the selected target service working mode.
[0100] In a specific implementation of the present invention, when the service configuration request is a cluster maintenance service request, determining that the target service configuration dimension is a service dimension may include the following steps:
[0101] When the service configuration request is a service creation request, the target service configuration dimension is determined in the order of the dimension priority from high to low, namely, the service dimension, the namespace dimension, the node dimension, and the cluster dimension;
[0102] Accordingly, parsing the cluster maintenance service request to obtain the target service working mode may include the following steps:
[0103] Parse the service creation request to obtain the target service working mode corresponding to each target service configuration dimension; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0104] Accordingly, configuring the target Kubernetes container cluster according to the service dimension and target service working mode may include the following steps:
[0105] The service creation operation is performed according to the dimension priority and the target service working mode corresponding to each target service configuration dimension.
[0106] When the service configuration request is a service creation request, the target service configuration dimensions are determined in the order of the dimension priority from high to low, namely, service dimension, namespace dimension, node dimension, and cluster dimension. The service creation request is parsed to obtain the target service working mode corresponding to each target service configuration dimension, wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode, and the service creation operation is performed according to the dimension priority and the target service working mode corresponding to each target service configuration dimension. Therefore, within the same cluster, users can flexibly select the implementation method of the service according to the configuration strategy, which can meet the needs of users in different scenarios.
[0107] It can be seen from the above technical solution that by pre-dividing the service configuration dimension into cluster dimension, node dimension, namespace dimension, and service dimension, the corresponding service configuration request can be generated according to the configuration dimension needs. After obtaining the target service configuration dimension and the target service working mode by parsing the service configuration request, the service configuration is performed on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode. In this way, the service configuration dimension can be selected according to the application scenario requirements, so that the cluster capabilities can be fully utilized.
[0108] It should be noted that, based on the above embodiment, the embodiment of the present invention also provides corresponding improved solutions. In the subsequent embodiments, the same steps or corresponding steps as those in the above embodiment can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be repeated one by one in the following improved embodiments.
[0109] See also Figure 2 , Figure 2 Another implementation flow chart of the service configuration method of the Kubernetes container cluster in an embodiment of the present invention, the method may include the following steps:
[0110] S201: Receive a service configuration request for a target Kubernetes container cluster.
[0111] S202: Parse the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension.
[0112] S203: When it is determined that the target service working mode is the fully automatic mode, the node architecture and operating system of the target Kubernetes container cluster are obtained.
[0113] When it is determined that the target service working mode is the fully automatic auto mode, the node architecture and operating system of the target Kubernetes container cluster are obtained.
[0114] S204: Determine whether the node architecture and operating system support the eBPF mode. If so, execute step S205; if not, execute step S206.
[0115] After obtaining the node architecture and operating system of the target Kubernetes container cluster, determine whether the node architecture and operating system support the eBPF mode. If so, it means that the node architecture and operating system of the node involved in the target service configuration dimension support the advanced mode, and execute step S205. If not, it means that the node architecture and operating system involved in the target service configuration dimension do not support the advanced mode, and execute step S206.
[0116] S205: Determine the ebpf mode as the target service working mode.
[0117] When it is determined that the node architecture and operating system support the eBPF mode, it indicates that the node architecture and operating system of the node involved in the target service configuration dimension support the advanced mode, and the eBPF mode is determined as the target service working mode.
[0118] S206: Determine the iptables mode or the ipvs mode as the target service working mode.
[0119] When it is determined that the node architecture and operating system do not support the ebpf mode, it means that the node architecture and operating system involved in the target service configuration dimension do not support the advanced mode, and the iptables mode or ipvs mode is determined as the target service working mode. Specifically, the priority of the ipvs mode can be set higher than the iptables mode. After determining that the node architecture and operating system do not support the ebpf mode, first determine whether the node architecture and operating system support the ipvs mode. After determining that the node architecture and operating system do not support the ipvs mode, then determine whether the node architecture and operating system support the iptables mode. The fully automatic mode can automatically match a service implementation method according to the operating system kernel, architecture, etc. of each node, so that the cluster capabilities can be fully utilized.
[0120] S207: Perform service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode.
[0121] Corresponding to the above method embodiment, the present invention also provides a service configuration device for a Kubernetes container cluster. The service configuration device for a Kubernetes container cluster described below and the service configuration method for a Kubernetes container cluster described above can refer to each other.
[0122] See also Figure 4 , Figure 4 This is a structural block diagram of a service configuration device for a Kubernetes container cluster in an embodiment of the present invention, and the device may include:
[0123] A request receiving module 41 is used to receive a service configuration request for a target Kubernetes container cluster;
[0124] The dimension and mode obtaining module 42 is used to parse the service configuration request to obtain the target service configuration dimension and the target service working mode; wherein the target service configuration dimension is one of the cluster dimension, the node dimension, the namespace dimension, and the service dimension;
[0125] The service configuration module 43 is used to perform service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode.
[0126] It can be seen from the above technical solution that by pre-dividing the service configuration dimension into cluster dimension, node dimension, namespace dimension, and service dimension, the corresponding service configuration request can be generated according to the configuration dimension needs. After obtaining the target service configuration dimension and the target service working mode by parsing the service configuration request, the service configuration is performed on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode. In this way, the service configuration dimension can be selected according to the application scenario requirements, so that the cluster capabilities can be fully utilized.
[0127] In a specific implementation of the present invention, the dimension and mode obtaining module 42 includes:
[0128] The first dimension determination submodule is used to determine that the target service configuration dimension is a cluster dimension when the service configuration request is a cluster deployment request;
[0129] The first mode acquisition submodule is used to parse the cluster deployment request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0130] The service configuration module 43 is specifically a module for performing service configuration on the target Kubernetes container cluster according to the cluster dimension and the target service working mode.
[0131] In a specific implementation of the present invention, the dimension and mode obtaining module 42 includes:
[0132] The second dimension determination submodule is used to determine that the target service configuration dimension is a node dimension when the service configuration request is a cluster maintenance node request;
[0133] The second mode acquisition submodule is used to parse the cluster maintenance node request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0134] The service configuration module 43 is specifically a module for performing service configuration on the target Kubernetes container cluster according to the node dimension and the target service working mode.
[0135] In a specific implementation of the present invention, the dimension and mode obtaining module 42 includes:
[0136] The third dimension determination submodule is used to determine that the target service configuration dimension is the namespace dimension when the service configuration request is a cluster maintenance namespace request;
[0137] The third mode acquisition submodule is used to parse the cluster maintenance namespace request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full automatic mode;
[0138] The service configuration module 43 is specifically a module for performing service configuration on the target Kubernetes container cluster according to the namespace dimension and the target service working mode.
[0139] In a specific implementation of the present invention, the dimension and mode obtaining module 42 includes:
[0140] The fourth dimension determination submodule is used to determine the target service configuration dimension as the service dimension when the service configuration request is a cluster maintenance service request;
[0141] The fourth mode acquisition submodule is used to parse the cluster maintenance service request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode;
[0142] The service configuration module 43 is specifically a module for performing service configuration on the target Kubernetes container cluster according to the service dimension and the target service working mode.
[0143] In a specific implementation of the present invention, the fourth dimension determination submodule is specifically a module that determines the target service configuration dimension in the order of dimension priority from high to low, namely, service dimension, namespace dimension, node dimension, and cluster dimension when the service configuration request is a service creation request;
[0144] The fourth mode acquisition submodule is specifically a module for parsing the service creation request to obtain the target service working mode corresponding to each target service configuration dimension; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full automatic mode;
[0145] The service configuration module 43 is specifically a module that performs service creation operations according to the dimension priorities and the target service working modes corresponding to each target service configuration dimension.
[0146] In a specific implementation of the present invention, the service configuration module 43 includes:
[0147] The architecture and operating system acquisition submodule is used to obtain the node architecture and operating system of the target Kubernetes container cluster when the target service working mode is determined to be fully automatic mode;
[0148] The judgment submodule is used to determine whether the node architecture and operating system support the ebpf mode;
[0149] The first mode determination submodule is used to determine the eBPF mode as the target service working mode when the node architecture and the operating system support the eBPF mode;
[0150] The second mode determination submodule is used to determine the iptables mode or the ipvs mode as the target service working mode when the node architecture and the operating system do not support the ebpf mode;
[0151] The service configuration submodule is used to configure the service of the target Kubernetes container cluster according to the target service configuration dimension and target service working mode.
[0152] Corresponding to the above method embodiment, see Figure 5 , Figure 5 A schematic diagram of a service configuration device for a Kubernetes container cluster provided by the present invention, the device may include:
[0153] A memory 332, for storing computer programs;
[0154] The processor 322 is used to implement the steps of the service configuration method of the Kubernetes container cluster of the above method embodiment when executing the computer program.
[0155] For details, please refer to Figure 6 , Figure 6 A specific structural diagram of a service configuration device for a Kubernetes container cluster provided in this embodiment, the service configuration device for the Kubernetes container cluster may have relatively large differences due to different configurations or performances, and may include a processor (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer applications 342 or data 344. Among them, the memory 332 can be a short-term storage or a persistent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the processor 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the service configuration device 301 of the Kubernetes container cluster.
[0156] The service configuration device 301 of the Kubernetes container cluster may also include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .
[0157] The steps in the service configuration method of the Kubernetes container cluster described above can be implemented by the structure of the service configuration device of the Kubernetes container cluster.
[0158] Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:
[0159] Receive a service configuration request for a target Kubernetes container cluster; parse the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension; perform service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode.
[0160] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0161] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.
[0162] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the devices, equipment and computer-readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0163] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the technical solution and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, the present invention can also be improved and modified without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A service configuration method for a Kubernetes container cluster, characterized in that: include: Receive service configuration request for target Kubernetes container cluster; Parsing the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension; When it is determined that the target service working mode is a fully automatic mode, the node architecture and operating system of the target Kubernetes container cluster are obtained; Determine whether the node architecture and the operating system support ebpf mode; If yes, the ebpf mode is determined as the target service working mode; The target Kubernetes container cluster is configured according to the target service configuration dimension and the target service working mode.
2. The service configuration method of the Kubernetes container cluster according to claim 1, characterized in that: The service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including: When the service configuration request is a cluster deployment request, determining that the target service configuration dimension is the cluster dimension; Parsing the cluster deployment request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode; Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes: The target Kubernetes container cluster is configured for service according to the cluster dimension and the target service working mode.
3. The service configuration method of the Kubernetes container cluster according to claim 1, characterized in that: The service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including: When the service configuration request is a cluster maintenance node request, determining the target service configuration dimension to be the node dimension; Parsing the cluster maintenance node request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode; Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes: The target Kubernetes container cluster is configured for service according to the node dimension and the target service working mode.
4. The service configuration method of the Kubernetes container cluster according to claim 1, characterized in that: The service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including: When the service configuration request is a cluster maintenance namespace request, determining that the target service configuration dimension is the namespace dimension; Parsing the cluster maintenance namespace request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode; Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes: The target Kubernetes container cluster is configured for service according to the namespace dimension and the target service working mode.
5. The service configuration method of the Kubernetes container cluster according to claim 1, characterized in that: The service configuration request is parsed to obtain the target service configuration dimension and the target service working mode, including: When the service configuration request is a cluster maintenance service request, determining that the target service configuration dimension is the service dimension; Parsing the cluster maintenance service request to obtain the target service working mode; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode; Performing service configuration on the target Kubernetes container cluster according to the target service configuration dimension and the target service working mode includes: The target Kubernetes container cluster is configured for service according to the service dimension and the target service working mode.
6. The service configuration method of the Kubernetes container cluster according to claim 5, characterized in that: When the service configuration request is a cluster maintenance service request, determining that the target service configuration dimension is the service dimension includes: When the service configuration request is a service creation request, determining the target service configuration dimension in descending order of dimension priority as service dimension, namespace dimension, node dimension, and cluster dimension; Parsing the cluster maintenance service request to obtain the target service working mode includes: Parsing the service creation request to obtain target service working modes corresponding to each target service configuration dimension; wherein the target service working mode is one of iptables mode, ipvs mode, ebpf mode, and full-automatic mode; Performing service configuration on the target Kubernetes container cluster according to the service dimension and the target service working mode includes: The service creation operation is performed according to the dimension priority and the target service working mode corresponding to each of the target service configuration dimensions.
7. The service configuration method of the Kubernetes container cluster according to any one of claims 1 to 6, characterized in that: When the node architecture and the operating system do not support the eBPF mode, the target Kubernetes container cluster is configured according to the target service configuration dimension and the target service working mode, including: Determine the iptables mode or the ipvs mode as the target service working mode; The target Kubernetes container cluster is configured according to the target service configuration dimension and the target service working mode.
8. A service configuration device for a Kubernetes container cluster, characterized in that: include: The request receiving module is used to receive the service configuration request for the target Kubernetes container cluster; A dimension and mode acquisition module, used to parse the service configuration request to obtain a target service configuration dimension and a target service working mode; wherein the target service configuration dimension is one of a cluster dimension, a node dimension, a namespace dimension, and a service dimension; Service configuration module, the service configuration module includes: The architecture and operating system acquisition submodule is used to obtain the node architecture and operating system of the target Kubernetes container cluster when the target service working mode is determined to be fully automatic mode; The judgment submodule is used to determine whether the node architecture and operating system support the eBPF mode; The first mode determination submodule is used to determine the eBPF mode as the target service working mode when the node architecture and the operating system support the eBPF mode; The service configuration submodule is used to configure the service of the target Kubernetes container cluster according to the target service configuration dimension and target service working mode.
9. A service configuration device for a Kubernetes container cluster, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the service configuration method for a Kubernetes container cluster as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the service configuration method for a Kubernetes container cluster according to any one of claims 1 to 7.
Citation Information
Patent Citations
Cluster security management method and apparatus based on kubernetes and network domain, and storage medium
WO2021017279A1