Container control method, device and container based on IaaS cloud architecture of Openstack

By designing the TBway plug-in and TBwayd service on the OpenStack infrastructure, and using the CNI standard, the network resource management of POD is realized, which solves the problem that the existing plug-in cannot specify IP and fixed IP, and realizes the network use of containers and virtual machines at the same level. , improving performance and adaptability.

CN115334018BActive Publication Date: 2024-10-11太保科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210970313.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-12
Publication Date
2024-10-11
Estimated Expiration
2042-08-12

AI Technical Summary

Technical Problem

The existing K8s container network plug-in cannot meet the needs of various business scenarios. In particular, it cannot specify the IP when creating a POD, supports fixed IP, and directly uses the IAAS network capability on the OpenStack infrastructure.

Method used

A container control method based on OpenStack's IaaS cloud architecture is designed. Through the TBway plug-in and TBwayd service, and the CNI standard protocol, POD network resource application and deletion is realized, IP designation and fixation are supported, and the network provided by the OpenStack infrastructure is directly used. .

Benefits of technology

It implements the function of keeping the IP unchanged when creating and rebuilding POD, supports the creation of containers within the specified IP range, and the container network and the virtual machine are at the same level, with better performance and meeting the needs of traditional applications in containerized environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115334018B_ABST
    Figure CN115334018B_ABST
Patent Text Reader

Abstract

The present invention provides a container control method for an IaaS cloud architecture based on Openstack, comprising the following steps: a. receiving request information for creating a POD; b. creating a sandbox based on the request information; c. a TBway plug-in calling a TBwayd service to apply for network resources; d. a TBwayd service determining parameters corresponding to the network resources; e. TBwayd applying to an OpenStack infrastructure platform to allocate network resources for the POD, and obtaining corresponding network resources; f. the TBway plug-in setting the network resources to the network namespace of the POD through iplink. The present invention also provides a container for an IaaS cloud architecture based on Openstack. Through the present invention, an effective way to control network resource management in an IaaS cloud architecture is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a network management system, a network management system for managing network resources in an internal Infrastructure as a Service (IaaS) system, and in particular to a container control method and a corresponding container based on an IaaS cloud architecture of its own Openstack. Background Art

[0002] In recent years, more and more companies are actively embracing cloud computing and continuously deploying their traditional business operations in a containerized manner on cloud infrastructure. As companies and businesses expand, various IT applications are becoming more and more complex, and the number of containers is increasing. As a result, the orchestration engine kubernetes (K8s for short) for managing and operating containers has come into being. K8s is a portable container orchestration management tool created for container services. This is a major breakthrough and innovation in the development of the entire container technology field, but container networking is still one of the more complex and troublesome aspects of K8s.

[0003] Due to the complexity of the business, the network needs to consider all aspects of the business, which usually involves various complex scenarios such as mutual calls between services within the container cluster, mutual calls between services between different nodes, and mutual calls between services within the cluster and services outside the cluster. In addition, due to the needs of some traditional businesses, the network of the container application and the network of the virtual machine infrastructure are often required to be at the same level. From the application point of view, there is no difference between using virtual machines and using containers, at least in the network. In addition, when some traditional applications are deployed on containers, they also need to keep the IP unchanged after the container is destroyed and rebuilt, and they can also create containers according to the specified IP. It is difficult for general container network solutions to meet all these requirements.

[0004] In terms of network, different enterprises and users will use different network solutions to meet specific environment and business requirements for various reasons. There is no perfect and universal solution at present. Therefore, there are many different network solutions in the industry, whether open source or commercial, and the interfaces and uses of these solutions are different. Currently, open source K8s has many container network interface plug-ins (Container Network Interface, CNI), referred to as CNI plug-ins, and the most commonly used ones are:

[0005] Flannel: The most mature and simple option, but only meets basic functions

[0006] Calico: Good performance and greatest flexibility. It is the current mainstream enterprise-level protocol and relies on the Border Gateway Protocol (BGP).

[0007] Canal: Integrates the network layer provided by Flannel with the network policy capabilities of Calico.

[0008] Weave: The unique feature is the simple encryption of the entire network, which increases network overhead.

[0009] Terway: It is an open-source CNI plug-in based on Virtual Private Cloud (VPC) of Alibaba Cloud, which supports VPC and Elastic Network Interface (ENI) modes.

[0010] These plug-ins have different features and are used in different ways. According to our current business scenario, we need a network solution that can achieve the following functions:

[0011] It has basic CNI plug-in functions, which can add and delete networks to containers, etc.

[0012] Can support container reconstruction, IP remains unchanged

[0013] Can support creating containers within a specified IP range

[0014] You can directly use the network of our infrastructure cloud platform, and containers and virtual machines are at the same level in terms of usage.

[0015] Specifically, different enterprises and users have different business scenarios, and the capabilities required by the K8s layer's network plug-ins are also different. Currently, there is no universal solution to adapt to all different usage scenarios. Various network plug-ins on the market also have their own characteristics. They are applicable in some scenarios, but often cannot meet the needs in other scenarios. For example, some CNI container network plug-ins that are currently popular and commonly used by enterprises are:

[0016] 1. Flannel

[0017] Flannel implements communication between PODs (POD is the smallest unit level managed by K8s) by encapsulating the source data packet in another network packet for forwarding through an overlay network. This overlay network can assign an independent IP address to each POD.

[0018] 1.1. Usage characteristics

[0019] In use, Flannel will pre-set a large subnet, and then allocate a small subnet in the large subnet to each working node (node) for internal IP address allocation. This information will be stored in etcd by flannel, and the corresponding relationship between each subnet and the working node will be recorded to facilitate the secondary data packet transmission next time. In addition, flannel will start a daemon process on the working node. The daemon process mainly maintains the setting of local routing rules and the information in etcd. Flannel is relatively easy to install and configure. Many common Kubernetes cluster deployment tools and many Kubernetes distributions install Flannel by default. In general, Flannel is a good choice for most users.

[0020] 1.2 Disadvantages

[0021] The functions are simple, only meeting basic network functions, and do not support fine-grained network access control. Often users have requirements for configuring network policies or controlling access control lists (ACLs) in multi-tenant networks, which Flannel does not support.

