A method and system for creating a container of a function instance
Through the collaborative work of the cloud management system and the SDN controller, the problem of time-consuming virtual network card allocation and insufficient IP resources of the Serverless technology framework in the public cloud environment is solved, and rapid network configuration and large-scale expansion capabilities of function instances are realized, improving the Cold start speed and network orchestration efficiency.
Patent Information
- Application Number
- CN202111600574.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-12-24
AI Technical Summary
The existing serverless technology framework is difficult to effectively combine function instances with virtual private cloud network capabilities in public cloud environments, resulting in long virtual network card allocation and insufficient IP resources, which affects the cold start speed and large-scale expansion capabilities of function instances.
Obtain logical switches and available IP addresses through the cloud management system, use the SDN controller to uniformly orchestrate function instance networks, create dedicated logical routers and network segments, and achieve rapid network configuration and virtual network card allocation for containers.
It solves the problem of combining function instance network and VPC network orchestration, improves cold start speed, ensures sufficient IP resources, and supports large-scale horizontal expansion.
Smart Images

Figure CN114489931B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer communication technology, and in particular to a method and system for creating a container of a function instance. Background Art
[0002] As cloud computing develops, computing power is provided in more and more forms, from virtual machines to containers to Serverless (function computing). Container technology has become an important cornerstone of current cloud computing and an important technical means to achieve Serverless. Through containers, users can easily package the operating environment of various programming languages. Through container orchestration, the Serverless platform can quickly deploy it to a large computing cluster.
[0003] Most of the current Serverless technology frameworks require kubernetes (k8s) to provide a base, and realize function computing capabilities through k8s orchestration. However, k8s has natural disadvantages in network multi-tenant isolation and network orchestration capabilities. How to combine Serverless with tenants' VPC (Virtual Private Cloud) network capabilities in a public cloud environment, and how to quickly allocate virtual networks for function instances are challenges that all major public cloud vendors need to face. Existing different solutions often have certain limitations. For example, virtual network card allocation takes a long time, which increases the time for function cold start. For another example, the subnet IP range is limited, and it cannot guarantee large-scale horizontal expansion of function instances in a short time. Summary of the invention
[0004] In order to solve the above problems, an embodiment of the present invention provides a method and system for creating a container of a function instance.
[0005] One aspect of the present invention provides a method for creating a container of a function instance, the method comprising:
[0006] The function instance management module of the cloud management system obtains the logical switch and the available IP address from the IP address management module according to the virtual private cloud associated with the function instance in the node device;
[0007] The IP address management module selects an available IP address from the cache and feeds the selected IP address back to the function instance management module;
[0008] The function instance management module writes an annotation for the container based on the received IP address, marking the logical switch and IP address associated with the container to generate definition information of the container;
[0009] The cloud management system initiates a request to create a container according to the definition information of the container to complete the container creation task of the function instance.
[0010] In one embodiment, the method further comprises:
[0011] Openvswitch is deployed in the node device running the serverless component, and the node device deployed with openvswitch is registered in the SDN controller so that the network of each function instance can be uniformly orchestrated through the SDN controller.
[0012] In one embodiment, the virtual private cloud is created by the cloud management system for each function instance within the cloud, and the cloud management system sends down a flow table through the SDN controller to create a logical router and a logical switch dedicated to the function instance, and allocates a dedicated subnet with a 16-bit mask segment through gateway port association.
[0013] In one embodiment, after generating the definition information of the container, the method further includes:
[0014] The cloud management system sends a flow table through the SDN controller according to the network information allocated to the container to create a corresponding logical port.
[0015] In one embodiment, after completing the container creation task of the function instance, the method further includes:
[0016] Create a virtual network card for the container through the function instance network interface, and associate the logical port and synchronization flow table;
[0017] The CNI interacts with the kubelet process on the node device, wherein the kubelet process sends a network configuration request to the CNI when instantiating a container, so that the CNI performs network configuration for the instantiated container.
[0018] Another aspect of the present invention further provides a container creation system for a function instance, the system comprising a cloud management system, a node device, an IP address management module and a virtual private cloud, wherein:
[0019] The cloud management system includes a function instance management module, which is used to obtain a logical switch and an available IP address from the IP address management module according to a virtual private cloud associated with a function instance in a node device;
[0020] The IP address management module is used to select an available IP address from the cache and feed the selected IP address back to the function instance management module;
[0021] The function instance management module is further used to write annotations for the container based on the received IP address, marking the logical switch and IP address associated with the container to generate definition information of the container;
[0022] The cloud management system is also used to initiate a request to create a container based on the definition information of the container to complete the container creation task of the function instance.
[0023] In one embodiment, openvswitch is deployed in the node device running the serverless component, and the system also includes an SDN controller, wherein the node device deployed with openvswitch is registered in the SDN controller so that the network of each function instance is uniformly orchestrated through the SDN controller.
[0024] In one embodiment, the virtual private cloud is created by the cloud management system for each function instance within the cloud, and the cloud management system sends down a flow table through the SDN controller to create a logical router and a logical switch dedicated to the function instance, and allocates a dedicated subnet with a 16-bit mask segment through gateway port association.
[0025] In one embodiment, the cloud management system is further configured to send a flow table through an SDN controller according to the network information allocated to the container to create a corresponding logical port.
[0026] In one embodiment, the system also includes a function instance network interface, which is used to create a virtual network card for the container, and associate logical ports and synchronize flow tables; interact with the kubelet process on the node device through CNI, wherein the kubelet process sends a network configuration request to the CNI when instantiating the container, so that the CNI performs network configuration for the instantiated container.
[0027] The technical solution provided by this application has at least the following technical effects:
[0028] 1) Provide a solution that combines the Serverless function instance network and VPC network orchestration capabilities, so that function instances can access VPC resources (including virtual machines, containers, databases, etc.), access the public network through a fixed IP address, and access resources outside the cloud through dedicated lines and SD-WAN (Software Defined Wide Area Network).
[0029] 2) Solve the time-consuming problem of network allocation when the virtual network card of the function instance is rapidly expanded horizontally, and improve the cold start speed.
[0030] 3) Solve the problem that the traditional VPC subnet IP resources are insufficient, resulting in the inability to successfully create functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:
[0032] Figure 1 A schematic diagram showing the steps of a method for creating a container of a function instance in one embodiment of the present invention is shown;
[0033] Figure 2 A schematic diagram of the system structure including an SDN controller in one embodiment of the present invention is shown;
[0034] Figure 3 A schematic diagram of a structure for creating a function instance in one embodiment of the present invention is shown;
[0035] Figure 4 A schematic diagram showing the structure of a network configuration in one embodiment of the present invention is shown. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0037] See also Figure 1 , the present application provides a method for creating a container of a function instance, and the method includes the following steps.
[0038] S1: The function instance management module of the cloud management system obtains the logical switch and available IP address from the IP address management module according to the virtual private cloud associated with the function instance in the node device;
[0039] S2: The IP address management module selects an available IP address from the cache, and feeds the selected IP address back to the function instance management module;
[0040] S3: The function instance management module writes a comment for the container based on the received IP address, marking the logical switch and IP address associated with the container to generate definition information of the container;
[0041] S4: The cloud management system initiates a request to create a container according to the definition information of the container to complete the container creation task of the function instance.
[0042] In one embodiment, the method further comprises:
[0043] Openvswitch is deployed in the node device running the serverless component, and the node device deployed with openvswitch is registered in the SDN controller so that the network of each function instance can be uniformly orchestrated through the SDN controller.
[0044] In one embodiment, the virtual private cloud is created by the cloud management system for each function instance within the cloud, and the cloud management system sends down a flow table through the SDN controller to create a logical router and a logical switch dedicated to the function instance, and allocates a dedicated subnet with a 16-bit mask segment through gateway port association.
[0045] In one embodiment, after generating the definition information of the container, the method further includes:
[0046] The cloud management system sends a flow table through the SDN controller according to the network information allocated to the container to create a corresponding logical port.
[0047] In one embodiment, after completing the container creation task of the function instance, the method further includes:
[0048] Create a virtual network card for the container through the function instance network interface, and associate the logical port and synchronization flow table;
[0049] The CNI interacts with the kubelet process on the node device, wherein the kubelet process sends a network configuration request to the CNI when instantiating a container, so that the CNI performs network configuration for the instantiated container.
[0050] Specifically, in the technical solution provided by this application, each component includes:
[0051] VPC: Virtual Private Cloud (VPC), builds an isolated, user-configured and managed virtual network environment for cloud hosts, cloud containers, cloud databases, cloud functions and other resources.
[0052] Function instance management module: performs function instance lifecycle management and network parameter configuration; network parameters are marked through container (pod) annotations, including the allocated VPC, subnet, and IP address.
[0053] Function instance network interface: implements a container network allocation interface that complies with the CNI (Container Network Interface) standard, and provides virtual network card configuration capabilities for containers running function instances; creates a corresponding virtual network card based on the pod annotation, and associates it with the flow table to connect the container network to the VPC.
[0054] IPAM (IP Address Manager) module: manages IP addresses and allocates IP addresses to function instances; dedicated subnet for function instances, 16-bit mask, each VPC supports providing IP addresses for 65025 function instances.
[0055] Logical switch: implemented through flow tables. Each logical switch is assigned an IP address of a network segment and connected to the VPC through a routing port to access the logical router. A dedicated logical switch is provided for function instances and associated with a network segment with a 16-bit mask.
[0056] Logical router: implemented through flow tables, routing ports connected to logical switches, providing static routing and policy routing capabilities. One logical router is allocated to each VPC; function instance dedicated logical switches and VPC logical routing.
[0057] SDN (Software Defined Network) controller: manages flow tables, manages the declaration lifecycle of logical switches and logical routers, and orchestrates the network of function instances. In this example, OVN (Open Virtual Network) is used as the controller, and the underlying datapath is implemented by OVS (Open Virtual Switch).
[0058] Logical port: implemented through flow table, belongs to logical switch, and virtual network card is connected to logical switch through logical port.
[0059] Virtual NIC: A NIC for a function instance (virtual machine, container, function instance) in the cloud. It is created in the form of a veth NIC pair in a function instance. One end serves as a container NIC, and the other end is connected to a logical switch and associated with a VPC network.
[0060] In a specific application scenario, the technical solution of this application can be implemented through the following process:
[0061] Please combine Figure 2, SDN node management: deploy openvswitch on all k8s nodes running serverless components and register them with the northbound SDN controller of the cloud management, such as the OVN controller. OVN will uniformly orchestrate the networks of all function instances in the cloud.
[0062] VPC network initialization: The cloud management system creates a VPC for the function instance in the cloud, sends the flow table through the SDN controller, creates a logical router and a dedicated logical switch for the function instance, associates them through the gateway port, and allocates a dedicated subnet with a 16-bit mask network segment.
[0063] See also Figure 3 and Figure 4 , create a pod for the function instance in VPC:
[0064] 1) The function instance management module of the cloud management system obtains the logical switch and available IP information from the IPAM module based on the VPC associated with the function instance;
[0065] 2) The IPAM module randomly selects available IP address information from the cache based on the VPC information and returns it to the function management module;
[0066] 3) The function instance management module injects annotations into the pod to mark the associated logical switch and IP address based on the results returned by IPAM, and generates a complete pod definition and returns it to the cloud management system;
[0067] 4) The cloud management system creates the corresponding logical port by sending the flow table through the SDN controller according to the network information assigned to the pod;
[0068] 5) Based on the pod definition of the function instance, the cloud management system initiates a request to k8s to create a pod to complete the task of creating the function instance.
[0069] Create a virtual network card for the pod:
[0070] 1) The function instance network interface service implements the creation of a virtual network card for the pod. The virtual network card can be implemented through a network card pair (vnic-peer), and is associated with the function of synchronizing the flow table of the logical port, and interacts with the kubelet on the k8s node through the cni interface;
[0071] 2) When Kubelet instantiates a pod, it sends a network configuration request to cni. When cni receives the request, it performs network configuration on the instantiated pod. During the configuration process, one of the network cards in the network card pair is mounted to the pod, and the other network card is mounted to ovs through a bridge (br-int).
[0072] It can be seen that the technical solution provided by this application realizes the following functions:
[0073] 1. The k8s nodes and other virtualized nodes that run function instances have a unified SDN controller;
[0074] 2. Allocate a dedicated logical switch for the function in the VPC, and allocate a dedicated 16-bit address segment to provide sufficient IP address inventory. The IPAM module calculates and allocates IP addresses in the cache, so that they can be quickly allocated to the network when the function instance is expanded on a large scale.
[0075] 3. Deploy the function instance-specific CNI in the k8s node. The CNI creates a virtual network card for the pod and associates the virtual network card with the flow table of the VPC.
[0076] The present application also provides a container creation system for a function instance, the system comprising a cloud management system, a node device, an IP address management module, and a virtual private cloud, wherein:
[0077] The cloud management system includes a function instance management module, which is used to obtain a logical switch and an available IP address from the IP address management module according to a virtual private cloud associated with a function instance in a node device;
[0078] The IP address management module is used to select an available IP address from the cache and feed the selected IP address back to the function instance management module;
[0079] The function instance management module is further used to write annotations for the container based on the received IP address, marking the logical switch and IP address associated with the container to generate definition information of the container;
[0080] The cloud management system is also used to initiate a request to create a container based on the definition information of the container to complete the container creation task of the function instance.
[0081] In one embodiment, openvswitch is deployed in the node device running the serverless component, and the system also includes an SDN controller, wherein the node device deployed with openvswitch is registered in the SDN controller so that the network of each function instance is uniformly orchestrated through the SDN controller.
[0082] In one embodiment, the virtual private cloud is created by the cloud management system for each function instance within the cloud, and the cloud management system sends down a flow table through the SDN controller to create a logical router and a logical switch dedicated to the function instance, and allocates a dedicated subnet with a 16-bit mask segment through gateway port association.
[0083] In one embodiment, the cloud management system is further configured to send a flow table through an SDN controller according to the network information allocated to the container to create a corresponding logical port.
[0084] In one embodiment, the system also includes a function instance network interface, which is used to create a virtual network card for the container, and associate logical ports and synchronize flow tables; interact with the kubelet process on the node device through CNI, wherein the kubelet process sends a network configuration request to the CNI when instantiating the container, so that the CNI performs network configuration for the instantiated container.
[0085] The technical solution provided by this application has at least the following technical effects:
[0086] 1) Provide a solution that combines the Serverless function instance network and VPC network orchestration capabilities, so that function instances can access VPC resources (including virtual machines, containers, databases, etc.), access the public network through a fixed IP address, and access resources outside the cloud through dedicated lines and SD-WAN (Software Defined Wide Area Network).
[0087] 2) Solve the time-consuming problem of network allocation when the virtual network card of the function instance is rapidly expanded horizontally, and improve the cold start speed.
[0088] 3) Solve the problem that the traditional VPC subnet IP resources are insufficient, resulting in the inability to successfully create functions.
[0089] Those skilled in the art can understand that all or part of the processes in the above-mentioned implementation methods can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the implementation methods of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0090] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for creating a container for a function instance. It is characterized in that The method comprises: The function instance management module of the cloud management system obtains the logical switch and the available IP address from the IP address management module according to the virtual private cloud associated with the function instance in the node device; The IP address management module selects an available IP address from the cache and feeds the selected IP address back to the function instance management module; The function instance management module writes a comment for the container based on the received IP address, marking the logical switch and IP address associated with the container to generate definition information of the container; The cloud management system initiates a request to create a container according to the definition information of the container to complete the container creation task of the function instance.
2. The method according to claim 1, It is characterized in that The method further comprises: Openvswitch is deployed in the node device running the serverless component, and the node device deployed with openvswitch is registered in the SDN controller so that the network of each function instance can be uniformly orchestrated through the SDN controller.
3. The method according to claim 1, It is characterized in that The virtual private cloud is created by the cloud management system for each function instance in the cloud, and the cloud management system sends down the flow table through the SDN controller to create a logical router and a logical switch dedicated to the function instance, and allocates a dedicated subnet with a 16-bit mask segment through gateway port association.
4. The method according to claim 1, It is characterized in that After generating the definition information of the container, the method further includes: The cloud management system sends a flow table through the SDN controller according to the network information allocated to the container to create a corresponding logical port.
5. The method according to claim 1, It is characterized in that After completing the task of creating a container for the function instance, the method further includes: Create a virtual network card for the container through the function instance network interface, and associate the logical port and synchronization flow table; The CNI interacts with the kubelet process on the node device, wherein the kubelet process sends a network configuration request to the CNI when instantiating a container, so that the CNI performs network configuration for the instantiated container.
6. A container creation system for function instances, It is characterized in that The system includes a cloud management system, a node device, an IP address management module and a virtual private cloud, wherein: The cloud management system includes a function instance management module, which is used to obtain a logical switch and an available IP address from the IP address management module according to a virtual private cloud associated with a function instance in a node device; The IP address management module is used to select an available IP address from the cache and feed the selected IP address back to the function instance management module; The function instance management module is further used to write annotations for the container based on the received IP address, marking the logical switch and IP address associated with the container to generate definition information of the container; The cloud management system is also used to initiate a request to create a container based on the definition information of the container to complete the container creation task of the function instance.
7. The system according to claim 6, It is characterized in that Openvswitch is deployed in the node device running the serverless component, and the system also includes an SDN controller, wherein the node device deployed with openvswitch is registered in the SDN controller so that the network of each function instance is uniformly orchestrated through the SDN controller.
8. The system according to claim 6, It is characterized in that The virtual private cloud is created by the cloud management system for each function instance in the cloud, and the cloud management system sends down the flow table through the SDN controller to create a logical router and a logical switch dedicated to the function instance, and allocates a dedicated subnet with a 16-bit mask segment through gateway port association.
9. The system according to claim 6, It is characterized in that The cloud management system is also used to send a flow table through the SDN controller according to the network information allocated to the container to create a corresponding logical port.
10. The system according to claim 6, It is characterized in that The system also includes a function instance network interface, which is used to create a virtual network card for the container, and associate logical ports and synchronize flow tables; interact with the kubelet process on the node device through CNI, wherein the kubelet process sends a network configuration request to the CNI when instantiating the container, so that the CNI performs network configuration for the instantiated container.
