A cluster configuration method, device, equipment and medium
By expanding the matching mechanism of DaemonSet and ConfigMap in the Kubernetes cluster, the dynamic association between Pods and ConfigMap is realized, which solves the problem of insufficient flexibility in pass-through device configuration and improves the flexibility and personalized support of cluster configuration.
Patent Information
- Application Number
- CN202211052245.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2042-08-31
AI Technical Summary
In Kubernetes clusters, the configuration flexibility of pass-through devices is insufficient, resulting in the inability to meet OpenStack's personalized configuration requirements for GPU, vGPU and other host pass-through devices, and conflicting with the unified configuration concept of Kubernetes.
By extending DaemonSet, it supports the decoupling of Pods and ConfigMap, and uses ConfigMapSelector to dynamically match and mount different configuration files based on Pod node information to achieve personalized configuration of Pod copies.
It realizes flexible and personalized configuration of Pod copies, improves the flexibility of cluster configuration, solves the problem of insufficient configuration caused by all Pods using the same ConfigMap in the existing technology, and maintains the unified configuration management of Kubernetes.
Smart Images

Figure CN115766423B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a cluster configuration method, device, equipment and medium. Background Art
[0002] At present, with all kinds of applications going to the cloud, the OpenStack management platform components previously deployed on bare metal and containers are also deployed, operated, and managed based on Kubernetes step by step, in order to give full play to the advantages of the latter in automated operation and maintenance, high availability mechanism, and rolling upgrade. At the same time, we should also see the constraints of some of the latter's design concepts and functional status on OpenStack deployment and configuration. For example, in the Kubernetes concept, the configuration of Pods replicas must be uniform. Its original intention was to solve the problem of inconsistent application deployment and great difficulty in operation and maintenance in large-scale operation and maintenance (the predecessor of Kubernetes, namely Google's Borg system, manages hundreds of millions of containers). However, when OpenStack needs to apply GPU (Graphic Processing Unit), vGPU and other host direct devices to virtual machines, the configuration files of nova-compute services on different nodes need to configure the device PCI (Peripheral Component Interconnect) address information of the direct device on the current host. Its personalized configuration requirements conflict with the unified configuration concept of Kubernetes, making the latter appear to be insufficiently flexible.
[0003] As can be seen from the above, in the configuration process of the Kubernetes cluster, how to avoid the lack of configuration flexibility of the pass-through device is a problem to be solved in the field. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a cluster configuration method, device, equipment and medium, which can support the decoupling of Pods and ConfigMap by extending DaemonSet, flexibly determine the association and mounting relationship between Pods and different ConfigMaps when instantiating Pods, so as to realize different Pod replicas to mount different configuration files according to Pod node information (or other information), and realize personalized Pods. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a cluster configuration method, comprising:
[0006] Determine the device pass-through node in the cluster and create a corresponding ConfigMap for the Pod of the device pass-through node;
[0007] Define a Daemonset, and use the Daemonset to match the target ConfigMap for the Pod of the target device passthrough node according to the ConfigMapSelector;
[0008] If the Pod of the target device pass-through node matches the target ConfigMap, the Pod of the target device pass-through node is associated with the target ConfigMap;
[0009] If the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
[0010] Optionally, after creating a corresponding ConfigMap for the Pod of the device pass-through node, the process further includes:
[0011] Add a label to the ConfigMap; the label includes nova-compute to which the Pod of the target device direct node belongs and the node name of the target device direct node.
[0012] Optionally, matching the target ConfigMap for the Pod of the target device through node according to ConfigMapSelector includes:
[0013] Based on the attribute information of the Pod of the target device pass-through node and the labels of each ConfigMap, the target ConfigMap is matched for the Pod of the target device pass-through node according to the ConfigMapSelector.
[0014] Optionally, the matching of the target ConfigMap for the Pod of the target device direct node according to ConfigMapSelector based on the attribute information of the Pod of the target device direct node and the label of each ConfigMap includes:
[0015] Determine the target matching condition based on the attribute information of the Pod of the target device pass-through node;
[0016] According to ConfigMapSelector, the Pod of the target device passthrough node matches the target ConfigMap based on the target matching condition and the label of each ConfigMap.
[0017] Optionally, determining the target matching condition based on the attribute information of the Pod of the target device direct-access node includes:
[0018] The target matching condition is determined based on the node name of nova-compute or the node to which the Pod of the target device passthrough node belongs.
[0019] Optionally, before determining the device direct access node in the cluster and creating a corresponding ConfigMap for the Pod of the device direct access node, the method further includes:
[0020] A default ConfigMap is created in the current cluster so that when the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
[0021] Optionally, after associating the Pod of the target device direct-connect node with the target ConfigMap or associating the Pod of the target device direct-connect node with the default ConfigMap in the cluster, the method further includes:
[0022] The Daemonset is instantiated to use the Daemonset to perform lifecycle management on the Pods of all the nodes in the current cluster.
[0023] In a second aspect, the present application discloses a cluster configuration device, comprising:
[0024] A ConfigMap creation module is used to determine the device pass-through node in the cluster and create a corresponding ConfigMap for the Pod of the device pass-through node;
[0025] The ConfigMap matching module is used to define a Daemonset and use the Daemonset to match the target ConfigMap for the Pod of the target device pass-through node according to the ConfigMapSelector;
[0026] A first matching and associating module, configured to associate the Pod of the target device direct node with the target ConfigMap if the Pod of the target device direct node matches the target ConfigMap;
[0027] The second matching and associating module is used to associate the Pod of the target device direct-connected node with the default ConfigMap in the cluster if the Pod of the target device direct-connected node does not match the target ConfigMap.
[0028] In a third aspect, the present application discloses an electronic device, including:
[0029] Memory, used to store computer programs;
[0030] The processor is used to execute the computer program to implement the aforementioned cluster configuration method.
[0031] In a fourth aspect, the present application discloses a computer storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the cluster configuration method disclosed above are implemented.
[0032] In this application, the device direct-access node in the cluster is first determined, and a corresponding ConfigMap is created for the Pod of the device direct-access node; Daemonset is defined, and the Daemonset is used to match the target ConfigMap for the Pod of the target device direct-access node according to ConfigMapSelector; if the Pod of the target device direct-access node matches the target ConfigMap, the Pod of the target device direct-access node is associated with the target ConfigMap; if the Pod of the target device direct-access node does not match the target ConfigMap, the Pod of the target device direct-access node is associated with the default ConfigMap in the cluster. In this way, the Pod template is expanded in this application, and a dynamic association strategy between Pod and ConfigMap is proposed to achieve loose coupling between Pod and ConfigMap, and by decoupling the strong association between Pod and ConfigMap instances, it is possible to filter available ConfigMap instances according to pre-defined matching rules when DaemonSet instantiates Pod copies, and use the default ConfigMap when there is no match, so as to achieve flexible and personalized configuration of Pod. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0034] Figure 1 A schematic diagram of an existing cluster configuration provided for this application;
[0035] Figure 2 A flow chart of a cluster configuration method provided for this application;
[0036] Figure 3 A schematic diagram of an improved cluster configuration provided for this application;
[0037] Figure 4 A specific cluster configuration method flow chart provided for this application;
[0038] Figure 5 A schematic diagram of the structure of a cluster configuration device provided in this application;
[0039] Figure 6 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] In the prior art, when defining a DaemonSet, the ConfigMap specified for the Pod template is a certain ConfigMap instance, for example Figure 1 In cm, all Pods corresponding to all nodes are associated with cm, and cm is used in subsequent creation. If the host contains direct-pass devices, you need to configure which devices on the current host need to be direct-passed in nova.conf in cm. However, in actual applications, not all nodes will be arranged as GPU nodes and direct-pass disk nodes by the operation and maintenance administrator, and not all direct-pass nodes have the same number of devices and device PCI addresses. Therefore, nova.conf must be different for different nodes. Therefore, it is obviously inappropriate and inflexible for nova-compute DaemonSet to use one ConfigMap for all Pods.
[0042] The cluster configuration method proposed in the present invention is a method that can enable a container cluster to support personalized configuration of Pods. The method can realize personalized configuration of different Pods based on a label mechanism and a Selector mechanism while maintaining the specification that Kubernetes uses a unified configuration management DaemonSet and Pods. The method is used to solve the need to configure different PCI devices for each nova-compute Pod configuration file under a nova-compute DaemonSet in a scenario where OpenStack needs to pass through a host PCI device (GPU, vGPU, smart network card, hard disk, network card) to a virtual machine, and in other similar scenarios, the flexibility of cluster configuration is improved without destroying the design principle of unified configuration defined in Kubernetes.
[0043] The embodiment of the present invention discloses a cluster configuration method, see Figure 2 Said method comprises:
[0044] Step S11: Determine a device-through node in the cluster, and create a corresponding ConfigMap for the Pod of the device-through node.
[0045] Compared to Figure 1 The prior art in the present invention Figure 3 A method is proposed to enable container clusters to support personalized configuration of Pods. If the administrator defines virtualized nodes node1 and node2 as device pass-through nodes, then the administrator defines separate ConfigMaps for the nova-compute Pods of the two nodes in addition to the unified ConfigMap (i.e. default). That is, the pods of each node in the cluster correspond to their own ConfigMaps. Figure 3 The pod of node1 corresponds to cm2, the pod of node2 corresponds to cm1, and the pod of node3 corresponds to cm3. Specifically, each device passthrough in the cluster will correspond to its own ConfigMap. For example, node1 and node2 are both device passthrough nodes, cm1 and cm2 are the ConfigMaps corresponding to the two nodes respectively, and node3 is a common node in the cluster, which corresponds to the default ConfigMap in the cluster: cm3.
[0046] In the embodiment of the present application, before determining the device pass-through node in the cluster and creating a corresponding ConfigMap for the Pod of the device pass-through node, it may also include: creating a default ConfigMap in the current cluster so that when the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster. The default ConfigMap is Figure 1 cm and Figure 3 cm3 in.
[0047] Step S12: define a Daemonset, and use the Daemonset to match the target ConfigMap for the Pod of the target device pass-through node according to the ConfigMapSelector.
[0048] In the embodiment of the present application, an extension of DaemonSet Controller, namely ConfigMapSelector, is implemented to support multiple conditional combinations of IN, AND, and OR syntax.
[0049] In the embodiment of the present application, when defining DaemonSet, a new Pod template is used, except that the template is associated with ConfigMapSelector and one or a group of rules defined by the Selector. This rule is used for matching the target ConfigMap for the Pod later.
[0050] Step S13: If the Pod of the target device direct node matches the target ConfigMap, the Pod of the target device direct node is associated with the target ConfigMap.
[0051] like Figure 3 Before the DaemonSet shown in the figure initializes the node1 nova-compute Pod based on this template, it first matches node1 to cm2 and then uses it as the ConfigMap for the new Pod. If there is no match, such as node3 in the figure, the default ConfigMap is used to associate with node3. In the specific implementation process, default will eventually correspond to the general configuration of most, non-personalized Pods.
[0052] Step S14: If the Pod of the target device direct node does not match the target ConfigMap, the Pod of the target device direct node is associated with the default ConfigMap in the cluster.
[0053] If no match is found, the default ConfigMap is used. In the end, the default will correspond to the general configuration of most non-personalized Pods.
[0054] In an embodiment of the present application, after associating the Pod of the target device direct-connect node with the target ConfigMap or associating the Pod of the target device direct-connect node with the default ConfigMap in the cluster, it may also include: instantiating the Daemonset to use the Daemonset to perform lifecycle management on the Pods of all the nodes in the current cluster.
[0055] In the embodiment of the present application, the Kubernetes administrator can instantiate the DaemonSet entity based on the DaemonSet configuration, and DaemonSet begins to manage the lifecycle of each Pod copy. When creating a Pod copy for a node, DaemonSet queries the corresponding ConfigMap based on ConfigMapSelector and its rules, and instantiates the Pod copy. The subsequent reconstruction of the node pod and the upgrade of the node can be based on the ConfigMap corresponding to each pod, and the operation can be performed using a method similar to the above.
[0056] In an embodiment of the present application, a device pass-through node in a cluster is determined, and a corresponding ConfigMap is created for the Pod of the device pass-through node; a Daemonset is defined, and the Daemonset is used to match the target ConfigMap for the Pod of the target device pass-through node according to the ConfigMapSelector; if the Pod of the target device pass-through node matches the target ConfigMap, the Pod of the target device pass-through node is associated with the target ConfigMap; if the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster. In this way, in the embodiment of the present application, the Pod template is extended, a ConfigMapSelector is created, and association rules applied in the ConfigMapSelector are created, and a dynamic association strategy between Pod and ConfigMap under Kubernetes is proposed, which can realize loose coupling between Pod and ConfigMap, and the strong association between Pod and ConfigMap instance can be decoupled through ConfigMapSelector, so that when DaemonSet instantiates Pod copies, available ConfigMap instances can be filtered according to the matching rules defined by ConfigMapSelector. When there is no match, the default default value is used, so as to realize flexible and personalized configuration of Pod, and it can also be more flexible in subsequent node pod reconstruction or upgrade, and solve the problem of using the same ConfigMap for all Pods in the prior art due to the existence of only one ConfigMap in the cluster to the greatest extent, and improve the flexibility of cluster configuration without destroying the design principle of unified configuration defined in Kubernetes.
[0057] Figure 4 A flow chart of a specific cluster configuration method provided in the embodiment of the present application. Figure 4 As shown, the method includes:
[0058] Step S21: Determine a device-through node in the cluster, and create a corresponding ConfigMap for the Pod of the device-through node.
[0059] Among them, for a more specific processing process of step S21, reference can be made to the corresponding contents disclosed in the aforementioned embodiments proposed in this application, which will not be repeated here.
[0060] Step S22: adding a label to the ConfigMap; the label includes nova-compute to which the Pod of the target device direct node belongs and the node name of the target device direct node.
[0061] In the embodiment of the present application, the administrator defines the virtualized nodes node1 and node2 as device-through nodes. Then, after the administrator defines the respective ConfigMaps for the nova-compute Pods of the two nodes in addition to the unified ConfigMap (i.e., default), he will also add labels to them to identify the application to which they belong and the host name of the application Pod. Figure 3 The labels of the ConfigMap corresponding to the node1 pod are nova-compute and node1, and the labels of the ConfigMap corresponding to the node2 pod are nova-compute and node2. Nova-compute in the label is the application to which the pod belongs, and node1 and node2 are the host names of the application pod.
[0062] Specifically, in this step, you can use the kubectl label subcommand to add labels to ConfigMap. For example, the Kubernetes administrator uses the kubectl label subcommand to label cm0.
[0063] Step S23: define a Daemonset, and use the Daemonset to match the target ConfigMap for the Pod of the target device direct node according to the ConfigMapSelector based on the attribute information of the Pod of the target device direct node and the labels of each ConfigMap.
[0064] In the embodiment of the present application, when defining DaemonSet, a new Pod template is used, except that the template is associated with ConfigMapSelector and one or a group of rules defined by the Selector. For example, the rule is that the Pod replica on node X should mount the ConfigMap with label X (which can be expressed as Pod.spec.hostname inConfigMap.labels). If no match is found, the default is used. Before DaemonSet initializes node1 nova-compute Pod based on this template, it first matches cm2 according to node1 and then uses it as the ConfigMap of the new Pod. If there is no match, the default ConfigMap is used.
[0065] In the embodiment of the present application, the ConfigMap Selector can support the syntax of In, AND, and OR to determine whether a certain attribute of the Pod (Pod.spec.*) is in the labels list of the ConfigMap instance. Currently, if only the host name is matched, the ConfigMap and the Pod will be one-to-one, which will cause the problem of ConfigMap redundancy in the scenario where the personalized Pod uses the same configuration, so the Selector supports multiple condition combinations, for example: Pod.spec.hostname in ["node1", "node2"] AND "enable_dpdk" IN ConfigMap.labels.
[0066] In an embodiment of the present application, matching the target ConfigMap for the Pod of the target device direct-connected node according to ConfigMapSelector based on the attribute information of the Pod of the target device direct-connected node and the labels of each ConfigMap may include: determining a target matching condition based on the attribute information of the Pod of the target device direct-connected node; matching the target ConfigMap for the Pod of the target device direct-connected node according to ConfigMapSelector and based on the target matching condition and the labels of each ConfigMap.
[0067] In an embodiment of the present application, the target matching condition is determined based on the attribute information of the Pod of the target device direct node, which may include: determining the target matching condition based on the nova-compute to which the Pod of the target device direct node belongs or the node name of the node where it is located. That is, in an embodiment of the present application, the nova-compute to which the Pod of the target device direct node belongs or the node name of the node where it is located can be used as the target matching condition for matching. In a specific implementation method, multiple conditions can be matched according to the In, AND, and OR syntax. In the specific implementation process, specific examples of target matching conditions may include: matching ConfigMap labels by the name of the node where the Pod replica is located; matching ConfigMaplabels by the application to which the pod belongs; matching ConfigMap labels by multiple conditions according to the name of the node where the Pod replica is located and the application to which the pod belongs.
[0068] Step S24: If the Pod of the target device direct node matches the target ConfigMap, the Pod of the target device direct node is associated with the target ConfigMap.
[0069] Among them, for a more specific processing process of step S24, reference can be made to the corresponding contents disclosed in the aforementioned embodiments proposed in this application, which will not be repeated here.
[0070] Step S25: If the Pod of the target device direct node does not match the target ConfigMap, the Pod of the target device direct node is associated with the default ConfigMap in the cluster.
[0071] Among them, for a more specific processing process of step S25, reference can be made to the corresponding contents disclosed in the aforementioned embodiments proposed in this application, and no further details will be given here.
[0072] In the embodiment of the present application, the Pod template is extended, and the strong association between the Pod and the ConfigMap instance is decoupled through ConfigMapSelector. A dynamic association strategy between Pod and ConfigMap under Kubernetes is proposed to achieve loose coupling between Pod and ConfigMap, thereby improving the flexibility of cluster configuration without destroying the design principle of unified configuration defined in Kubernetes.
[0073] See also Figure 5 As shown, the embodiment of the present application discloses a cluster configuration device, which may specifically include:
[0074] The ConfigMap creation module 11 is used to determine the device direct node in the cluster and create a corresponding ConfigMap for the Pod of the device direct node;
[0075] The ConfigMap matching module 12 is used to define a Daemonset and use the Daemonset to match a target ConfigMap for a Pod of a target device direct node according to a ConfigMapSelector;
[0076] A first matching and associating module 13 is used to associate the Pod of the target device direct node with the target ConfigMap if the Pod of the target device direct node matches the target ConfigMap;
[0077] The second matching and associating module 14 is used to associate the Pod of the target device direct-connected node with the default ConfigMap in the cluster if the Pod of the target device direct-connected node does not match the target ConfigMap.
[0078] In this application, the device pass-through node in the cluster is first determined, and a corresponding ConfigMap is created for the Pod of the device pass-through node; Daemonset is defined, and the Daemonset is used to match the target ConfigMap for the Pod of the target device pass-through node according to ConfigMapSelector; if the Pod of the target device pass-through node matches the target ConfigMap, the Pod of the target device pass-through node is associated with the target ConfigMap; if the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster. In this way, in the embodiment of the present application, the Pod template is extended, a ConfigMapSelector is created, and association rules applied in the ConfigMapSelector are created, and a dynamic association strategy between Pod and ConfigMap under Kubernetes is proposed, which can realize loose coupling between Pod and ConfigMap, and the strong association between Pod and ConfigMap instance can be decoupled through ConfigMapSelector, so that when DaemonSet instantiates Pod copies, available ConfigMap instances can be filtered according to the matching rules defined by ConfigMapSelector. When there is no match, the default default value is used, so as to realize flexible and personalized configuration of Pod, and it can also be more flexible in subsequent node pod reconstruction or upgrade, and solve the problem of using the same ConfigMap for all Pods in the prior art due to the existence of only one ConfigMap in the cluster to the greatest extent, and improve the flexibility of cluster configuration without destroying the design principle of unified configuration defined in Kubernetes.
[0079] In some specific embodiments, the cluster configuration device may further include:
[0080] The label adding module is used to add a label to the ConfigMap; the label includes nova-compute to which the Pod of the target device direct node belongs and the node name of the target device direct node.
[0081] In some specific embodiments, the ConfigMap matching module 12 may specifically include:
[0082] The ConfigMap matching unit is used to match the target ConfigMap for the Pod of the target device direct node according to the ConfigMapSelector based on the attribute information of the Pod of the target device direct node and the labels of each ConfigMap.
[0083] In some specific embodiments, the ConfigMap matching unit may specifically include:
[0084] A matching condition determination unit, configured to determine a target matching condition based on attribute information of a Pod of a target device pass-through node;
[0085] The matching unit is used to match the target ConfigMap with the Pod of the target device direct node according to the ConfigMapSelector and based on the target matching condition and the label of each ConfigMap.
[0086] In some specific embodiments, the matching condition determination unit may specifically include:
[0087] The condition determination unit is used to determine the target matching condition based on the node name of the nova-compute or the node to which the Pod of the target device pass-through node belongs.
[0088] In some specific embodiments, the cluster configuration device may further include:
[0089] The default ConfigMap creation unit is used to create a default ConfigMap in the current cluster, so that when the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
[0090] In some specific embodiments, the cluster configuration device may further include:
[0091] The Pod lifecycle management unit is used to instantiate the Daemonset to use the Daemonset to perform lifecycle management on the Pods of all the nodes in the current cluster.
[0092] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.
[0093] Figure 6The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a display screen 24, an input / output interface 25, a communication interface 26, and a communication bus 27. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the following steps:
[0094] Determine the device pass-through node in the cluster and create a corresponding ConfigMap for the Pod of the device pass-through node;
[0095] Define a Daemonset, and use the Daemonset to match the target ConfigMap for the Pod of the target device passthrough node according to the ConfigMapSelector;
[0096] If the Pod of the target device pass-through node matches the target ConfigMap, the Pod of the target device pass-through node is associated with the target ConfigMap;
[0097] If the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
[0098] In some specific implementations, after creating the corresponding ConfigMap for the Pod of the device pass-through node, the following steps may be further included:
[0099] Add a label to the ConfigMap; the label includes nova-compute to which the Pod of the target device direct node belongs and the node name of the target device direct node.
[0100] In some specific implementations, the Pod matching the target ConfigMap for the target device through node according to ConfigMapSelector can specifically implement the following steps:
[0101] Based on the attribute information of the Pod of the target device pass-through node and the labels of each ConfigMap, the target ConfigMap is matched for the Pod of the target device pass-through node according to the ConfigMapSelector.
[0102] In some specific implementations, the target ConfigMap is matched for the Pod of the target device direct node according to the ConfigMapSelector based on the attribute information of the Pod of the target device direct node and the labels of each ConfigMap, and specifically the following steps can be implemented:
[0103] Determine the target matching condition based on the attribute information of the Pod of the target device pass-through node;
[0104] According to ConfigMapSelector, the Pod of the target device passthrough node matches the target ConfigMap based on the target matching condition and the label of each ConfigMap.
[0105] In some specific implementations, the target matching condition is determined based on the attribute information of the Pod of the target device through-node, and specifically the following steps can be implemented:
[0106] The target matching condition is determined based on the node name of nova-compute or the node to which the Pod of the target device passthrough node belongs.
[0107] In some specific implementations, before determining the device direct access node in the cluster and creating a corresponding ConfigMap for the Pod of the device direct access node, the following steps may be further included:
[0108] A default ConfigMap is created in the current cluster so that when the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
[0109] In some specific implementations, after associating the Pod of the target device direct-connect node with the target ConfigMap or associating the Pod of the target device direct-connect node with the default ConfigMap in the cluster, the following steps may be further included:
[0110] The Daemonset is instantiated to use the Daemonset to perform lifecycle management on the Pods of all the nodes in the current cluster.
[0111] In addition, the electronic device 20 in the embodiment of the present application can specifically be an electronic computer, and the power supply 23 in the embodiment of the present application is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 26 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to the specific application needs, and is not specifically limited here.
[0112] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and virtual machine data 223, etc. The virtual machine data 223 may include various data. The storage method may be temporary storage or permanent storage.
[0113] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the cluster configuration method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0114] Furthermore, the present application also discloses a computer-readable storage medium, wherein the computer-readable storage medium mentioned here includes a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic disk or an optical disk, or any other form of storage medium known in the technical field. Wherein, when the computer program is executed by the processor, the aforementioned disclosed cluster configuration method is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments proposed in the present application, and no further description will be given here.
[0115] Each embodiment in this specification 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 device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. Professionals can also further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented in electronic hardware, computer software or a combination of Pod and ConfigMap. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0116] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented using hardware, a software module executed by a processor, or a combination of a Pod and a ConfigMap. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0117] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also 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 a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0118] The cluster configuration method, device, equipment, and storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A cluster configuration method, characterized in that: include: Determine the device pass-through node in the cluster and create a corresponding ConfigMap for the Pod of the device pass-through node; Define a Daemonset, and use the Daemonset to match the target ConfigMap for the Pod of the target device passthrough node according to the ConfigMapSelector; If the Pod of the target device pass-through node matches the target ConfigMap, the Pod of the target device pass-through node is associated with the target ConfigMap; If the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
2. The cluster configuration method according to claim 1, characterized in that: After creating the corresponding ConfigMap for the Pod of the device direct node, it also includes: Add a label to the ConfigMap; the label includes nova-compute to which the Pod of the target device direct node belongs and the node name of the target device direct node.
3. The cluster configuration method according to claim 2, characterized in that: The Pod matching the target ConfigMap for the target device through the node according to ConfigMapSelector includes: Based on the attribute information of the Pod of the target device pass-through node and the labels of each ConfigMap, the target ConfigMap is matched for the Pod of the target device pass-through node according to the ConfigMapSelector.
4. The cluster configuration method according to claim 3, characterized in that: The method of matching the target ConfigMap for the Pod of the target device direct node according to the ConfigMapSelector based on the attribute information of the Pod of the target device direct node and the labels of each ConfigMap includes: Determine the target matching condition based on the attribute information of the Pod of the target device pass-through node; According to ConfigMapSelector, the Pod of the target device passthrough node matches the target ConfigMap based on the target matching condition and the label of each ConfigMap.
5. The cluster configuration method according to claim 4, characterized in that: The target matching condition is determined based on the attribute information of the Pod of the target device through-node, including: The target matching condition is determined based on the node name of nova-compute or the node to which the Pod of the target device passthrough node belongs.
6. The cluster configuration method according to claim 1, characterized in that: Before determining the device direct access node in the cluster and creating a corresponding ConfigMap for the Pod of the device direct access node, the method further includes: A default ConfigMap is created in the current cluster so that when the Pod of the target device pass-through node does not match the target ConfigMap, the Pod of the target device pass-through node is associated with the default ConfigMap in the cluster.
7. The cluster configuration method according to any one of claims 1 to 6, characterized in that: After associating the Pod of the target device direct-connect node with the target ConfigMap or associating the Pod of the target device direct-connect node with the default ConfigMap in the cluster, the method further includes: The Daemonset is instantiated to use the Daemonset to perform lifecycle management on the Pods of all the nodes in the current cluster.
8. A cluster configuration device, characterized in that: include: A ConfigMap creation module is used to determine the device pass-through node in the cluster and create a corresponding ConfigMap for the Pod of the device pass-through node; The ConfigMap matching module is used to define a Daemonset and use the Daemonset to match the target ConfigMap for the Pod of the target device pass-through node according to the ConfigMapSelector; A first matching and associating module, configured to associate the Pod of the target device direct node with the target ConfigMap if the Pod of the target device direct node matches the target ConfigMap; The second matching and associating module is used to associate the Pod of the target device direct-connected node with the default ConfigMap in the cluster if the Pod of the target device direct-connected node does not match the target ConfigMap.
9. An electronic device, characterized in that: It comprises a processor and a memory; wherein, when the processor executes the computer program stored in the memory, the cluster configuration method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the cluster configuration method according to any one of claims 1 to 7 is implemented.