[0022] Based on Linux TUN / TAP, the User Datagram Protocol (UDP) and Virtual eXtensible Local Area Network (VXLAN) are used to encapsulate IP packets to create an overlay network to achieve communication between PODs on different working nodes. This involves the encapsulation and decapsulation process of data packets, which results in a lot of performance loss.

[0023] Even though its host-gw mode can directly add routes and treat the destination host as a gateway without additional packet unpacking, the communication efficiency is almost the same as that of bare metal direct connection. However, since flannel can only modify the routing table on the node, once there are other routing devices between the nodes, such as a layer 3 router, the packet will be discarded by the routing device. As a result, the host-gw mode can only be used for networks that are directly accessible at the second layer, and has high requirements for the deployment of the underlying network. In addition, due to network storm problems, this type of network is usually small-scale, and host-gw will also have problems when the number of PODs is large.

[0024] You cannot specify an IP address when creating a POD. The IP address of the container may change after it is restarted.

[0025] It is not possible to create a POD by specifying an IP range. It can only be allocated from the subnet segment specified during initialization.

[0026] It is not possible to directly use the network capabilities provided by the IAAS infrastructure. The designated POD subnet segment is equivalent to the LAN segment within the cluster, which can be allocated at will in essence.

[0027] 2. Calico

[0028] Calico is another popular network choice in the Kubernetes ecosystem. Although Flannel is recognized as the simplest choice, Calico is known for its performance and flexibility. Calico is more comprehensive, not only providing network connectivity between hosts and pods, but also involving network security and management.

[0029] 2.1. Usage characteristics

[0030] The Calico CNI plug-in encapsulates the functions of Calico within the CNI framework. A pure three-layer network based on BGP (Border Gateway Routing Protocol), that is, the three layers of the protocol stack of each machine are used to ensure the three-layer connectivity between two containers and cross-host containers. Network policies are supported to implement network access control. A vRouter is run on each machine, using the kernel to forward data packets, and firewall functions are implemented with the help of iptables.

[0031] 2.2 Disadvantages

[0032] The host machine is required to be in the same Layer 2 network, that is, connected to a switch, and has certain requirements for the existing network.

[0033] The number of routes is the same as the number of containers, which can easily exceed the processing capacity of routers, layer-3 switches, and even worker nodes, thus limiting the expansion of the entire network.

[0034] A large number of iptables rules and routes will be set on each working node, making operation, maintenance and troubleshooting difficult.

[0035] The principle determines that it is impossible to support VPC, and the container can only obtain the IP from the network segment set by calico.

[0036] The network capabilities provided by the IAAS infrastructure cannot be used directly.

[0037] For security reasons and because it will be written to the routing table and may affect the existing network, our own infrastructure cloud platform prohibits the use of BGP.

[0038] 3. Weave

[0039] Weave creates a mesh overlay network between each node in the cluster. It builds a software-defined network layer on top of a network. This network looks like a local LAN, but in fact its underlying layer communicates through another network.

[0040] 3.1. Usage characteristics

[0041] Weave will create a bridge on the host, and each container is connected to the bridge through a veth pair. At the same time, there is a Weave router container connected to the bridge, and the router will capture network packets through the interface connected to the bridge. A W (Weave router) is deployed on each host where Docker is deployed (it may be a physical machine or a virtual machine).

[0042] The Weave network is composed of peer endpoints (peers) composed of these weave routers. Each peer has its own name, a unique identifier used to distinguish each other during operation. The name remains unchanged even if the Docker host is restarted. These names default to MAC addresses.

[0043] Each host that deploys a Weave router needs to open the firewall settings for Transmission Control Protocol (TCP) and UDP port 6783 to ensure the passage of control plane traffic and data plane traffic between Weave routers. The control plane consists of TCP connections established between Weave routers, through which handshakes and exchange of topology information are carried out. This communication can be configured as encrypted communication. The data plane consists of UDP connections established between Weave routers, most of which are encrypted. These connections are full-duplex and can pass through firewalls.

[0044] 3.2 Disadvantages

[0045] You can only join the weave network through weave launch or weave connect.

[0046] Weave uses UDP to carry data packets between containers and completes the encapsulation and decapsulation process by capturing packets through Pcap. In this process, the data packets need to be copied from kernel state to user state, and then encapsulated and decapsulated according to a custom format, which has efficiency issues.

[0047] From the perspective of performance and usage, the packaging and unpacking methods of Weave's custom container data packets are not universal enough, the transmission efficiency is relatively low, and the performance loss is relatively large.

[0048] Cluster configuration is relatively complex and requires manual construction of network topology through the weave command line. This places a heavy burden on administrators, especially in the case of large-scale clusters.

[0049] You cannot specify an IP address when creating a POD. The IP address of the container may change after it is restarted.

[0050] It is not possible to create a POD by specifying an IP range. It can only be allocated from the subnet segment specified during initialization.

[0051] The network capabilities provided by the IAAS infrastructure cannot be used directly.

[0052] 4. Terway

[0053] Terway is an open-source CNI plug-in based on the VPC network of Alibaba Cloud. It supports VPC and ENI modes. The latter enables the container network to use the VPC subnet network.

[0054] 4.1. Usage characteristics

[0055] POD needs to connect to the virtual switch through Alibaba Cloud's elastic network card (ENI) to form a POD network. Therefore, in addition to selecting the node virtual switch, you also need to specify the virtual switch for POD communication; different Alibaba Cloud server (Elastic Compute Service, ECS) specifications can support different numbers of mounted elastic network cards, and the number of ECS mounted elastic network cards and the number of IPs supported by a single elastic network card directly determine the number of PODs that can be allocated to the node.

[0056] 4.2 Disadvantages

[0057] Obviously, although it is an open source plug-in, its features show that if you want to use Terway, you can only use it on Alibaba Cloud, that is, the plug-in is closely bound to Alibaba Cloud services and cannot be used on other infrastructure cloud platforms. The disadvantages are also obvious:

[0058] The plug-in can only be used on Alibaba Cloud and is strictly bound to the manufacturer, so it cannot be used for private clouds like ours.

[0059] Since it is bound to Alibaba Cloud, it cannot be used on the infrastructure cloud platform built on OpenStack. Our private cloud is built on OpenStack and cannot use the network capabilities provided by OpenStack.

