A container unit management method and related equipment
By coordinating network management and container proxy components in the Kubernetes platform, the IP address of container units is fixed, which solves the problem of IP address changes after container unit reconstruction, ensuring normal access to the application and stability of container units.
Patent Information
- Application Number
- CN201911344800.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-24
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2039-12-24
AI Technical Summary
When the Kubernetes platform recreates the container unit, it may allocate different IP addresses, resulting in applications that rely on IP addresses to access cannot be accessed normally.
By collaborating between the control nodes and computing nodes of the Kubernetes platform, the IP address of the container unit is imposed using network management components, container proxy components and network configuration components. The specific steps include the container proxy component sending network configuration instructions, the network configuration component requests the IP address from the network management component, and fixing its IP address when the container unit is created.
Ensure that the IP address remains unchanged after the container unit is restarted or rebuilt, ensuring that applications that rely on IP address mutual access can be accessed normally, and improving the reliability and stability of container unit management.
Smart Images

Figure CN113037522B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a container unit management method and related equipment. Background Art
[0002] Kubernetes (k8s for short) is a container cluster management system that can realize functions such as automatic deployment, automatic expansion and contraction, and maintenance of container clusters. Pod is the smallest unit deployed, created, or managed on the k8s platform. A pod represents a running process. A pod can run one or more containers. Each pod is assigned an independent IP address, and the containers in the pod can share this IP address for communication.
[0003] When a pod of an application is newly created, the K8s platform randomly assigns an IP address to the newly created pod from the available address segment. Other containers or hosts can access the application carried by the pod through this assigned IP address. If the pod is destroyed by the k8s platform due to an abnormality, the IP address will be recycled to the available address segment. If other pods are being created, k8s may assign this IP address to other pods. When rebuilding the pod for the application, k8s may assign other IP addresses in the available address segment to the pod. At this time, the IP address for accessing the application has changed.
[0004] K8s's way of allocating IP addresses is suitable for pods corresponding to applications that do not rely on IP address mutual access, such as web applications. Access to web applications is usually based on Uniform Resource Locator (URL). Even if the IP address changes, it does not affect normal access to web applications through URLs. However, for applications that rely on IP address mutual access, such as database applications, if the IP address of the pod carrying such applications changes after reconstruction, then after these pods are rebuilt, the applications they carry based on IP address mutual access cannot be accessed normally. Summary of the invention
[0005] The present application provides a container unit management method and related equipment, through which the IP address of the container unit can be fixed, ensuring that the application carried by the container unit based on IP address mutual access can be accessed normally.
[0006] The first aspect of the present application provides a container unit management method, which can be performed by a network management component in a control node in a k8s platform, and a container proxy component and a network configuration component in the same computing node device in the k8s platform. The container unit involved in the method can be a pod in the k8s platform.
[0007] The network management component is responsible for managing and allocating IP addresses of container units in multiple computing node devices in the k8s platform; the container agent component is responsible for creating, modifying, and monitoring container units in the computing node device; the network configuration component is responsible for creating and configuring the virtual network adapter of the container unit in the computing node device according to the IP address allocated by the network management component to ensure that the container unit in the computing node device can communicate over the network based on the configured virtual network adapter.
[0008] In the method, the network configuration component receives a first network configuration instruction sent by the container proxy component, the first network configuration instruction is sent by the container proxy component after creating a first container unit corresponding to a first container unit identifier, and the first network configuration instruction includes the first container unit identifier; then, the network configuration component sends a container address request for applying for an IP address to the network management component, the container address request carries the first container unit identifier, so that the network management component obtains the IP address corresponding to the recorded first container unit identifier, and returns an address allocation instruction including the first IP address to the network configuration component; thus, the network configuration component creates a first virtual network adapter of the first container unit, and can perform network configuration on the first virtual network adapter according to the first IP address. For the container unit established by the first container unit identifier, the network configuration component fixes its IP address, providing network guarantee for normal access of applications in the container unit.
[0009] Optionally, the container unit management method of the first aspect can be applied to a scenario where the container unit corresponding to the first container unit identifier is restarted or rebuilt. Therefore, the first container unit can be created by the container proxy component when the second container unit fails, wherein the second container unit is the container unit that uniquely corresponds to the first container unit identifier before the failure.
[0010] The failure of the second container unit may be caused by the second container unit being in an unhealthy operating state due to its own defects during operation, and then being destroyed by the container proxy component; or the second container unit being killed by the user during healthy operation due to business needs; or the second container unit exiting automatically when its life cycle expires; or the second container unit being destroyed due to hardware failures such as power failures in the computing node device that carries the second container unit. There are many factors that lead to the failure of the second container unit, and this application does not make specific restrictions.
[0011] For the first container unit that is restarted or rebuilt by the second container unit, the original first IP address of the second container unit is still used, so that before and after the restart or reconstruction, the application corresponding to the second container unit and the first container unit can be normally accessed through the first IP address, thereby ensuring the continuity of the application business.
[0012] Optionally, the container unit management method of the first aspect can be used in the scenario where the container unit corresponding to the first container unit identifier is first established. Therefore, the first container unit can be created by the container proxy component after receiving the instruction to establish the container unit sent by the cluster interface component, and the instruction contains the first container unit identifier. Among them, the cluster interface component is a component existing in the control node device in the k8s platform, which is the interface and communication bus of the k8s platform, responsible for receiving user operation input and event interaction within the carrier platform. Compared with the method of randomly assigning IP addresses, when the container unit corresponding to the first container unit identifier is first established, the first IP address corresponding to the first container unit identifier is assigned to the first container unit, so that the IP addresses in the k8s platform can be reasonably managed and planned, thereby improving the flexibility of IP address management in the k8s platform.
[0013] Optionally, before receiving the first network configuration instruction sent by the container proxy component, the network configuration component also receives a second network configuration instruction sent by the container proxy component, the second network configuration instruction including the first IP address, the network configuration component obtains the first container unit identifier, and sends address specification information to the container management component so that the network management component establishes a correspondence between the first IP address and the first container unit identifier. The optional second network configuration instruction may be the same instruction as the first network configuration instruction in the first aspect, or may be a different instruction.
[0014] The network configuration component obtains the first container unit identifier by obtaining a parameter or a combination of several parameters that can uniquely correspond to the first container unit from the existing container unit parameters of the first container unit as the first container unit identifier of the first container unit; or it can be a unique corresponding container unit identifier generated for the first container unit.
[0015] By triggering the network management component to record the correspondence between the first IP address and the first container unit identifier, when creating the first container unit corresponding to the first container unit identifier, the first IP address is allocated to the first container unit, thereby ensuring the prerequisite for the first container unit to implement fixed IP address.
[0016] Optionally, after the network configuration component sends the container address request to the network management component, it also receives a first virtual local area network identifier sent by the network management component, and the first virtual local area network identifier is an identifier indicating the virtual local area network to which the first container unit is connected. By receiving the first virtual local area network identifier sent by the network management component, the first container unit can be connected to the virtual local area network corresponding to the first virtual local area network identifier according to the first virtual local area network identifier, so as to realize the communication of the first container unit based on the layer 2 network and improve the flexibility of creating a container network.
[0017] Before sending the first virtual LAN identifier, the network management component first obtains the recorded first network identifier corresponding to the first container unit identifier, then obtains the recorded first network information corresponding to the first network identifier, and finally obtains the first virtual LAN identifier from the first network information.
[0018] Optionally, after receiving the first virtual LAN identifier sent by the network management component, the network configuration component configures the first virtual LAN identifier as the identifier of the virtual LAN to which the first port belongs, wherein the first port is a port in the virtual switching device that establishes a connection with the first virtual network adapter, and the configured first port can connect the first container unit to the virtual LAN corresponding to the first virtual LAN identifier. The virtual switching device is a switching device that establishes a connection with the physical network adapter of the computing node device. By configuring the virtual LAN to which the first port belongs, the first container unit is connected to the virtual LAN corresponding to the first virtual LAN identifier.
[0019] Optionally, before the network configuration component receives the first network configuration instruction sent by the container proxy component, it also receives a third network configuration instruction sent by the container proxy component, the third network configuration instruction includes the first network identifier, and then the network configuration component sends network specified information to the network management component, the network specified information includes the first network identifier, so that the network management component establishes a correspondence between the first network identifier and the first container unit identifier according to the network specified information. Optionally, the third network configuration instruction can be the same instruction as the first network configuration instruction in the first aspect, or it can be a different instruction. By triggering the network management component to record the correspondence between the first network identifier and the first container unit identifier, when creating the first container unit corresponding to the first container unit identifier, a container network is constructed for the first container unit according to the network information corresponding to the first network identifier, thereby achieving the fixation of the container's network information and ensuring the network stability of the container unit.
[0020] Optionally, the first network information may also include a first subnet mask and a first gateway address. After the network configuration component sends a container address request to the network management component, the network management component sends the first subnet mask and the first gateway address in the first network information to the network configuration component. The specific method in which the network configuration component performs network configuration on the first virtual network adapter according to the first IP address may be to configure the first IP address as the IP address of the first virtual network adapter, configure the first subnet mask as the subnet mask of the first virtual adapter, and configure the first gateway address as the gateway address of the first virtual adapter. The first subnet mask and the first gateway address are recorded by the network management component to fix the subnet mask and the gateway address in the container unit. After the IP address of the first virtual network adapter is configured, the subnet mask and the gateway address are configured to ensure the normal network adaptation function of the first virtual network adapter.
[0021] Optionally, before the network configuration component obtains the first container unit identifier, it may also obtain the container attribute information of the second container unit. The specific implementation method of the network configuration component obtaining the first container unit identifier may be: the network configuration component determines the first container unit identifier through a first hash operation based on the container attribute information of the second container unit, the first IP address, and the first network identifier. Compared with using a combination of several parameters of the container unit as the first container unit identifier, determining the result of the first hash operation as the first container unit identifier in the above process can save the storage space occupied by the first container unit identifier in the network management component and improve the access efficiency of the network management component to the first container unit identifier.
[0022] Optionally, after the network configuration component sends a container address request to the network management component, the network management component may obtain the first network identifier corresponding to the first container unit identifier recorded, and send the first network identifier to the network configuration component; before the network configuration component performs network configuration on the first virtual network adapter according to the first IP address, the network configuration component may also obtain the container attribute information of the first container unit, and obtain the verification container unit identifier through a first hash operation according to the container attribute information of the first container unit, the first IP address included in the address allocation instruction, and the first network identifier sent by the network configuration component. The network configuration component performs network configuration on the first virtual network adapter according to the first IP address only when it is determined that the verification container unit identifier is consistent with the first container unit identifier. After receiving the address allocation instruction, the network configuration component verifies whether the first IP address in the address allocation instruction is the IP address corresponding to the second container unit before by comparing the verification container unit identifier with the first container unit identifier, thereby ensuring the reliability of the first IP address allocated to the first container unit when the first container unit is rebuilt or restarted after the second container unit fails.
[0023] The second aspect of the present application provides another container unit management method, wherein the network management component receives a container address request sent by the network configuration component, the container address request carries a first container unit identifier, and the network configuration component sends the container address request to the network management component under the triggering of the first network configuration instruction of the container proxy component, and the first network configuration instruction is sent to the network configuration component by the container proxy component after creating the first container unit corresponding to the first container unit identifier; then the network management component obtains the first IP address corresponding to the recorded first container unit identifier; further, the network management component sends the address allocation instruction containing the first IP address to the network configuration component, so that the network configuration component performs network configuration on the virtual network adapter of the first container unit according to the first IP address. Compared with the method of randomly allocating an IP address to the first container unit, the network management component allocates the first IP address corresponding to the first container unit identifier to the first container unit corresponding to the first container unit identifier, so that the IP address of the first container unit can be fixed, providing network guarantee for normal access of applications in the first container unit.
[0024] Among them, the network management component in the second aspect is a component in the control node device in the k8s platform, and the container agent component and the network configuration component can be components existing in the same computing node device in the k8s platform. The network management component is responsible for managing and allocating IP addresses of container units in multiple computing node devices in the k8s platform; the container agent component is responsible for creating, modifying, monitoring, etc. the container units in the computing node device; the network configuration component is responsible for creating and configuring the virtual network adapter of the container unit in the computing node device according to the IP address allocated by the network management component, so as to ensure that the container unit in the computing node device can communicate over the network based on the configured virtual network adapter.
[0025] Optionally, before receiving the container address request sent by the network configuration component, the network management component may also obtain the first IP address and the first container unit identifier, and then record the correspondence between the first IP address and the first container unit identifier. The network management component records the correspondence between the first IP address and the first container unit identifier in advance, and then allocates the first IP address to the first container unit corresponding to the first container unit identifier after receiving the container address request carrying the first container unit identifier, which provides a prerequisite for fixing the container unit IP address.
[0026] Optionally, if the container unit management method of the second aspect is applied in a scenario where the container unit is restarted or rebuilt, then the specific method for the network management component to obtain the first IP address and the first container unit identifier can be that the container management component receives address specification information sent by the network configuration component, and the address specification information includes the first IP address and the first container unit identifier. Among them, the first container unit identifier in the address specification information is sent to the network management component through the address specification information after the network configuration component obtains it. The network configuration component sends the first container unit identifier and the first IP address to the network management component in advance for recording, thereby ensuring that the IP address of the container unit remains unchanged before and after the restart or reconstruction.
[0027] Optionally, if the container unit management method of the second aspect is applied in the scenario where the container unit is first established, then the network management component obtains the first IP address, and the specific method of obtaining the first container unit identifier can be that the container management component receives the first IP address sent by the cluster interface component, and the container management component generates the first container unit identifier. Then, the network management component sends a container identifier allocation instruction to the cluster interface component, and the container identifier allocation instruction includes the first container unit identifier generated by the network management component, so that the cluster interface component sends the first network configuration information including the first container unit identifier to the container proxy component, and then the container proxy component sends the first network configuration instruction to the network configuration component under the triggering of the first network configuration information.
[0028] Among them, the cluster interface component is a component existing in the control node device in the k8s platform. It is the interface and communication bus of the k8s platform and is responsible for receiving the user's operation input and the event interaction within the carrier platform. Before establishing the first container unit, the first IP address specified for the first container unit is sent to the network management component, which generates the first container unit identifier and establishes a corresponding relationship between the first container unit identifier and the first IP address. Compared with the method of randomly assigning an IP address to the container unit when it is created, the IP address in the k8s platform can be reasonably managed and planned, thereby improving the flexibility of IP address management in the k8s platform.
[0029] Optionally, after receiving the container address request sent by the network configuration component, the network management component can also obtain the first network identifier corresponding to the first container unit identifier, and then obtain the first network information corresponding to the first network identifier, the first network information includes a first virtual local area network identifier, and the first virtual local area network identifier can indicate the virtual local area network connected to the first container unit. The first container unit can be connected to the virtual local area network corresponding to the first virtual local area network identifier, so as to realize the communication of the first container unit based on the second layer network and improve the flexibility of container network creation.
[0030] Optionally, after the network management component obtains the first network information corresponding to the first network identifier, it can also send the first virtual local area network identifier to the network configuration component, so that the network configuration component configures the virtual local area network to which the first port belongs according to the first virtual local area network identifier. The first port is a port in a virtual switching device that is connected to the first virtual adapter, and the virtual switching device is a switching device that is connected to the physical network adapter of the computing node device. By configuring the virtual local area network to which the first port belongs, the first container unit is connected to the virtual local area network corresponding to the first virtual local area network identifier.
[0031] Optionally, before the network management component receives the container address request sent by the network configuration component, the network management component may also receive the first network identifier, and then record the correspondence between the first network identifier and the first container unit identifier. Wherein, if the container unit management method of the second aspect is applied in a scenario where the container unit is restarted or rebuilt, the network management component may receive the first network identifier sent by the network configuration component; if the container unit management method of the second aspect is applied in a scenario where the container unit is first established, the network management component may receive the first network identifier sent by the cluster interface component. Optionally, the network management component pre-records the correspondence between the first network identifier and the first container unit identifier, so that when creating the first container unit corresponding to the first container unit identifier, a container network can be constructed for the first container unit according to the network information corresponding to the first network identifier, thereby achieving the fixation of the container's network information and ensuring the network stability of the container unit.
[0032] Optionally, before the network management component receives the container address request sent by the network configuration component, the network management component may also receive a network information storage instruction, the network information storage instruction carries the first network information, the network management component generates a first network identifier corresponding to the first network information, and records the correspondence between the first network information and the first network identifier. The network information storage instruction may be sent by the cluster interface component to the network management component.
[0033] Optionally, the first network information may also include a first subnet mask and a first gateway address. After receiving the container address request sent by the network configuration component, the network management component may also send the first subnet mask and the first gateway address to the network configuration component, so that the network configuration component configures the subnet mask of the first virtual adapter according to the first subnet mask and configures the gateway address of the first virtual adapter according to the first gateway address. The network management component fixes the subnet mask and the gateway address of the first container unit by sending the first subnet mask and the first gateway address to the network configuration component, thereby ensuring the normal network adaptation function of the first virtual network adapter.
[0034] A third aspect of the present application provides a computing node device, which includes a network configuration component and a container agent component, and is used to implement the method in the above-mentioned first aspect and its various implementation methods.
[0035] Optionally, the computing node device may implement part or all of the possible implementations of the first aspect based on the network configuration component and the container agent component included therein.
[0036] A fourth aspect of the present application provides a control node device, comprising a network management component, for implementing the method in the above-mentioned second aspect and its various implementation methods.
[0037] A fifth aspect of the present application provides a computing node device, including: a processor and a memory;
[0038] The processor is connected to a memory, wherein the memory is used to store program codes, and the processor is used to execute the program codes stored in the memory to implement the methods in the above-mentioned first aspect and its various implementation modes.
[0039] A sixth aspect of the present application provides a control node device, including: a processor and a memory;
[0040] The processor is connected to a memory, wherein the memory is used to store program codes, and the processor is used to execute the program codes stored in the memory to implement the methods in the above-mentioned second aspect and its various implementation modes.
[0041] A seventh aspect of the present application provides a container unit management system, which includes the computing node device of the third aspect and the control node device of the fourth aspect.
[0042] An eighth aspect of the present application provides a container unit management system, which includes the computing node device of the fifth aspect and the control node device of the sixth aspect.
[0043] The ninth aspect of the present application provides a computer-readable medium, which stores program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect and any possible implementation thereof.
[0044] The tenth aspect of the present application provides a computer-readable medium, which stores program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned second aspect and any possible implementation thereof.
[0045] In an eleventh aspect of the present application, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is run on a computer, the computer executes the method in the above-mentioned first aspect and any possible implementation manner thereof.
[0046] A twelfth aspect of the present application provides a computer program product, which includes: a computer program code, which, when executed on a computer, enables the computer to execute the method in the second aspect and any possible implementation thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 It is a schematic diagram of the architecture of a container unit management system provided in an embodiment of the present application;
[0049] Figure 2 This is a schematic diagram of the architecture of a k8s platform provided in an embodiment of the present application;
[0050] Figure 3 This is a schematic diagram of the architecture of a container unit management system based on the k8s platform provided in an embodiment of the present application;
[0051] Figure 4 It is a flow chart of a container unit management method provided in an embodiment of the present application;
[0052] Figure 5 It is a flowchart of another container unit management method provided in an embodiment of the present application;
[0053] Figure 6 is a schematic diagram of a process for recording first network information provided by an embodiment of the present application;
[0054] Figure 7 It is a schematic diagram of a process of a network management component retrieving first network information provided by an embodiment of the present application;
[0055] Figure 8 is a schematic diagram of a process of retrieving first network information by another network management component provided in an embodiment of the present application;
[0056] Fig. 9 It is a flowchart of another container unit management method provided in an embodiment of the present application;
[0057] Fig.10 It is a structural diagram of a computing node device provided in an embodiment of the present application;
[0058] Fig.11 is a structural diagram of another computing node device provided in an embodiment of the present application;
[0059] Fig.12 It is a structural diagram of a control node device provided in an embodiment of the present application;
[0060] Fig.13 It is a structural diagram of another control node device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0062] Before introducing the container unit management method of the embodiment of the present application, the system architecture for implementing the method is first introduced. Figure 1 , Figure 1 is a schematic diagram of the architecture of a container unit management system provided by an embodiment of the present application, such as Figure 1 As shown, the container unit management system may include a network configuration component 001, a container agent component 002 and a network management component 003. The network configuration component 001 establishes communication connections with the container agent component 002 and the network management component 003. The container unit in the embodiment of the present application is a process in a computer that carries an application.
[0063] The container proxy component 002 is a component having management functions such as creation and deletion of container units. The container proxy component 002 is used to create a first container unit corresponding to the first container unit identifier, and after the first container unit is created, send a first network configuration instruction to the network configuration component 001. The first network configuration instruction includes the first container unit identifier, which is a globally unique container unit identifier in the container unit management system, that is, in the container unit management system, one container unit identifier is uniquely corresponding to one container unit.
[0064] The network configuration component 001 is a component for creating and configuring a network adapter for a container unit. The network configuration component 001 is used to receive a first network configuration instruction sent by the container agent component 002; and then send a container address request to the network management component 003, the container address request carries a first container unit identifier, so as to request an IP address from the network management component 003 for the first container unit. The network configuration component 001 is also used to create a first virtual network adapter for the first container unit, and the first virtual network adapter can be a virtual network card (vNIC).
[0065] The network management component 003 is a component that manages and allocates available address segments of container units. The network management component 003 is used to receive the container address request sent by the container proxy component 001, and obtain the first IP address corresponding to the first container unit identifier recorded; and then send an address allocation instruction carrying the first IP address to the network configuration component 001.
[0066] After receiving the container address request sent by the network management component 003, the network configuration component 001 can also be used to perform network configuration on the first virtual network adapter according to the first IP address. After the network configuration is completed, the first virtual network adapter can support the communication of the first container unit, such as encapsulating and decapsulating the communication data of the first container unit, link management, serial-to-parallel conversion, encoding and decoding, etc.
[0067] Based on the container unit management system provided in the embodiment of the present application, the first IP address can be accurately assigned to the first container unit corresponding to the first container unit identifier, so as to fix the IP address of the container unit and ensure that the application carried by the container unit based on IP address mutual access can be accessed normally.
[0068] In some optional implementations, the architecture of the container unit management system of the embodiment of the present application can be built on the k8s platform. First, the basic architecture of the k8s platform is introduced. K8s is a container cluster management system, and pod is the smallest unit deployed, created or managed on the k8s platform. The K8s platform is usually a computer cluster (cluster), which contains multiple computer nodes. These multiple computer nodes are usually divided into two roles, control nodes (master) and computing nodes (worker). The control node is mainly responsible for the management and control of the nodes on the k8s platform, and the computing node is mainly responsible for carrying the pod running tasks in the k8s platform. In the specific deployment, the above-mentioned control node and computing node can be a physical machine node or a virtual machine node.
[0069] See also Figure 2 , Figure 2 This is a schematic diagram of the architecture of a k8s platform provided in an embodiment of the present application, as shown in the figure, Figure 2The k8s platform in exemplarily includes a control node 100 and three computing nodes, and the three computing nodes are computing node 200, computing node 300 and computing node 400. The control node 100, computing node 200, computing node 300 and computing node 400 can establish network connections between each other.
[0070] like Figure 2 As shown, the control node 100 includes a cluster interface component (API server) 1001, a scheduling component (scheduler) 1002, a control management component (controller manager) 1003, a storage component (etcd) 1004 and a network management component (CNI master) 1005, wherein:
[0071] The cluster interface component 1001 is the communication bus of the k8s platform. It can interact with other components in the cluster and receive user operations on the k8s platform through command line tools (kubectl). It is also the only component that can access the storage component. Other components can only indirectly operate the storage component through the cluster interface component.
[0072] The scheduling component 1002 is the component responsible for scheduling decisions in the k8s platform. It is responsible for allocating newly released application requests to corresponding computing nodes through the scheduling decision algorithm according to the resource usage in the cluster, and publishing task events to corresponding computing nodes through the cluster interface component 1001;
[0073] The control management component 1003 is a component that ensures the final consistency of the cluster status in the k8s platform. It monitors the cluster status through the cluster interface component to ensure that the actual status is consistent with the expected status.
[0074] The storage component 1004 is used to store all cluster status data in the k8s platform, including pod configuration data, task allocation data, etc.
[0075] The network management component 1005 is a component derived from the k8s platform during later use, which is used to manage and allocate pod IP addresses.
[0076] The computing nodes 200, 300, and 400 may have components of the same functional type. The computing node 200 is taken as an example for description. Figure 2 As shown, the computing node 200 includes a container proxy component (kubelet) 2001, a service proxy component (kube-proxy) 2002, a container runtime component (container runtime) 2003 and a network configuration component (CNI plugin) 2004, wherein:
[0077] The container proxy component 2001 is a resource management component in the computing node 200. It monitors the task events issued by the cluster interface component 1001 in the control node 100, and then starts or shuts down the pod according to the task time;
[0078] The service proxy component 2002 is responsible for managing the services in k8s and is a component that implements the communication and load balancing mechanism of services in the k8s platform;
[0079] The container runtime component 2003 is the container creation engine in the computing node 200 and is also the container resource manager of the computing node 200. In fact, the container proxy component 2001 does not directly manage the container resources of the node, but entrusts the container runtime component 2003 to manage, such as starting and closing containers;
[0080] The network configuration component 2004 is responsible for creating a virtual network card for the pod in the computing node 200 and configuring the virtual network card according to the IP address allocated by the network management component 1005 in the control node 100.
[0081] Next, we will introduce the system architecture built on the k8s platform for implementing the container unit management method in the embodiment of the present application. Figure 3 , Figure 3 It is a schematic diagram of the architecture of a container unit management system based on the k8s platform provided in an embodiment of the present application. In the case where the system architecture is built based on k8s, the container unit involved in the embodiment of the present application can be a pod in the k8s platform.
[0082] The system architecture can be built based on the control node and any computing node of the k8s platform, such as Figure 3 As shown, the container unit management system may include a network management component 2011 in the control node 201, a container agent component 2021 and a network configuration component 2022 in the computing node 202;
[0083] Optionally, a cluster interface component 2012 in the control node 201 may also be included;
[0084] Optionally, the virtual switching device 2027 in the computing node 202 and the pod created by the container proxy component 2021 and the virtual network adapter corresponding to the pod may also be included. Figure 3 Pod 2023 and pod 2024 are exemplarily shown, as well as virtual network adapter 2025 and virtual network adapter 2026 corresponding to the two pods respectively;
[0085] Optionally, a physical network adapter 2028 may also be included.
[0086] For the relevant introduction of the network management component 2011 and the cluster interface component 2012 in the control node 201, and the container proxy component 2021 and the network configuration component 222 in the computing node 202, please refer to Figure 2 The introduction of the corresponding components in will not be repeated here. Optionally, in combination with the pod, virtual network adapter, virtual switching device 2027 and physical network adapter 2028, the container network for pod communication in the computing node 202 is introduced.
[0087] The physical network adapter 2028 can be a physical network card of the computing node 202. It is a device that supports the in and out traffic of the node, and is also a device that supports IP addressing and interaction between the computing node 202 and other nodes in the k8s platform.
[0088] After the container proxy component 2021 establishes a pod, if it directly declares to use the physical network adapter 2028 of the computing node 202, it may cause conflicts in the use of network resources by different pods. Therefore, it is necessary to isolate the network resources of different pods and isolate them in different network namespaces with their own corresponding IP addresses and ports. At this time, the network configuration component 2022 is required to create respective virtual network adapters (such as virtual network cards vNIC) for different pods and perform network configuration on the respective virtual network adapters so that the pods can communicate.
[0089] After the virtual network adapter of the Pod is established, if different pods want to communicate with each other, they need to connect the pods in the computing node 202 through the virtual switching device (vSwitch) 2027, so that the pods in the computing node 202 can communicate with each other. If the pod in the computing node 202 needs to communicate with the communication nodes outside the computing node 202 (including the pods in other computing nodes in the k8s platform, and also including the communication nodes outside the k8s platform), the virtual switching device needs to be connected to the physical network adapter 2028 of the computing node 202, and then the virtual switching device can forward the traffic for communicating with the communication nodes outside the computing node 202 to the physical network adapter 2028, and the physical network adapter 2028 forwards it to the corresponding communication node, thereby realizing the communication between the pod in the computing node 202 and the communication nodes outside the computing node 202.
[0090] based on Figure 1 or Figure 3 Corresponding system architecture implementation, the present application embodiment provides a container unit management method, see Figure 4 , Figure 4is a flow chart of a container unit management method provided in an embodiment of the present application, such as Figure 4 As shown, the container unit management method may include steps S401-S404.
[0091] S401: The container proxy component sends a first network configuration instruction to the network configuration component.
[0092] Optionally, the first network configuration instruction is sent by the container proxy component to the network configuration component after the container proxy component creates the first container unit corresponding to the first container unit identifier. The container proxy component may create the first container unit when receiving an instruction to create a container unit for the first container unit identifier; or may create the first container unit when the container proxy component determines that the container unit corresponding to the first container unit identifier needs to be restarted or rebuilt during monitoring of the created container units.
[0093] Among them, the first network configuration instruction includes a first container unit identifier, and the container proxy component can obtain the container unit configuration information corresponding to the first container unit identifier, and then create the first container unit according to the obtained container unit configuration information. The process of the container proxy component creating the first container unit includes allocating system resources to the first container unit according to the system resource requirement information configured in the container unit configuration information, and then loading the image specified in the container unit configuration information based on the allocated system resources. For example, the specified image can be a database application image. After loading the image, the first container unit can provide database services as a database; it can also be a blockchain node application image. After loading the image, the first container unit can provide blockchain node services as a deployed blockchain node.
[0094] S402: The network configuration component sends a container address request to the network management component.
[0095] Optionally, after receiving the first network configuration instruction sent by the container proxy component, the network configuration component extracts the first container unit identifier in the first network configuration instruction, and then sends a container address request carrying the first container unit identifier to the network management component.
[0096] S403, the network management component sends an address allocation instruction to the network configuration component.
[0097] Optionally, after receiving the container address request, the network management component can extract the first container unit identifier contained in the container address request, and then search and obtain the first IP address corresponding to the first container unit identifier from the recorded correspondence between the container unit identifier and the IP address, and then send the address allocation instruction carrying the first IP address to the network configuration component.
[0098] The correspondence between the first container unit identifier and the first IP address recorded by the network management component may be that the cluster interface component sends the first container unit identifier and the first IP address to the network management component in advance, and the network management component then establishes and records the correspondence between the first container unit identifier and the first IP address. Alternatively, the network configuration component sends the first container unit identifier and the first IP address to the network management component in advance, and the network management component then establishes and records the correspondence between the first container unit identifier and the first IP address. Alternatively, the cluster interface component sends the first IP address to the network management component, and the network management component generates the first container unit identifier, and then establishes and records the correspondence between the first container unit identifier and the first IP address.
[0099] S404: The network configuration component creates a first virtual network adapter of the first container unit, and performs network configuration on the first virtual network adapter according to the first IP address.
[0100] The network configuration component creates the first virtual network adapter, which can be executed after receiving the address allocation instruction sent by the network configuration component in S403; or it can be executed in parallel with sending the container address request to the network management component in S402 after receiving the first network configuration instruction in S401. After extracting the first IP address in the address allocation instruction, the first IP address is set as the IP address of the first virtual network adapter.
[0101] In some implementations, the network configuration component may also obtain a first subnet mask and a first gateway address configured for the first container unit, and when performing network configuration for the first virtual network adapter, configure the first subnet mask as the subnet mask of the first virtual network adapter, and configure the first gateway address as the gateway address of the first virtual network adapter. The first subnet mask may be used to determine the network segment where the first virtual network adapter is located when the first virtual network adapter forwards the communication data packet of the first container unit; the first gateway address may be used to determine the last hop gateway node of the communication data packet leaving the network segment where the first virtual network adapter is located when the first container unit communicates with a communication node outside the network segment where the first virtual network adapter is located.
[0102] After the network configuration component completes the network configuration of the first virtual network adapter, the first virtual network adapter is connected to the virtual switching device in the same computing node. Then, the first container unit can communicate through the first virtual network adapter and the virtual switching device in the same computing node during operation.
[0103] Optionally, the network configuration component establishes a connection between the first virtual network adapter and the virtual switching device by creating a set of virtual Ethernet device pairs (vEth pairs). Assuming that the created set of vEth pairs includes veth0 and veth1, veth0 and veth1 can be regarded as the two ends of the same virtual network cable. By plugging veth0 into the first virtual network adapter and plugging veth1 into the virtual switching device, a connection between the first virtual network adapter and the virtual switching device is established.
[0104] In the embodiment of the present application, after receiving the first network configuration instruction carrying the first container unit identifier sent by the container component, the network configuration component sends a container address request containing the first container unit identifier to the network management component, so that the network management component obtains the first IP address corresponding to the first container unit identifier recorded, and sends the address allocation instruction carrying the first IP address to the network configuration component, so that the network configuration component can use the first IP address allocated by the network management component according to the first container unit identifier to perform network configuration on the first virtual network adapter after creating the first virtual network adapter. The correspondence between the first container unit identifier and the first IP address is recorded by the network management component, and the first IP address allocated by the network management component can be obtained at any time when the IP address corresponding to the first container unit identifier is requested from the network management component. The IP address of the container unit corresponding to the first container unit identifier is fixed, which avoids the problem that the application in the container unit cannot be accessed normally due to the randomization of the IP address, and provides network guarantee for the normal access of the application in the container unit.
[0105] See also Figure 5 , Figure 5 It is a flowchart of another container unit management method provided by an embodiment of the present application. In a possible implementation scenario, the execution subject involved in the container unit management method in the embodiment of the present application includes at least the container proxy component and network configuration component of the first computing node in the k8s platform (the first computing node can be any computing node in the k8s platform), and the network management component and cluster interface component of the control node in the k8s platform. Figure 5 As shown, the method may include steps S501 to S514.
[0106] S501: The cluster interface component publishes a first container creation task to the container proxy component, and sends container address configuration information to the container proxy component.
[0107] When a user of the k8s platform publishes a new task to create a container unit, the publishing request can be submitted to the cluster interface component through the command line tool in the control node, etc., and the publishing request can include the configuration information of the container unit to be created. When the scheduling component in the control node monitors that there is a new publishing request in the cluster interface component, the first computing node is determined as the computing node that executes the new publishing request from multiple computing nodes of the k8s platform according to the preset scheduling strategy. The scheduling component also sends the binding relationship between the first computing node and the new publishing request to the cluster interface component, and the binding relationship between the first computing node and the new publishing request is stored in the storage component through the cluster interface component. The container proxy component in the first computing node can obtain the list of container units that the first computing node needs to run stored in the storage component through the cluster interface component at regular intervals, and the list contains the new publishing request. Furthermore, the container proxy component of the first computing node finds that the container unit has not been created for the new publishing request by comparing the list with the container units actually running in the first computing node, and then the first container creation task for the new publishing request is obtained.
[0108] The container address configuration information includes the first IP address corresponding to the first container creation task. Before sending the container address configuration information, the cluster interface component receives the first IP address input by the user. The first IP address may be submitted to the container proxy component through the above-mentioned new publishing request, or may be sent to the cluster interface component by the user through other instructions. Then, the cluster interface component sends the container address configuration information carrying the first IP address to the container proxy component.
[0109] S502: The container proxy component creates a first container unit corresponding to a first container creation task.
[0110] Optionally, the container proxy component creates the first container unit through the container runtime component by calling the container runtime interface in the first computing node. The optional container runtime component can be any existing container engine that supports the k8s platform. This embodiment does not specifically limit the type of container runtime component.
[0111] S503: The container proxy component sends a first network configuration instruction to the network configuration component, where the first network configuration instruction carries the first IP address.
[0112] Optionally, after creating the first container unit, the container proxy component calls the network configuration component and sends a first network configuration instruction carrying the first IP address to the network configuration component, so that the network configuration component configures the first IP address as the IP address for communication of the first container unit.
[0113] S504: The network configuration component creates a first virtual network adapter of the first container unit, and performs network configuration on the first virtual network adapter according to the first IP address.
[0114] Optionally, the network configuration component sets the first IP address as the IP address of the first virtual network adapter. Further, the network configuration component can obtain a first subnet mask and a first gateway address, configure the first subnet mask as the subnet mask of the first virtual network adapter, and configure the first gateway address as the gateway address of the first virtual network adapter.
[0115] After the network configuration component completes the network configuration of the first virtual network adapter, the first virtual network adapter is connected to the virtual switching device in the first computing node. Then, the first container unit can communicate through the first virtual network adapter and the virtual switching device in the first computing node during operation.
[0116] S505: The network configuration component obtains a first container unit identifier.
[0117] In a specific implementation, there are multiple ways for the network configuration component to obtain the first container unit identifier. In an optional acquisition method, the container configuration component can select one or more parameters from the existing parameters in the container attribute information of the first container unit as the first container unit identifier. After creating the first container unit, the container proxy component generates multiple container unit parameters of the first container unit, such as the name of the container unit (pod name), the namespace of the container unit (podnamespace), the image corresponding to the container unit (image), the port number of the container unit (containerPort), etc. These container unit parameters are recorded in the storage component by the container proxy component through the cluster interface component in the form of container unit objects.
[0118] Furthermore, the network configuration component can obtain one or more container unit parameters that can uniquely correspond to the first container unit recorded by the storage component through the cluster interface component, and use this container unit parameter, or a combination of multiple container unit parameters, as the first container unit identifier. For example, the k8s platform divides the resources within the platform to different user groups through the pod namespace, and the pod name under the same pod namespace is unique. Therefore, the podnamespace and pod name can uniquely correspond to a container unit, and the combination of the container unit parameters of the podnamespace and pod name containing the first container unit can be used as the first container unit identifier of the first container unit.
[0119] In another optional acquisition method, the first container unit identifier can be a globally unique identifier in the k8s platform generated by the network configuration component for the first container unit. In an optional generation and acquisition method, the network configuration component can obtain the first container unit identifier in the form of a universally unique identifier (Universally Unique Identifier, UUID). UUID has different versions (UUID version), and different versions correspond to different algorithms. For example, UUID Version 1 corresponds to a time-based UUID, UUID Version 2 corresponds to a DCE security-based UUID, UUID Version 3 corresponds to a name-based UUID (calculated by the MD5 hash algorithm), UUID Version 4 corresponds to a random UUID, UUID Version 5 corresponds to a name-based UUID (calculated by the SHA1 hash algorithm), and so on. Optionally, the first container unit identifier corresponding to the first container unit, which is globally unique in the k8s platform, can be obtained through any UUID algorithm.
[0120] In another optional generation and acquisition method, the network configuration component can generate the first container unit identifier according to the container unit parameters and the first IP address in the container attribute information of the first container unit through a specified first hash operation. For example, the first IP address is recorded as port-IP, and the network configuration component can obtain the pod name of the first container unit and the pod namespace of the first container unit, and use the calculated pod-port-ID as the first container unit identifier through the formula pod-port-ID=Hash(pod name,pod namespace,port-IP). Optionally, the first hash operation can be any hash operation. The parameters involved in the hash operation in the formula are not limited to these three types. For example, they can also include the loaded image (image) and the port number (containerPort) of the container unit. Then, optionally, the calculation formula can be pod-port-ID=Hash(pod name,pod namespace,image,containerPort,port-IP). Further optionally, the arrangement order of the parameters involved in the first hash operation in the above two formulas for calculating pod-port-ID is not limited to the arrangement order exemplified in the above two formulas, and any arrangement order can be set, which is not limited here.
[0121] S506: The network configuration component sends address designation information to the network management component. The address designation information includes a first IP address and a first container unit identifier.
[0122] S507: The network management component establishes a correspondence between the first IP address and the first container unit identifier.
[0123] After receiving the address designation information, the network management component establishes and stores a correspondence between the first IP address and the first container unit identifier.
[0124] Steps S505 to S507 are executed in sequence. There is no restriction on the execution order of step S504 and steps S505 to S507. Step S504 can be executed at any time after executing step S503 and before executing step S508.
[0125] S508: The container proxy component obtains a second container creation task.
[0126] Before step S508, the first container unit is the container unit that uniquely corresponds to the first container unit identifier. Optionally, the second container creation task is a task to rebuild or restart the container unit for the first container unit identifier in the event that the first container unit fails. There are many factors that lead to the failure of the first container unit. For example, the failure of the first container unit may be that the first container unit is in an unhealthy operating state due to its own defects during operation, and is then destroyed by the container proxy component; it may also be that the first container unit is killed by the user during a healthy operation due to business needs; it may also be that the first container unit exits automatically when its life cycle expires; it may also be that the computing node device that hosts the first container unit has a hardware failure such as a power outage, which leads to the destruction of the first container unit. The specific failure factors are not specifically limited in the embodiments of the present application.
[0127] Since the failure of the first container unit may have various effects, there are also various ways to obtain the second container creation task. The second container creation task may be issued by the cluster interface component to the container proxy component or generated by the container proxy component itself.
[0128] In one implementation, the control management component in the control node can monitor the operating status of the container units in each computing node in the k8s platform through the cluster agent component. When it is monitored that the first container unit in the first computing node has an operating failure, it can issue a second container creation task to the container agent component in the first computing node.
[0129] In another implementation, the cluster proxy component can receive a container process destruction instruction for the first container unit identifier sent by the user, and then the cluster proxy component can send a destruction instruction for the first container unit to the container proxy component of the first computing node, and the container proxy component of the first computing node can destroy the first container unit according to the destruction instruction. Or the first container unit has its own life cycle and exits automatically at the end of the life cycle. When the cluster proxy component receives a container start instruction for the first container unit identifier sent by the user, it can issue a second container creation task to the container proxy component of the first computing node.
[0130] In another implementation, the container agent component of the first computing node may monitor the container unit in the first computing node, and when it is detected that the first container unit is in an abnormal state, it may automatically generate a second container creation task to be executed.
[0131] S509: The container proxy component creates a second container unit corresponding to the first container unit identifier.
[0132] Specifically, the container proxy component may obtain the container unit configuration information corresponding to the first container unit according to the first container unit identifier, and thus create the second container unit according to the obtained container unit configuration information.
[0133] S510: The container proxy component sends a second network configuration instruction to the network configuration component, where the second network configuration instruction includes a first container unit identifier.
[0134] S511, the network configuration component sends a container address request to the network management component, where the container address request carries a first container unit identifier.
[0135] S512: The network management component obtains the first IP address corresponding to the first container unit identifier of the record.
[0136] Optionally, the network management component extracts the first container unit identifier in the container address request, and acquires the first IP address corresponding to the first container unit identifier according to the correspondence between the first container unit identifier and the first IP address recorded in step S507.
[0137] S513: The network management component sends an address allocation instruction including the first IP address to the network configuration component.
[0138] S514: The network configuration component creates a second virtual network adapter of the second container unit, and performs network configuration on the second virtual network adapter according to the first IP address.
[0139] After the network configuration component completes the network configuration of the second virtual network adapter, it establishes a connection between the second virtual network adapter and the virtual switching device in the first computing node.
[0140] For specific implementations of steps S510 to S514, please refer to Figure 4 The specific implementation of steps S401 to S404 in the corresponding embodiment will not be repeated here.
[0141] In an optional implementation, if the network configuration component in S505 obtains the first container unit identifier by generating the first container unit identifier through a specified first hash operation based on the container unit parameters of the first container unit and the first IP address, then the network configuration component may also verify the first IP address before performing network configuration on the second virtual network adapter, and perform network configuration on the second virtual network adapter based on the first IP address after the verification is passed.
[0142] The specific verification method may be: the network configuration component may obtain the corresponding container unit parameters in the container attribute information of the second container unit, and obtain the verification container unit identifier through a first hash operation based on the container unit parameters of the second container unit and the first IP address, and confirm that the verification is successful when the first container unit identifier and the verification container unit identifier are consistent.
[0143] In the embodiment of the present application, after the network management component initially creates the first container unit corresponding to the first container unit identifier, it records the first container unit identifier and the first IP address of the first container unit. When restarting or rebuilding the container unit corresponding to the first container unit identifier, the network management component can re-assign the first IP address recorded corresponding to the first container unit identifier to the second container unit created for the first container unit identifier. In the process of creating container units for the first container unit identifier multiple times, the first IP address is fixedly assigned to the container unit corresponding to the first container unit identifier, thereby achieving IP address fixation and avoiding abnormal container unit access caused by random IP address assignment.
[0144] In some optional implementations, before step S501, the container unit management method provided in this embodiment may include a process in which the network management component records the first network information (i.e., the network information corresponding to the first network identifier). The first network information may be recorded in correspondence with the first network identifier through the network management component, and the corresponding first network information may be retrieved according to the first network identifier during the process of network configuration of the container unit, and the network parameters in the first network information may be used by the network configuration component for network configuration. The recording process of the first network information and the retrieval scenario of the first network information are introduced below.
[0145] First, the recording process of the first network information is introduced, see Figure 6 , Figure 6 This is a flow chart of recording first network information provided by an embodiment of the present application. As shown in the figure, the process of recording first network information may include steps S601-S603.
[0146] S601: The cluster interface component receives a network information storage instruction, where the network information storage instruction carries first network information.
[0147] Optionally, the network information storage instruction received by the cluster interface component may be input by the user through a command line tool, and the first network information may include the network parameters for building the container network configured by the user. For example, the first network information may include a network name, a gateway IP address, a subnet mask, and an available address segment (start IP / end IP). Optionally, if a container network based on Layer 2 is built, the first network information may also include the LAN ID (VLAN ID or segment ID) to be added.
[0148] S602: The cluster interface component sends first network information to the network management component.
[0149] S603: The network management component obtains a first network identifier corresponding to the first network information, and establishes a corresponding relationship between the first network information and the first network identifier.
[0150] After the network management component obtains the first network information in the network information storage instruction, it verifies the legitimacy of the network parameters in the first network information, such as verifying whether the gateway address in the first network information is in the same network segment as the available address segment, etc. After the legitimacy verification is passed, the first network identifier is obtained.
[0151] The first network ID is a globally unique network ID in the k8s platform. In one acquisition method, the network management component can generate the first network ID by itself after receiving the network information storage instruction. For example, the first network ID in the form of a UUID can be generated. In another acquisition method, the first network ID can also be a globally unique network ID input by the user. When receiving the first network ID input by the user, its global uniqueness can be judged. Only when it is confirmed that it is a globally unique network ID, it is confirmed that the acquisition of the first network ID is successful.
[0152] The following are two scenarios for retrieving and using FirstNet information:
[0153] In a retrieval scenario, the network management component can obtain the first network information corresponding to the first network identifier according to the received first network identifier specified by the user when targeting the first container unit, and then send the relevant parameters in the first network information to the network configuration component for network configuration. For example, the subnet mask and gateway address in the first network information are sent to the network configuration component so that the network configuration component uses them as the first subnet mask and the first gateway address respectively, and performs Figure 5 The action of performing network configuration on the first virtual network adapter in the corresponding embodiment. For another example, when creating a layer 2 communication network of the container, the local area network identifier in the first network information is sent to the network configuration component, so that the network configuration component configures the layer 2 communication port of the first container unit.
[0154] The process of the network management component retrieving the first network information according to the first network identifier during the process of establishing the first container unit can be found in Figure 7 , Figure 7 is a flow chart of a network management component retrieving first network information provided by an embodiment of the present application, such as Figure 7 As shown, the process of the network management component retrieving the first network information may include the following steps S701-S705, which may be Figure 5 In the illustrated embodiment, it is performed before step S508.
[0155] S701: The cluster interface component sends network parameter configuration information to the container proxy component. The network parameter configuration information includes a first network identifier corresponding to a first container creation task.
[0156] Before sending the network parameter configuration information, the cluster interface component receives a first network identifier specified by the user, which may be submitted to the container proxy component through a new publishing request input by the user in the specific implementation method of step S501, or the user may send it to the cluster interface component through other instructions. Then, the cluster interface component sends the network parameter configuration information to the container proxy component.
[0157] S702: The container proxy component sends a third network configuration instruction to the network configuration component, where the third network configuration instruction carries the first network identifier.
[0158] The third network configuration instruction can be used with Figure 5 The first network configuration instruction in S503 in the corresponding embodiment may be the same instruction or may be different instructions.
[0159] Optionally, if Figure 5In the corresponding embodiment, the way in which the network configuration component obtains the first container unit identifier in S505 is to generate the first container unit identifier through a specified first hash operation based on the container unit parameters of the first container unit and the first IP address. Then, in an optional way, the network configuration component can determine the first container unit identifier pod-port-ID through the formula pod-port-ID=Hash(pod name, pod namespace, network id, port-IP), where network id is the first network identifier.
[0160] S703: The network configuration component sends network designation information to the network management component, where the network designation information includes a first network identifier.
[0161] Among them, network specified information and Figure 5 The address specifying information in S506 in the corresponding embodiment may be the same information or different information. If it is different information, the network specifying information may further include the first container unit identifier.
[0162] S704: The network management component obtains the recorded first network information corresponding to the first network identifier, and sends the network parameters in the first network information to the network configuration component.
[0163] S705, the network configuration component performs network configuration according to the network parameters sent by the network management component.
[0164] Optionally, if the network parameters sent by the network management component to the network configuration component are the subnet mask and the gateway address, the network configuration component may Figure 5 The specific implementation method in S504 in the illustrated embodiment performs network configuration.
[0165] If the network parameter sent by the network management component to the network configuration component is a virtual LAN identifier, the configuration of the second-layer container network is implemented through the following process: the network configuration component configures the received virtual LAN identifier (recorded as the first virtual LAN identifier) as the identifier of the virtual LAN to which the first port belongs. Among them, the first port is the port in the virtual switching device of the first computing node that establishes a connection with the first virtual network adapter. Specifically, the first port can be a port of the virtual Ethernet device (veth) inserted in the virtual switching device when the virtual switching device establishes a connection with the first virtual network adapter. By configuring the first port, the first container unit can be connected to the virtual LAN corresponding to the above-mentioned first virtual LAN identifier.
[0166] Optionally, after receiving the specified first network identifier, the network management component can establish a correspondence between the first network identifier and the first container unit identifier. Therefore, in another retrieval scenario, the network management component can also obtain the first network information corresponding to the first network identifier during the process of rebuilding the container unit (i.e., the second container unit) corresponding to the first network identifier, and then send the relevant parameters in the first network information to the network configuration component for network configuration. For example, the subnet mask and gateway address in the first network information are sent to the network configuration component so that the network configuration component uses them as the first subnet mask and the first gateway address, respectively, to perform Figure 5 The action of performing network configuration on the second virtual network adapter in the corresponding embodiment. For another example, when creating a layer 2 container communication network, the local area network identifier in the first network information is sent to the network configuration component so that the network configuration component configures the layer 2 communication port of the second container unit.
[0167] The process of the network management component retrieving the first network information according to the first network identifier during the process of establishing the second container unit can be seen in Figure 8 .like Figure 8 As shown, the process of the network management component acquiring the first network information may include the following steps S801-S804, which may be Figure 5 In the illustrated embodiment, S511 is executed after receiving a container address request carrying the first container unit identifier.
[0168] S801: The network management component obtains a first network identifier corresponding to a first container unit identifier of a record.
[0169] S802: The network management component obtains recorded first network information corresponding to the first network identifier.
[0170] S803: The network management component sends the network parameters in the first network information to the network configuration component.
[0171] Optionally, the network parameter may be a subnet mask and a gateway address in the first network information, or may be a virtual local area network identifier in the first network information.
[0172] S804, the network configuration component performs network configuration according to the network parameters sent by the network management component.
[0173] If the network parameters received by the network configuration component are a subnet mask and a gateway address, the network configuration component configures the received subnet mask as the subnet mask of the second virtual network adapter and configures the received gateway address as the gateway address of the second virtual network adapter after creating the second virtual network adapter of the second container unit.
[0174] If the network parameter received by the network configuration component is a virtual local area network identifier, the received virtual local area network identifier is configured as the identifier of the virtual local area network to which the second port belongs. The second port is a port in the first computing node that establishes a connection with the second virtual network adapter. By configuring the second port, the second container unit can be connected to the virtual local area network corresponding to the first virtual local area network identifier.
[0175] In the embodiments of this application Figure 8 In the corresponding implementation process, during the container unit creation process for the first container unit identifier performed multiple times, the same network parameters can be configured for the container unit corresponding to the first container unit identifier, thereby ensuring the stability of the network information applied in the container unit.
[0176] In another possible implementation scenario, Figure 5 In the corresponding embodiment, steps S501 to S507 are steps in which the corresponding execution components in the control node of the k8s platform interact with the corresponding execution components in the first computing node of the k8s platform. After step S507, when the control management component in the control node monitors the failure of the first computing node (such as power failure) through the cluster interface component, the cluster interface component selects the second computing node that meets the scheduling strategy from other computing nodes other than the first computing node in the k8s platform through the scheduling component. Then, the corresponding execution component in the second computing node interacts with the corresponding execution component in the control node of the k8s platform to execute steps S508 to S514.
[0177] Through the above process, after the first container unit is established in the first computing node, if the first computing node fails, the second container unit can be recreated in the second computing node for the first container unit, and the second container unit is kept consistent with the IP address used by the first container unit during normal operation. Reconstruction on different computing nodes provides an operating environment guarantee for the business continuity of the application carried by the first container unit or the second container unit; the IP address remains unchanged after reconstruction, providing network guarantee for the business continuity of the application carried by the first container unit or the second container unit.
[0178] It should be noted that in this implementation scenario, the running data of the application carried by the first container unit can be stored in advance in a third-party remote storage space outside the first computing node and the second computing node. In this way, after the second container unit is created in the second computing node, the running data can be obtained from the third-party remote storage space, and the application originally running in the first container unit can continue to run normally.
[0179] See also Fig. 9 , Fig. 9It is a flowchart of another container unit management method provided in an embodiment of the present application. The execution subject involved in the container unit management method in the embodiment of the present application at least includes a container proxy component, a network configuration component, a network management component and a cluster interface component. Among them, the container proxy component and the network configuration component can exist in the first computing node in the k8s platform (the first computing node can be any computing node in the k8s platform), and the network management component and the cluster interface component can exist in the control node in the k8s platform. Fig. 9 As shown, the method may include steps S901-S914.
[0180] S901, a cluster interface component receives a network information storage instruction, where the network information storage instruction carries first network information.
[0181] S902: The cluster interface component sends first network information to the network management component.
[0182] S903: The network management component obtains a first network identifier corresponding to the first network information, and establishes a corresponding relationship between the first network information and the first network identifier.
[0183] The specific implementation of steps S901 to S903 can be found in Figure 6 The specific implementation of steps S601 to S603 in the corresponding embodiment will not be repeated here.
[0184] S904, the cluster interface component receives a container creation instruction, the container creation instruction includes container unit configuration information, and receives an information fixation instruction corresponding to the container creation instruction, the information fixation instruction carries the first IP address.
[0185] Optionally, the container creation instruction and the information fixation instruction may be the same instruction or different instructions. The container creation instruction and the information fixation instruction may be input through a command line tool in the control node.
[0186] S905: The cluster interface component sends the first IP address to the network management component.
[0187] S906: The network management component obtains a first container unit identifier and establishes a correspondence between the first container unit identifier and the first IP address.
[0188] Optionally, the network management component may obtain the first container unit identifier by obtaining one or more parameters that can uniquely correspond to the container creation instruction from the multiple container configuration parameters in the container unit configuration information as the first container unit identifier. Alternatively, the network management component may generate the first container unit identifier in the form of a UUID. Alternatively, the network management component may generate the first container unit identifier through a first hash operation based on the multiple container configuration parameters in the container unit configuration information and the first IP address. For each specific acquisition method, please refer to Figure 5 The manner in which the network configuration component obtains the first container unit identifier in S505 in the corresponding embodiment is not described in detail here.
[0189] S907: The network management component sends a container identifier allocation instruction to the cluster interface component, where the container identifier allocation instruction includes a first container unit identifier.
[0190] S908: The cluster interface component sends first network configuration information to the container proxy component, where the first network configuration information includes a first container unit identifier.
[0191] The first network configuration information is used to trigger the container agent component to execute S909 and S910.
[0192] S909: The container proxy component creates a first container unit corresponding to the first container unit identifier.
[0193] S910: The container proxy component sends a first network configuration instruction to the network configuration component.
[0194] S911. The network configuration component sends a container address request to the network management component. The container address request carries a first container unit identifier.
[0195] S912: The network management component obtains the first IP address corresponding to the first container unit identifier of the record.
[0196] S913, the network management component sends an address allocation instruction to the network configuration component, where the address allocation instruction includes the first IP address.
[0197] S914: The network configuration component creates a first virtual network adapter of the first container unit, and performs network configuration on the first virtual network adapter according to the first IP address.
[0198] After the network configuration component performs network configuration on the first virtual network adapter, the network configuration component establishes a connection between the first virtual network adapter and the virtual switching device in the first computing node.
[0199] The specific implementation of steps S909 to S914 can be found in Figure 4 The implementation method of S401 to S404 in the corresponding embodiment will not be repeated here.
[0200] In an optional implementation, the first network information may include a first virtual local area network identifier, and the information fixation instruction in step S904 also carries the first network identifier. The cluster interface component may also send the first network identifier to the network management component, and then the network management component may establish a correspondence between the first container unit identifier and the first network identifier. Thus, after receiving the container address request, the network management component obtains the first network identifier corresponding to the first container unit identifier of the record, and obtains the first network information corresponding to the first network identifier of the record, and then obtains the first virtual local area network identifier from the first network information. Before step S914, the network management component also sends the first virtual local area network identifier to the network configuration component. Thus, the network configuration component configures the first virtual local area network identifier as the identifier of the virtual local area network to which the first port belongs, and the first port is a port in the virtual switching device of the first computing node that establishes a connection with the first virtual network adapter.
[0201] In an embodiment of the present application, before the first container unit is initially established, the network management device obtains the first container unit identifier of the first container unit and establishes a corresponding relationship between the first container unit identifier and the first IP address. Then, after the container agent component creates the first container unit according to the first container unit identifier, the network configuration component calls the network management component and sends a container address request containing the first container unit identifier to the network management component, and the network management component assigns the first IP address to the created first container unit. The container agent component creates a container unit according to the first container identifier, and the network management component assigns the first IP address to the first container unit corresponding to the first container unit identifier, thereby fixing the IP address and avoiding the abnormal access to the container unit caused by the random allocation of the IP address.
[0202] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. It is understandable that in order to realize the above functions, the computing node device and the control node device include hardware structures and / or software modules corresponding to the execution of each function. In combination with the components and steps of each example described in the embodiment disclosed in this application, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art 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 the technical solution of the embodiment of the present application.
[0203] See also Fig.10 , Fig.10 Schematic diagram of a computing node device provided in an embodiment of the present application. The computing node device can be implemented through its built-in components Figures 4 to 9 Method embodiment. Fig.10 As shown, the computing node device 60 includes a network configuration component 601 and a container proxy component 602, wherein:
[0204] The container proxy component 602 is used to create a first container unit corresponding to the first container unit identifier;
[0205] The network configuration component 601 is used to:
[0206] Receive a first network configuration instruction sent by the container proxy component, where the first network configuration instruction includes a first container unit identifier;
[0207] Sending a container address request to the control node device, where the container address request carries a first container unit identifier;
[0208] Receiving an address allocation instruction sent by a control node device, where the address allocation instruction includes a first IP address, where the first IP address is an IP address corresponding to a first container unit identifier recorded by the control node device;
[0209] A first virtual network adapter of the first container unit is created, and network configuration is performed on the first virtual network adapter according to the first IP address.
[0210] Optionally, the container proxy component 602 is specifically configured to create a first container unit corresponding to the first container unit identifier when the second container unit fails, wherein the second container unit is the container unit uniquely corresponding to the first container unit identifier before the failure.
[0211] Optionally, the container proxy component 602 is further configured to send a second network configuration instruction, wherein the second network configuration instruction includes the first IP address;
[0212] The network configuration component 601 is further configured to:
[0213] receiving a second network configuration instruction;
[0214] Obtain a first container unit identifier, and send address designation information to a control node device, where the address designation information includes a first IP address and a first container unit identifier, and the address designation information is used to enable the control node device to establish a correspondence between the first IP address and the first container unit identifier.
[0215] Optionally, the network configuration component 601 is further used to obtain container attribute information of the second container unit;
[0216] The network configuration component 601 is specifically used for:
[0217] The first container unit identifier is determined through a first hash operation according to the container attribute information of the second container unit, the first IP address, and the first network identifier.
[0218] It can be understood that the computing node device 60 in the embodiment of the present application can implement Figures 4 to 9 The steps performed by the network configuration component and the container proxy component in the illustrated embodiment. Fig.10 For the specific implementation methods and corresponding beneficial effects of the functional components included in the computing node device, please refer to the aforementioned Figures 4 to 9 Detailed introduction of the embodiments of the present invention.
[0219] Above Fig.10 The computing node device in the illustrated embodiment can be Fig.11 The computing node device 70 shown is implemented as shown. Fig.11 As shown, Fig.11 is a schematic diagram of the structure of another computing node device provided in an embodiment of the present application, Fig.11 The computing node device 70 shown includes: a processor 701 and a memory 702 .
[0220] The processor 701 can be used to manage the container units in the computing node device. Figure 3 Step 304 in the illustrated embodiment.
[0221] The memory 702 is used to store program codes and data for execution by the computing node device. The processor 701 can execute the application code stored in the memory 702 to implement Figures 4 to 9 Actions of a container proxy component or a network configuration component provided by any of the embodiments shown.
[0222] The processor 701 is connected to the memory 702 in a communication manner, for example, via a bus 703. The bus 703 may be a PCI bus or an EISA bus, etc. The bus 703 may be divided into an address bus, a data bus, and a control bus, etc. For ease of representation, Fig.11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0223] The computing node device 70 may further include a transceiver 704 for supporting information transmission between the computing node device 70 and the control node device or other devices involved in the above embodiments. Figure 4 Corresponding to step S402 in the embodiment; for example, implementing Figure 5 Step S511 and step S513 in the corresponding embodiment; for example, implementing Fig. 9 The corresponding steps are S911 and S913 in the embodiment.
[0224] It should be noted that in actual applications, the computing node device may include one or more processors, and the structure of the computing node device 70 does not constitute a limitation on the embodiments of the present application.
[0225] Processor 701 can be a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0226] The transceiver 704 may be a communication interface or a transceiver circuit, etc., wherein the transceiver is a general term, and in a specific implementation, the transceiver may include multiple interfaces.
[0227] The memory 702 may include a volatile memory, such as a random access memory (RAM); the memory 702 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 702 may also include a combination of the above types of memory.
[0228] In the embodiment of the present application, a computer storage medium is also provided, which can be used to store Fig.11 The computer software instructions used by the computing node device in the illustrated embodiment include the computer software instructions for executing the program designed for the computing node device in the above embodiment. The storage medium includes but is not limited to a flash memory, a hard disk, and a solid state drive.
[0229] In the embodiment of the present application, a computer program product is also provided. When the computer program product is run by a computing node device, the above Fig.11 The illustrated embodiment is a container unit management method designed for a computing node device.
[0230] See also Fig.12 , Fig.12 Schematic diagram of a control node device provided in an embodiment of the present application. The control node device can be implemented through its built-in components Figures 4 to 9 As shown in the figure, the control node device 80 may include a network management component 801 for:
[0231] receiving a container address request sent by a computing node device, where the container address request carries a first container unit identifier, and the container address request is sent by the computing node device after creating a first container unit corresponding to the first container unit identifier;
[0232] Obtain a first IP address corresponding to the first container unit identifier of the record;
[0233] An address allocation instruction is sent to the computing node device, wherein the address allocation instruction includes a first IP address; the address allocation instruction is used to enable the computing node device to perform network configuration on a first virtual network adapter according to the first IP address, and the first virtual network adapter is a virtual network adapter of a first container unit.
[0234] Optionally, the network management component 801 is further configured to:
[0235] Obtain a first IP address and a first container unit identifier;
[0236] The correspondence between the first IP address and the first container unit identifier is recorded.
[0237] Optionally, the control node device 80 further includes a cluster interface component 802, configured to send the first IP address to the network management component 801;
[0238] The network management component 801 is specifically configured to receive the first IP address sent by the cluster interface component 802 and generate a first container unit identifier;
[0239] The network management component 801 is further used to send a container identifier allocation instruction, where the container identifier allocation instruction includes a first container unit identifier;
[0240] The cluster interface component 802 is further used for:
[0241] receiving a container identification assignment instruction;
[0242] The first network configuration information is sent to the computing node device, wherein the first network configuration information includes a first container unit identifier; the first network configuration information is used to enable the computing node device to create a first container unit corresponding to the first container unit identifier, and to enable the computing node device to send the container address request.
[0243] It can be understood that the control node device 80 in the embodiment of the present application can implement Figures 4 to 9 The steps performed by the cluster interface component and the network management component in the illustrated embodiment are shown. Fig.12 For the specific implementation methods and corresponding beneficial effects of the functional components included in the control node device, please refer to the above Figures 4 to 9 Detailed introduction of the embodiments of the present invention.
[0244] Above Fig.12 The control node device in the embodiment shown can be Fig.13 The control node device 90 shown is implemented. Fig.13 As shown, Fig.13 is a schematic diagram of the structure of another control node device provided in an embodiment of the present application, Fig.13 The computing node device 90 shown includes: a processor 901 and a memory 902 .
[0245] The processor 901 can be used to manage the allocation of available container unit IP addresses and to allocate container unit creation tasks. Figure 4 Step S403 in the embodiment shown; for example, implementing Figure 5 Step S501 or step S512 in the embodiment shown; for example, implementing Fig. 9 Step S902 or S903 in the illustrated embodiment.
[0246] The memory 902 is used to store program codes and data for execution by the control node device. The processor 901 can execute the application code stored in the memory 902 to implement Figures 4 to 9 Actions of a cluster interface component or a network management component provided by any of the embodiments shown.
[0247] The processor 901 is connected to the memory 902 in communication, for example, via a bus 903. The bus 903 may be a PCI bus or an EISA bus. The bus 903 may be divided into an address bus, a data bus, and a control bus. For ease of representation, Fig.13 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0248] The computing node device 90 may further include a transceiver 904 for supporting information transmission between the control node device 90 and the computing node devices or other devices involved in the above embodiments. Figure 4 Corresponding to step S402 or S403 in the embodiment; for example, implementing Figure 5 Step S511 and step S513 in the corresponding embodiment; for example, implementing Fig. 9 The corresponding steps are S911 and S913 in the embodiment.
[0249] It should be noted that, in actual applications, the control node device may include one or more processors, and the structure of the control node device 90 does not constitute a limitation on the embodiments of the present application.
[0250] Processor 901 can be a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0251] The transceiver 904 may be a communication interface or a transceiver circuit, etc., wherein the transceiver is a general term, and in a specific implementation, the transceiver may include multiple interfaces.
[0252] The memory 902 may include a volatile memory, such as a random access memory (RAM); the memory 902 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 902 may also include a combination of the above types of memory.
[0253] In the embodiment of the present application, a computer storage medium is also provided, which can be used to store Fig.13 The computer software instructions used to control the node device in the embodiment shown include the computer software instructions used to execute the program designed for controlling the node device in the above embodiment. The storage medium includes but is not limited to a flash memory, a hard disk, and a solid state drive.
[0254] In the embodiment of the present application, a computer program product is also provided. When the computer program product is run by the control node device, the above-mentioned Fig.12 The illustrated embodiment is a container unit management method designed for a control node device.
[0255] In an embodiment of the present application, a container unit management system is also provided, which includes the above-mentioned Fig.10 The computing node device in the corresponding embodiment, and the above Fig.12 The control node device in the corresponding embodiment is used to implement the container unit management method involved in the embodiment of the present application.
[0256] Another container unit management system is also provided in the embodiment of the present application. The container unit management system includes the above Fig.11 The computing node device in the corresponding embodiment, and the above Fig.13 The control node device in the corresponding embodiment is used to implement the container unit management method involved in the embodiment of the present application.
[0257] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0258] A person of ordinary skill in the art will understand that, in the various embodiments of the present application, the sequence numbers of the above-mentioned processes do not imply the order of execution, and the order of execution of the processes should be determined by their functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
Claims
1. A container unit management method, characterized in that: include: When creating the second container unit, the network configuration component receives a second network configuration instruction sent by the container proxy component, wherein the second network configuration instruction includes the first IP address; The network configuration component determines the first container unit identifier through a first hash operation according to the container attribute information of the second container unit and the first IP address; The network configuration component sends address designation information to the network management component, where the address designation information includes the first IP address and the first container unit identifier, and the address designation information is used to enable the network management component to establish a corresponding relationship between the first IP address and the first container unit identifier; In the case where the second container unit fails, the network configuration component receives a first network configuration instruction sent by the container proxy component, where the first network configuration instruction includes a first container unit identifier, and the first network configuration instruction is sent by the container proxy component after creating a first container unit corresponding to the first container unit identifier; The network configuration component sends a container address request to the network management component, where the container address request carries the first container unit identifier; The network configuration component receives an address allocation instruction sent by the network management component, where the address allocation instruction includes a first IP address, where the first IP address is an IP address corresponding to the first container unit identifier recorded by the network management component; The network configuration component creates a first virtual network adapter for the first container unit, and determines and verifies a container unit identifier through the first hash operation according to the container attribute information of the first container unit and the first IP address; If the first container unit identifier is consistent with the verification container unit identifier, network configuration is performed on the first virtual network adapter according to the first IP address.
2. The method according to claim 1, characterized in that: Before failure, the second container unit is a container unit uniquely corresponding to the first container unit identifier.
3. The method according to claim 1, characterized in that After the network configuration component sends the container address request to the network management component, the method further includes: The network configuration component receives a first virtual local area network identifier sent by the network management component; the first virtual local area network identifier is used to indicate the virtual local area network to which the first container unit accesses.
4. The method according to claim 3, characterized in that: After the network configuration component receives the first virtual local area network identifier sent by the network management component, the method further includes: The network configuration component configures the first virtual LAN identifier as the identifier of the virtual LAN to which the first port belongs; the first port is a port in the virtual switching device that establishes a connection with the first virtual network adapter; the configured first port is used to connect the first container unit to the virtual LAN corresponding to the first virtual LAN identifier.
5. The method according to claim 1, characterized in that Before the network configuration component receives the first network configuration instruction sent by the container proxy component, the method further includes: The network configuration component receives a third network configuration instruction sent by the container proxy component, where the third network configuration instruction includes a first network identifier; The network configuration component sends network specifying information to the network management component, where the network specifying information includes the first network identifier, and the network specifying information is used to enable the network management component to establish a corresponding relationship between the first network identifier and the first container unit identifier.
6. The method according to claim 5, characterized in that The method further comprises: The network configuration component obtains container attribute information of the second container unit; The network configuration component generates a first container unit identifier through a first hash operation according to the container attribute information of the second container unit and the first IP address, including: The network configuration component determines the first container unit identifier through a first hash operation according to the container attribute information of the second container unit, the first IP address, and the first network identifier.
7. A container unit management method, characterized in that: include: When creating the second container unit, the network management component receives address specification information, the address specification information including the first IP address and the first container unit identifier, the address specification information is used to enable the network management component to establish a correspondence between the first IP address and the first container unit identifier, the first container unit identifier is determined by a first hash operation based on the container attribute information of the second container unit and the first IP address; The network management component records the correspondence between the first IP address and the first container unit identifier; In the case where the second container unit fails, the network management component receives a container address request sent by the network configuration component, the container address request carries a first container unit identifier, the container address request is sent by the network configuration component after receiving a first network configuration instruction sent by a container agent component, the first network configuration instruction includes the first container unit identifier, and the first network configuration instruction is sent by the container agent component after creating a first container unit corresponding to the first container unit identifier; The network management component obtains a first IP address corresponding to the first container unit identifier recorded; The network management component sends an address allocation instruction to the network configuration component, wherein the address allocation instruction includes the first IP address; the address allocation instruction is used to enable the network configuration component to perform network configuration on the first virtual network adapter of the first container unit according to the first IP address when the first container unit identifier is consistent with the verification container unit identifier, and the verification container unit identifier is determined by a first hash operation based on the container attribute information of the first container unit and the first IP address.
8. The method according to claim 7, characterized in that Before the network management component receives the container address request sent by the network configuration component, the method further includes: The network management component sends a container identifier allocation instruction to the cluster interface component, and the container identifier allocation instruction includes the first container unit identifier; the container identifier allocation instruction is used by the cluster interface component to send first network configuration information to the container proxy component, and the first network configuration information includes the first container unit identifier; the first network configuration information is used to enable the container proxy component to send the first network configuration instruction to the network configuration component.
9. The method according to claim 7 or 8, characterized in that: After the network management component receives the container address request sent by the network configuration component, the network management component further includes: The network management component obtains a first network identifier corresponding to the first container unit identifier; The network management component obtains first network information corresponding to the first network identifier, wherein the first network information includes a first virtual local area network identifier; the first virtual local area network identifier is used to indicate the virtual local area network to which the first container unit accesses.
10. The method according to claim 9, characterized in that After the network management component obtains the first network information corresponding to the first network identifier, the method further includes: The network management component sends the first virtual LAN identifier to the network configuration component, and the first virtual LAN identifier is used by the network configuration component to configure the virtual LAN to which the first port belongs; the first port is a port in the virtual switching device that establishes a connection with the first virtual network adapter; the configured first port is used to connect the first container unit to the virtual LAN corresponding to the first virtual LAN identifier.
11. A computing node device, characterized in that: It includes network configuration components and container agent components, including: The network configuration component is used to receive a second network configuration instruction sent by the container proxy component when creating the second container unit, wherein the second network configuration instruction includes the first IP address; Determine a first container unit identifier through a first hash operation according to the container attribute information of the second container unit and the first IP address; Sending address designation information to a network management component, wherein the address designation information includes the first IP address and the first container unit identifier, and the address designation information is used to enable the network management component to establish a corresponding relationship between the first IP address and the first container unit identifier; The container proxy component is used to create a first container unit corresponding to the first container unit identifier when the second container unit fails; The network configuration component is used to: receiving a first network configuration instruction sent by the container proxy component, wherein the first network configuration instruction includes the first container unit identifier; Sending a container address request to a control node device, where the container address request carries the first container unit identifier; receiving an address allocation instruction sent by the control node device, where the address allocation instruction includes a first IP address, where the first IP address is an IP address corresponding to the first container unit identifier recorded by the control node device; Creating a first virtual network adapter for the first container unit, and determining a verification container unit identifier through the first hash operation according to the container attribute information of the first container unit and the first IP address; If the first container unit identifier is consistent with the verification container unit identifier, network configuration is performed on the first virtual network adapter according to the first IP address.
12. The computing node device according to claim 11, characterized in that: Before failure, the second container unit is a container unit uniquely corresponding to the first container unit identifier.
13. The computing node device according to claim 11, characterized in that: The network configuration component is further used to obtain container attribute information of the second container unit; The network configuration component is specifically used for: The first container unit identifier is determined through a first hash operation according to the container attribute information of the second container unit, the first IP address, and the first network identifier.
14. A control node device, characterized in that: The invention comprises a network management component, wherein the network management component is used to: When creating a second container unit, receiving address specification information, the address specification information including a first IP address and a first container unit identifier, the address specification information being used to enable the network management component to establish a correspondence between the first IP address and the first container unit identifier, the first container unit identifier being determined by a first hash operation based on container attribute information of the second container unit and the first IP address; Recording the correspondence between the first IP address and the first container unit identifier; In the case where the second container unit fails, receiving a container address request sent by a computing node device, the container address request carries a first container unit identifier, and the container address request is sent by the computing node device after creating a first container unit corresponding to the first container unit identifier; Obtain a first IP address corresponding to the first container unit identifier of the record; An address allocation instruction is sent to the computing node device, wherein the address allocation instruction includes the first IP address; the address allocation instruction is used to enable the computing node device to perform network configuration on the first virtual network adapter of the first container unit according to the first IP address when the first container unit identifier is consistent with the verification container unit identifier, and the verification container unit identifier is determined by a first hash operation based on the container attribute information of the first container unit and the first IP address.
15. The control node device according to claim 14, characterized in that: The control node device also includes a cluster interface component; The network management component is further used to send a container identifier allocation instruction, wherein the container identifier allocation instruction includes the first container unit identifier; The cluster interface component is further used for: receiving the container identification allocation instruction; Sending first network configuration information to the computing node device, wherein the first network configuration information includes the first container unit identifier; the first network configuration information is used to enable the computing node device to create the first container unit corresponding to the first container unit identifier, and to enable the computing node device to send the container address request.
Citation Information
Patent Citations
Container management method, container management device, computer device and storage medium
CN108829384A
Container network configuration method and system
CN110138606A
Container IP address management method and device
CN110445884A