[0060] It is not possible to create a POD by specifying an IP range.

[0061] The open source version does not yet support fixed IP addresses for containers.

[0062] At present, the above-mentioned mainstream K8s plug-ins cannot meet the needs of our scenarios due to their own reasons and limitations, and there is no perfect and universal solution. Summary of the invention

[0063] In view of the defects in the prior art, the present invention provides a container control method based on the IaaS cloud architecture of Openstack, which is used to apply for network resources for POD or delete network resources, including the following steps:

[0064] Step a. Receive a request to create a POD;

[0065] Step b. Create a sandbox based on the request information;

[0066] Step c. TBway plug-in calls TBwayd service to apply for network resources;

[0067] Step d. The TBwayd service determines the parameters corresponding to the network resources;

[0068] Step e. The TBwayd service applies to the OpenStack infrastructure platform for allocating network resources for the POD and obtains the corresponding network resources;

[0069] Step f. The TBway plug-in sets the network resources to the network namespace of the POD via iplink.

[0070] Preferably, before step a, the method further comprises the following steps:

[0071] Step i. monitors the POD event, wherein the request information for creating the POD is obtained based on the monitoring.

[0072] Preferably, the step of monitoring POD events in step i comprises the following steps:

[0073] Step i1: The kubelet service of the k8s cluster working node monitors the API Server service on the host (master) node, thereby monitoring the POD events.

[0074] Preferably, step c comprises the following steps:

[0075] Step c1: kubelet calls the ADD interface of the TBway plug-in to process parameters related to the network resources;

[0076] Step c2: kubelet calls TBwayd service through gRPC;

[0077] Step c3: The TBway plug-in calls the TBwayd service to apply for the network resources.

[0078] Preferably, when the TBwayd service is called, the following steps are also included:

[0079] -TBwayd service authenticates keystone and obtains a token certificate.

[0080] Preferably, the token certificate is stored in a memory or a server.

[0081] Preferably, the step d comprises the following steps:

[0082] Step d1: The TBwayd service obtains the POD information of the cluster from the API Server service of k8s;

[0083] Step d2: Determine parameters corresponding to the network resources based on the POD information.

[0084] Preferably, the parameters corresponding to the network resources include an IP address or an IP address range corresponding to the POD.

[0085] Preferably, the step e comprises the following steps:

[0086] Step e1: The TBwayd service applies to the neutron-server service for creating a virtual network card corresponding to the POD;

[0087] Step e2: The TBwayd service requests the neutron-server service to mount the virtual network card to the working node virtual machine where the POD is located.

[0088] Preferably, the step e1 comprises the following steps:

[0089] Step e11: The TBwayd service sends a request message for creating network resources to the neutron-server service to apply for creating a virtual network card;

[0090] Step e12: neutron-server completes the authentication process of the request information;

[0091] Step e13: The neutron-plugin plug-in and the neutron-agent agent corresponding to the neutron-server complete the process of creating a virtual network card based on the request information, and create a virtual network card with an IP address for the POD.

[0092] Preferably, the following steps are further included after step f:

[0093] Step A. Receive a request message for deleting a POD;

[0094] Step B. The kubelet component in kubernetes calls the CNI plug-in to initiate a CMDDEL event;

[0095] Step C. After receiving the CMDDEL event, the TBway-CNI plug-in calls the TBwayd service through gRPC;

[0096] Step D. The TBwayd service obtains POD information from K8S through gRPC calls and cleans up network resources in the POD, such as routing and deleting veth pair device pairs;

[0097] Step E. TBway-CNI plugin moves the virtual network card from the POD network namespace to the host network namespace;

[0098] Step F. The TBway-CNI plug-in calls the TBwayd service through gRPC to release the virtual machine network card that has just been moved out of the host machine.

[0099] Preferably, the step F further comprises the following steps:

[0100] Step F1: the TBwayd service deletes the mapping relationship between the POD and the virtual network card;

[0101] Step F2: putting the released virtual network card into an idle virtual network card queue.

[0102] Preferably, the control process corresponding to deleting the network resource in the above control method further includes the following steps:

[0103] -The resource pool cache management object will periodically clean up unused virtual network cards in the virtual network card resource pool according to certain rules, and will reallocate virtual network cards to ensure that there are a certain number of available virtual network cards in the pool.

[0104] Preferably, the control process corresponding to deleting the network resource in the above control method further includes the following steps:

[0105] -Openstack is called to uninstall the binding of the virtual network card from the host so that when the specified POD drifts to other nodes, the virtual network card carrying the IP address can be bound to other nodes.

[0106] According to another aspect of the present invention, a container control device for an IaaS cloud architecture based on Openstack is also provided, comprising: a memory for storing instructions executable by a processor; and a processor for executing the instructions to implement the container control method for the IaaS cloud architecture based on Openstack as described above.

[0107] According to another aspect of the present invention, a container based on the IaaS cloud architecture of Openstack is also provided, which adopts the above control method to apply for network resources for POD or delete network resources.

[0108] Preferably, the container of the IaasIaaS cloud architecture based on Openstack includes the following modules:

[0109] -Create a new virtual network card module;

[0110] -Delete the virtual network card module;

[0111] -Mount the virtual network card module;

[0112] -Uninstall the virtual network card module;

[0113] -IP address management module;

[0114] -Virtual network card resource pool management module; and

[0115] -Configuration information file management module.

[0116] Compared with the existing technology, this solution implements a new container network plug-in TBway based on the CNI standard protocol. In addition to implementing the basic CNI interface functions, this plug-in can specify the IP when creating a POD and ensure that the IP does not change when the IP is rebuilt, providing strong support for the migration of traditional applications to a containerized environment; and can specify an IP range to apply for an IP for the POD within the IP range; the network used by the container is applied for from our OpenStack infrastructure IaaS platform, so that the container and the virtual machine are at the same level, and the container network is not at the forwarding layer and directly uses the IaaS network, which has better performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0117] In order to make the above-mentioned objects, features and advantages of the present invention more clearly understood, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein:

[0118] Figure 1 A flowchart corresponding to applying for network resources in a container control method based on an IaaS cloud architecture of Openstack is shown in accordance with a specific embodiment of the present invention;

[0119] Figure 2 A flowchart corresponding to applying for network resources in a container control method of an IaaS cloud architecture based on Openstack is shown in another specific embodiment of the present invention;

[0120] Figure 3A flowchart corresponding to deleting network resources in a container control method of an IaaS cloud architecture based on Openstack is shown in another specific embodiment of the present invention;

[0121] Figure 4 A schematic diagram of a timing sequence corresponding to applying for network resources in a container control method based on an IaaS cloud architecture of Openstack is shown in another specific embodiment of the present invention;

[0122] Figure 5 A schematic diagram of a timing sequence corresponding to deleting network resources in a container control method based on an IaaS cloud architecture of Openstack is shown in another specific embodiment of the present invention;

[0123] Figure 6 A topology diagram of a container control method based on an IaaS cloud architecture of Openstack is shown in another specific embodiment of the present invention;

[0124] Figure 7 A topology diagram showing another specific embodiment of the present invention, a container control method based on IaaS cloud architecture of Openstack; and

[0125] Figure 8 It is a system block diagram of a container control device based on the IaaS cloud architecture of Openstack according to an embodiment of the present invention. DETAILED DESCRIPTION

[0126] Those skilled in the art will appreciate that the present invention provides a convenient solution for unified management of network resources in an internal IaaS system, and provides a specific process for effectively managing network resources, creating and managing virtual network cards, and a corresponding management system.

[0127] Specifically, refer to Figure 7 In the illustrated embodiment, through the monitoring of the k8s node provided by the present invention, a request for creating network resources, such as the need to create a virtual network card, can be accepted, and then a request for creating network resources is initiated to the OpenStack infrastructure platform provided by the present invention through the TBway plug-in, and a virtual network card is created based on the feedback of the OpenStack infrastructure platform, and finally the network card is loaded to the corresponding position, so that the virtual network card can be seen in the IaaS platform, and then the terminals and nodes in the entire IaaS can communicate with the virtual network card, thereby realizing the process of creating and deleting network resources.

[0128] Further, refer to Figure 6The embodiment shown in the figure describes the container of the IaaS cloud architecture based on Openstack provided by the present invention from another perspective, that is, the k8s server cluster 61 communicates with the IaaS 62, wherein the k8s server cluster 61 includes a k8s server host 611 and a k8s server working node, and the k8s server working node includes a first working node 612, a second working node 613 and a third working node 614. The interaction relationship between the k8s server host 611 and the k8s server working node can be referred to Figure 7 The working relationship between the left and right sides of the illustrated embodiment reflects that TBwayd realizes the functions provided by the present invention by cooperating with the k8s server cluster. Furthermore, the k8s server cluster 61 communicates with the IaaS 62 through various interfaces, such as the enix interface, the ethx interface, and the like.

[0129] Further, refer to Figure 7 In the illustrated embodiment, the interaction process between the k8s server host 71 and the k8s server working node 72 includes the following steps:

[0130] 1. The kubelet service 721 of the k8s server working node 72 monitors the APIServer service 711 on the k8s server host 71, thereby monitoring the POD event;

[0131] 2. The kubelet service 721 receives the request information for creating a POD, and creates a sandbox to pods (POD namespace) 722 based on the request information;

[0132] 3. The kubelet service 721 calls the CNI interface of the TBway plug-in 723 to process parameters related to the network resources;

[0133] 4. TBway plug-in 723 calls TBwayd service 724 to apply for network resources;

[0134] 5. The TBwayd service 724 obtains the POD information of the cluster from the API Server service 711 .

[0135] 6. The TBwayd service 724 determines the parameters corresponding to the network resources based on the POD information, and applies to the neutron-server 731 of the OpenStack infrastructure platform 73 for creating a virtual network card corresponding to the POD.

[0136] The processing flow of the OpenStack infrastructure platform 73 is as follows:

[0137] neutron-server 731 processes various requests by managing the message queue Q, and interacts with network-provide 733 and network-database 734 through neutron-agent 732. The neutron-plugin 735 and keystone 736 authentication agencies also work accordingly through the message queue mechanism. Specifically, after receiving the request, neutron-server 731 will perform a security check through keystone 736, and will only process further after the check passes. After the check passes, neutron-server 731 notifies the registered neutron-plugin 735 through the message queue Q, and neutron-plugin 735 will save the relevant information to network-database 734 or delete the information from network-database 734 according to the request operation. Then, the neutron-agent 732 running on each OpenStack network node is notified through the message queue, and the neutron-agent 732 performs specific network creation or destruction actions on the node. If network-provide 733 is used, neutron-agent 732 will send the request to the corresponding network-provider 733 to perform the actual operation.

[0138] like Figure 7 As shown, the interaction process between the k8s server host 71 and the k8s server working node 72 also includes step 7. The TBway plug-in 723 binds the virtual network card to the pods 722 through the iplink setting.

[0139] Further, refer to Figure 1 , Figure 4 The embodiment shown shows a flowchart corresponding to applying for network resources in a container control method based on the IaaS cloud architecture of Openstack, according to a specific implementation of the present invention. Specifically:

[0140] First, step S101 is executed, that is, the kubelet service of the k8s cluster working node monitors the APIServer service on the host node, thereby monitoring the POD event.

[0141] Next, the process proceeds to step S102, that is, receiving a request message for creating a POD. Through the above monitoring process, the request message can be received, and the subsequent steps are initiated.

[0142] Then execute step S103, that is, kubelet calls the ADD interface of the TBway plug-in to process the parameters related to the network resources.

[0143] Next, the process proceeds to step S104, where kubelet calls the TBwayd service through gRPC (google Remote Procedure Call).

[0144] Then, step S105 is executed, that is, the TBway plug-in calls the TBwayd service to apply for the network resource.

[0145] Then proceed to step S106, that is, the TBwayd service obtains the POD information of the cluster from the API Server service of k8s.

[0146] In the next step, step S107 is executed, that is, the parameters corresponding to the network resources are determined based on the POD information.

[0147] Then proceed to step S108, that is, the TBwayd service applies to the neutron-server service for creating a virtual network card corresponding to the POD.

[0148] Finally, step S109 is executed, that is, the TBwayd service requests the neutron-server service to mount the virtual network card to the working node virtual machine where the POD is located.

[0149] Furthermore, after the above step S109, the method further includes step S110, that is, the TBway plug-in sets the network resource to the network namespace of the POD through iplink. Figure 1 The step S110 is not shown in FIG.

[0150] Those skilled in the art will appreciate that the above-mentioned TBway plug-in and TBwayd service are services independently developed based on open source code, namely, used to implement the above-mentioned processing of requesting network resources and deleting network resources.

[0151] Furthermore, those skilled in the art understand that the above Figure 1 , Figure 4 The process can be summarized into the following steps:

[0152] i. Listen to POD events

[0153] a. Receive request information for creating a POD;

[0154] b. Create a sandbox based on the request information;

[0155] c. TBway plug-in calls TBwayd service to apply for network resources;

[0156] d. TBwayd service determines the parameters corresponding to the network resources;

[0157] e. The TBwayd service applies to the OpenStack infrastructure platform for allocating network resources for the POD and obtains the corresponding network resources; and

[0158] f. The TBway plug-in sets the network resources to the network namespace of the POD via iplink.

[0159] Through the above Figure 1 , Figure 4 The operation flow shown can create a network resource corresponding to the request. In a variation of the above implementation method, the request information can have special requirements for IP address, IP name, etc. According to these requirements, the TBwayd service correspondingly creates a virtual network card containing these specific requirements.

[0160] Furthermore, in the above Figure 1 , Figure 4 The illustrated embodiment, when the TBwayd service is called, further includes the following steps: the TBwayd service authenticates keystone and obtains a token certificate. In a further embodiment, the token certificate is stored in a memory or a server. Those skilled in the art understand that the security of the IaaS system provided by the present invention can be increased through the authentication process.

[0161] Further, in another embodiment, referring to Figure 2 as well as Figure 7 As shown, preferably, the Figure 1 Step S108 in the embodiment includes the following steps:

[0162] Step S1081: the TBwayd service sends a request message for creating network resources to the neutron-server service to apply for creating a virtual network card;

[0163] Step S1082: neutron-server completes the authentication process of the request information;

[0164] Step S1083: The neutron-plugin plug-in and the neutron-agent agent corresponding to the neutron-server complete the process of creating a virtual network card based on the request information, and create a virtual network card with an IP address for the POD.

[0165] The above embodiment shows the workflow between the TBwayd service and the Openstack basic platform in the control method provided by the present invention, wherein the Openstack basic platform is a platform adapted to the TBwayd service and responds to the TBwayd service.

[0166] Furthermore, refer to Figure 3 as well as Figure 5 , Figure 7 , which shows another specific implementation of the present invention, a flowchart corresponding to deleting network resources in a container control method based on IaaS cloud architecture of Openstack, specifically including the following steps:

[0167] Step S201: receiving a request to delete a POD;

[0168] Step S202: The kubelet component in kubernetes calls the CNI plug-in to initiate a CMDDEL event;

[0169] Step S203: After receiving the CMDDEL event, the TBway-CNI plug-in calls the TBwayd service through gRPC;

[0170] Step S204: The TBwayd service obtains POD information from K8S through gRPC calls, cleans up network resources in the POD, such as routing, and deletes veth pair device pairs;

[0171] Step S205: the TBway-CNI plug-in moves the virtual network card from the network namespace of the POD to the network namespace of the host;

[0172] Step S206: The TBway-CNI plug-in calls the TBwayd service through gRPC to release the virtual machine network card that has just been removed from the host machine.

[0173] Those skilled in the art will appreciate that, through the above process, the network resources are deleted in the container control method based on the IaaS cloud architecture of Openstack. Figure 1 The principles of the processes shown are basically the same and will not be described in detail.

[0174] Furthermore, the above step S206 includes the following steps:

[0175] Step F1: the TBwayd service deletes the mapping relationship between the POD and the virtual network card;

[0176] Step F2: putting the released virtual network card into an idle virtual network card queue.

[0177] In another variation, preferably, the control process corresponding to deleting the network resource in the above control method further includes the following steps:

[0178] -The resource pool cache management object will periodically clean up unused virtual network cards in the virtual network card resource pool according to certain rules, and will reallocate virtual network cards to ensure that there are a certain number of available virtual network cards in the pool.

[0179] Preferably, the control process corresponding to deleting the network resource in the above control method further includes the following steps:

[0180] -Openstack is called to uninstall the binding of the virtual network card from the host so that when the specified POD drifts to other nodes, the virtual network card carrying the IP address can be bound to other nodes.

[0181] Further, referring to the above Figures 4 to 7 The embodiment shown, wherein Figure 4 The timing of creating network resources is shown. Specifically, creating network resources requires interaction between TBway plug-in 41, TBway service 42, k8s server 43, TBway-DB (TBway database) 44, virtual network card manager 45, virtual network card resource pool 46 and Openstack 47. Figure 4 In the figure, the solid arrow represents a request, and the dotted arrow represents a response. In this embodiment, the TBway plug-in 41 calls gRPC to request network resources. Correspondingly, the TBway service 42 sends a request to the k8s server 43 to query the POD information. Specifically, the TBway service 42 inquires whether the POD exists from the TBway-DB44 and obtains corresponding feedback. If the fixed IP exists, a request to create the corresponding network resource is directly sent to Openstack 47. If there is no fixed IP, a request to allocate a virtual network card is sent to the virtual network card manager 45, and the virtual network card is created. The virtual network card resource pool 46 determines whether the virtual network card before the POD has been recycled. If it has not been recycled, the virtual network card is directly returned. If it has been recovered, it is determined whether there is an idle virtual network card. If there is an idle virtual network card, the idle virtual network card is returned. If there is no virtual network card, an application is made to Openstack47 to create a virtual network card and return the virtual network card to the TBway service. Thereafter, the virtual network card is set to enter the POD namespace.

[0182] Furthermore, Figure 5 , which shows a timing diagram for deleting a network resource. In this embodiment, the TBway plug-in may be a TBway-CNI plug-in, such as Figure 5As shown, deleting a network resource requires interaction between the TBway-CNI plug-in 51, TBway service 52, k8s server 53, TBway-DB 54, virtual network card manager 55, virtual network card resource pool 56 and Openstack57. The solid arrow represents the request, and the dotted arrow represents the response. Specifically, in this embodiment, the TBway-CNI plug-in calls the gRPC request to release the network resources. Correspondingly, the TBway service 52 sends a request to query the POD information to the k8s server 53, and deletes the virtual network card from the POD namespace accordingly. Then the gRPC request releases the virtual network card, and deletes the network card information from the TBway-DB54 accordingly, and calls Openstack57 to finally delete the network card information.

[0183] exist Figure 5 In the illustrated embodiment, the virtual network card manager 56 periodically checks whether there is idle POD information and whether there is POD information that is not bound or assigned to a virtual network card, and accordingly places idle virtual network cards into the virtual network card resource pool 56 .

[0184] Figure 8 This is a system block diagram of a container control device based on the IaaS cloud architecture of Openstack according to an embodiment of the present invention. Figure 8 As shown, the container control device 800 may include an internal communication bus 801, a processor 802, a read-only memory (ROM) 803, a random access memory (RAM) 804, and a communication port 805. When applied on a personal computer, the container control device 800 may also include a hard disk 806. The internal communication bus 801 can realize data communication between the components of the container control device 800. The processor 802 can make judgments and issue prompts. In some embodiments, the processor 802 can be composed of one or more processors. The communication port 805 can realize data communication between the container control device 800 and the outside. In some embodiments, the container control device 800 can send and receive information and data from the network through the communication port 805. The container control device 800 may also include different forms of program storage units and data storage units, such as a hard disk 806, a read-only memory (ROM) 803 and a random access memory (RAM) 804, which can store various data files used for computer processing and / or communication, and possible program instructions executed by the processor 802. The processor executes these instructions to implement the main part of the method. The processing result of the processor is transmitted to the user device through the communication port and displayed on the user interface.

[0185] The above-mentioned operation method can be implemented as a computer program, stored in the hard disk 806, and loaded into the processor 802 for execution to implement the container control method of the present application.

[0186] Furthermore, those skilled in the art will appreciate that, in another embodiment, a container based on the IaaS cloud architecture of Openstack is also provided, which preferably adopts the above Figures 1 to 7 The illustrated embodiment is a POD applying for network resources or deleting network resources. However, those skilled in the art understand that, preferably, the container based on the Openstack IaaS cloud architecture includes the following modules:

[0187] -Create a new virtual network card module;

[0188] -Delete the virtual network card module;

[0189] -Mount the virtual network card module;

[0190] -Uninstall the virtual network card module;

[0191] -IP address management module;

[0192] -Virtual network card resource pool management module; and

[0193] -Configuration information file management module.

[0194] Correspondingly, the functional implementation of the above modules can refer to Figures 1 to 7 The illustrated embodiments and corresponding description implementations are not described in detail again.

[0195] Furthermore, those skilled in the art understand that in a preferred embodiment, according to the container network plug-in CNI specification standard, the CNI plug-in interface is implemented: implementing three interfaces: adding a network card, releasing a network card, and CNI plug-in information version. This part can implement the above three interfaces according to the standard.

[0196] Those skilled in the art will appreciate that, preferably, the TBwayd service provided by the present invention mainly implements:

[0197] 1. Create a new virtual network card from OpenStack;

[0198] 2. Delete the virtual network card;

[0199] 3. Mount the virtual network card;

[0200] 4. Uninstall the virtual network card;

[0201] 5. Rebuild the POD fixed IP;

[0202] 6. Assign a network to the container within the specified IP range;

[0203] 7. Virtual network card resource pool management;

[0204] 8. Configuration information file management function, etc.

[0205] However, the functions of the above-mentioned TBwayd service are not limited to the above-mentioned functional points and implementations.

[0206] The overall structure of the present invention is as follows Figure 7 As shown, the kubelet process on each working node will listen to the k8s-APIServer service and PODs events. When there is a change in the POD life cycle, it will be sensed and then decide on the next action. This is the standard process of k8s. The self-developed TBway plug-in is divided into two parts, which are deployed and run on each working node of k8s. The TBway plug-in implements the ADD and DEL interfaces based on the CNI standard for kubelet to call. After processing the parameters, it will call the TBwayd service to implement specific logic such as applying for and deleting the network. TBwayd is the main business processing logic service, through which it applies to the OpenStack infrastructure cloud platform for processing network resources. And the functions we implemented, such as POD fixed IP and specifying IP ranges for POD use, are all done in TBwayd.

[0207] TBwayd will send a request to the neutron-server service of the OpenStack platform to obtain or delete the network resources of the POD. During the request process, a security check will be performed through keystone, and further processing will be performed only after the check passes. After receiving the request, the neutron-server will inform the registered neutron-plugin plug-in through the message queue. The neutron-plugin plug-in will save the relevant information to the OpenStack network database or delete the information from the database according to the request operation. Then, the neutron-agent agent running on each OpenStack network node will be informed through the message queue. The neutron-agent agent will perform specific network creation or destruction actions on the node. If network-provide is used, the neutron-agent agent will send the request to the corresponding network-provider device to perform the actual operation.

[0208] The following takes creating a POD as an example to illustrate the specific processing steps. Deleting a POD is basically the same, except that one is applying for resources and the other is releasing resources:

[0209] 1. The kubelet service of the k8s cluster working node monitors the API Server service on the host (master) node and monitors PODs events. When the user initiates the creation of a POD, it will be perceived here;

[0210] 2. Follow the standard process of k8s to create a sandbox;

[0211] 3. When it comes to POD network resource application, kubelet will call the ADD interface of the TBway plug-in to process some parameters, and then call TBwayd through gRPC for specific processing;

[0212] 4. TBway plug-in applies for network resources from calling TBwayd;

[0213] 5. The TBwayd service will also obtain the POD information of the cluster from the API Server service of k8s, including annotation information. Our TBwayd will get these annotation information. The administrator can specify the IP or IP range of the POD to be created through the annotation in the yaml file. After TBwayd parses the IP information, it will pass this information to the neutron-server of Opensatck. If the IP specified by the administrator is a range, for a single-copy POD, the code will randomly select an IP from these ranges and pass it on. If it is a multi-copy POD, the code will allocate IPs from the IP range for each of these copies and then pass it on. If the administrator specifies an IP range but the number of copies is more than the given number of IPs, an error will be given here directly. If the administrator does not specify an IP, it is a normal application process, and OpenStack will automatically assign an IP to the network card for use.

[0214] 6. After TBwayd processes the network information, it will apply to the OpenStack infrastructure platform to allocate network resources for the POD. In a preferred embodiment, this is specifically achieved through the following steps:

[0215] 6.1. Apply for a virtual network card. Requesting OpenStack to allocate network resources actually includes multiple steps. The following are the operation logic on the OpenStack platform:

[0216] 6.1.1. First, TBwayd sends a request to create a network to the neutron-server service to apply for the creation of a virtual network card;

[0217] 6.1.2. For the OpenSatck platform, all incoming requests must be authenticated. After receiving the request, neutron-server will first authenticate with the keystone service. So where does the user password of the OpenSatck platform required for authentication come from? In our code, the administrator injects the configuration through ConfigMap. To simplify, we will authenticate with keystone when the TBwayd service is initialized and started, obtain a token certificate and save it in memory, and the program will periodically obtain and update the token every 40 minutes. In this way, when other requests come in, they can directly obtain the authenticated token and then process the request.

[0218] 6.1.3. After receiving the request to create a virtual network card, neutron-server notifies the registered neutron-plugin through the message queue.

[0219] 6.1.4. The neutron-plugin saves the network information to be created to the corresponding database and informs the neutron-agent running on the network node through the message queue.

[0220] 6.1.5. After receiving the information, the neutron-agent agent will also perform some database processing, and then create a network card device on the network node. If it is a provider network, it will apply to the provider device to create a network card device.

[0221] After successfully applying to OpenStack to create a network card, what is finally presented is a virtual network card with an IP specified by the administrator or a network card for which OpenStack automatically assigns an IP if the administrator does not specify an IP.

[0222] 6.2. Mount the virtual network card.

[0223] The network card applied for in step 6.1 is still an independent network resource on the IaaS platform and cannot be used at the POD level. You still need to mount the virtual network card to the virtual machine of the working node where the POD is located. The mounting process is also initiated by TBwayd to request the neutron-server service, which is similar to the above process, except that the specific resource operation method is different. After the mounting is successful, there will be an extra network card on the virtual machine of the working node where the POD is located.

[0224] There will be an extra network card on the virtual machine of the working node where the POD is located, and then the TBway plug-in will take over the subsequent processing and set the network card to the network namespace of the POD through iplink, that is, bind the network card to the POD. At this time, the working node where the POD is located will not see the network card, but the POD can see it.

[0225] After the above processing steps, the POD layer can directly use the network capabilities provided by our OpenStack infrastructure platform. The POD and virtual machine are on the same plane. At the same time, during the processing, the specified IP will be parsed and passed on according to the annotation information, and it will be decided whether to apply for the specified IP or the OpenStack platform will allocate it when applying for network information from OpenStack. When the POD is rebuilt, the code will first confirm with the OpenStack platform whether the network card of the specified IP already exists and is idle and unused. If it is idle, it will be used directly. Otherwise, the user will be informed, so as to meet the requirement of the POD fixed IP unchanged.

[0226] When deleting a POD, the process is basically the same as above, except that the TBway plug-in first unbinds the network card from the POD, and then TBwayd applies to OpenStack to uninstall the network card. For example, in a preferred embodiment, the application to delete a network resource can be completed through the following process:

[0227] 1. When deleting a Pod, the kubelet component in kubernetes calls the CNI plug-in to initiate a CMDDEL event;

[0228] 2. After receiving the CMDDEL event, the TBway-CNI plug-in calls the TBwayd backend service through gRPC;

[0229] 3. TBwayd obtains Pod information from K8S through gRPC calls and cleans up network resources in the Pod, such as routing and deleting veth pair device pairs;

[0230] 4. The TBway-CNI plug-in moves the virtual network card from the pod's network namespace to the host's network namespace;

[0231] 5. The TBway-CNI plug-in calls the TBwayd service again through gRPC to release the virtual machine network card that has just been removed from the host. TBwayed releases the network card including the following operations:

[0232] 5.1. TBwayd deletes the mapping relationship between the pod and the virtual network card;

[0233] 5.2. Put the released virtual network card into the idle virtual network card queue;

[0234] 5.3. The resource pool cache management object will periodically clean up unused network cards in the virtual network card resource pool according to certain rules, and will reallocate virtual network cards to ensure that there are a certain number of network cards in the pool;

[0235] 5.4. For the scenario of specifying an IP, after the virtual network card is placed in the resource pool, an OpenStack call will be immediately initiated to uninstall the binding of the virtual network card from the host machine, so that when the specified Pod drifts to other nodes, the virtual network card carrying the IP address can be bound to other nodes.

[0236] From the above analysis, we can see that the capabilities provided by various plug-ins have their own characteristics. Enterprises and users can choose different plug-ins according to their business scenarios. According to our current business scenario, we need a network plug-in that can achieve the following functions:

[0237] 1. It has basic CNI plug-in functions, which can add and delete networks to containers;

[0238] 2. Supports container reconstruction with fixed IP;

[0239] 3. Support creating containers within the specified IP range;

[0240] 4. You can directly use the network provided by our OpenStack infrastructure IaaS platform, and containers and virtual machines are at the same level in terms of use;

[0241] The above-mentioned mainstream K8s plug-ins cannot fully meet the above four functions due to their own reasons and limitations. In order to meet these pain points and meet our business needs, this solution proposes a container network solution based on the IaaS cloud architecture of OpenStack.

[0242] This solution is based on the CNI standard protocol and implements a new container network plug-in TBway. In addition to implementing the basic CNI interface functions, this plug-in can specify the IP when creating a POD and ensure that the IP does not change when the IP is rebuilt; and can specify an IP range to apply for an IP for the POD within this IP range; the network used by the container is applied to our OpenStack infrastructure IaaS platform, so that the container and the virtual machine are at the same level. From the application level, there is no difference between using containers and using virtual machines.

[0243] In order to be as flexible as possible, the configuration information required for plug-in initialization is injected through K8S's native ConfigMap, yaml and other files. Administrators can flexibly configure different IaaS environments and specify the IaaS network segment used by the entire container network. Administrators can also specify the fixed IP address of the POD through the configuration file.

[0244] The plug-in is based on the CNI protocol, which is similar to the mainstream plug-in architecture design and can be well expanded.

[0245] The network provided by the OpenStack infrastructure IaaS can theoretically be used on other cloud platforms, but it is necessary to apply for a network card and uninstall the network card according to the specific cloud platform to implement another set of interfaces, which is flexible and changeable.

[0246] It is obvious that this solution was developed because other mainstream network plug-in solutions cannot fully meet our actual needs. The new functional points of this solution are advantages that other plug-ins do not have, and this solution also draws on some design concepts of mainstream plug-ins:

[0247] Support POD fixed IP unchanged;

[0248] Supports applying for network resources for containers within a specified IP range;

[0249] Supports direct use of network capabilities provided by the open source OpenStack infrastructure cloud platform, and is not bound to cloud vendors in terms of ecology;

[0250] Supports injecting IaaS environment information, network information, etc. through configuration, and administrators can flexibly change according to actual needs;

[0251] Supports security authentication based on the OpenStack platform. When applying for network resources for POD, the request permission authentication of the OpenStack platform must be passed.

[0252] The previous network plug-in only has certain specific functional capabilities, while this plug-in can have the above capabilities at the same time. The key is that it can directly use the network capabilities provided by OpenStack. At the platform level, containers and virtual machines use the same network and are at the same level. Because the container network is not at the forwarding layer, it directly uses the IaaS network, which has better performance. And the IP of the POD can be fixed as needed, which is particularly important in some of our traditional financial applications and provides strong support for the migration of traditional applications to the containerized environment.

[0253] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art may make various modifications or variations within the scope of the claims, which do not affect the essence of the present invention.

Claims

1. A container control method based on IaaS cloud architecture of Openstack, used to apply for network resources for POD or delete network resources, characterized in that: The steps include: Step a: Receive request information for creating a POD; Step b: creating a sandbox based on the request information; Step c: The TBway plug-in calls the TBwayd service to apply for network resources. Step c includes the following steps: Step c1: kubelet calls the ADD interface of the TBway plug-in to process the parameters corresponding to the network resources; Step c2: kubelet calls TBwayd service through gRPC; Step c3: the TBway plug-in calls the TBwayd service to apply for the network resources; Step d: The TBwayd service determines the parameters corresponding to the network resources, and the step d comprises the following steps: Step d1: The TBwayd service obtains the POD information of the cluster from the API Server service of k8s; Step d2: Determine parameters corresponding to the network resource based on the POD information, where the parameters corresponding to the network resource include an IP address or IP address range corresponding to the POD; Step e: The TBwayd service applies to the OpenStack infrastructure platform to allocate network resources for the POD and obtains the corresponding network resources. Step e includes the following steps: Step e1: The TBwayd service applies to the neutron-server service for creating a virtual network card corresponding to the POD; Step e2: The TBwayd service requests the neutron-server service to mount the virtual network card to the working node virtual machine where the POD is located; Step f: The TBway plug-in sets the network resources to the network namespace of the POD via iplink.

2. The control method according to claim 1, characterized in that: Before step a, the method further includes the following steps: Step i: monitor the POD event, wherein the request information for creating the POD is obtained based on the monitoring.

3. The control method according to claim 2, characterized in that: The step of monitoring the POD event in step i comprises the following steps: Step i1: The kubelet service of the k8s cluster working node monitors the API Server service on the host node to monitor the POD event.

4. The control method according to any one of claims 1 to 3, characterized in that: When the TBwayd service is called, the following steps are also included: -TBwayd service authenticates keystone and obtains a token certificate.

5. The control method according to claim 4, characterized in that: The token certificate is stored in the memory or in the server.

6. The control method according to claim 1, characterized in that: The parameters corresponding to the network resource include the IP address or IP address range corresponding to the POD.

7. The control method according to claim 1, characterized in that: The step e1 comprises the following steps: Step e11: The TBwayd service sends a request message for creating network resources to the neutron-server service to apply for creating a virtual network card; Step e12: neutron-server completes the authentication process of the request information; Step e13: The neutron-plugin plug-in and the neutron-agent agent corresponding to the neutron-server complete the process of creating a virtual network card based on the request information, and create a virtual network card with an IP address for the POD.

8. The control method according to claim 1, characterized in that: After step f, the method further comprises the following steps: Step A: receiving a request to delete a POD; Step B: The kubelet component in kubernetes calls the CNI plug-in to initiate a CMDDEL event; Step C: After receiving the CMDDEL event, the TBway-CNI plug-in calls the TBwayd service through gRPC; Step D: The TBwayd service obtains POD information from K8S through gRPC calls and cleans up network resources in the POD; Step E: The TBway-CNI plug-in moves the virtual network card from the POD's network namespace to the host's network namespace; Step F: The TBway-CNI plug-in calls the TBwayd service through gRPC to release the VM network card that has just been moved out of the host machine.

9. The control method according to claim 8, characterized in that: The step F also includes the following steps: Step F1: the TBwayd service deletes the mapping relationship between the POD and the virtual network card; Step F2: putting the released virtual network card into an idle virtual network card queue.

10. The control method according to claim 8 or 9, characterized in that: The control method further comprises the following steps: -The resource pool cache management object will periodically clean up unused virtual network cards in the virtual network card resource pool according to certain rules, and will reallocate virtual network cards to ensure that there are a certain number of available virtual network cards in the pool.

11. The control method according to claim 10, characterized in that: After this step, the following steps are also included: -Openstack is called to uninstall the binding of the virtual network card from the host so that when the specified POD drifts to other nodes, the virtual network card carrying the IP address can be bound to other nodes.

12. A container control device based on IaaS cloud architecture of Openstack, characterized in that: include: a memory for storing instructions executable by a processor; A processor, configured to execute the instructions to implement the method according to any one of claims 1 to 11.

13. A container based on IaaS cloud architecture of Openstack, characterized in that: A control method according to any one of claims 1 to 10 is used to apply for network resources or delete network resources for a POD, which includes the following modules: -Create a new virtual network card module; -Delete the virtual network card module; -Mount the virtual network card module; -Uninstall the virtual network card module; -IP address management module; -Virtual network card resource pool management module; and -Configuration information file management module.