Container IP network configuration method and device based on container cloud platform
By creating IP collection files and resource objects in the container cloud platform, the problem of IP fixation for multi-replica deployed service instances is solved, and the pre-application and fixation of container networks are realized, meeting the security requirements of financial-grade network security.
Patent Information
- Application Number
- CN202310199213.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-02-27
AI Technical Summary
Existing technologies are unable to achieve IP fixation for multi-replica deployment service instances, resulting in container IP usage conflicts and network problems, and are unable to meet the security and protection requirements of financial-grade computer information systems.
By creating an IP collection file and resource objects, determining the target IP, and setting it in order to the pod description information template, establishing a correspondence between the pod and the IP, and realizing the pre-application and fixation of the container network.
It achieves IP fixation for multiple container instances, improves the efficiency of launching containerized applications, and meets the security requirements of financial-grade network security.
Smart Images

Figure CN116346779B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer information technology, and in particular to a container IP network configuration method and device based on a container cloud platform. Background Art
[0002] In accordance with the security protection requirements for financial-grade computer information systems, the following requirements are often encountered in the production practice of financial-grade container cloud platforms: the IP (Internet Protocol) of the service instance of the containerized application must be fixed, and the IP of the containerized application must be able to support pre-application.
[0003] To meet these requirements, existing technologies in the current open-source Kubernetes container orchestration system and container network solutions can support direct manipulation of pod description files to fix IP addresses, enabling pod containers to use specific IP addresses.
[0004] However, the inventors found that there are at least the following technical problems in the existing technology: the existing technology only supports the fixed IP of a single service instance (a pod), cannot meet the requirements of deploying multiple replica service instances, cannot achieve unified IP allocation management, and easily causes container IP usage conflicts, thereby causing network problems. Summary of the Invention
[0005] The present application provides a container IP network configuration method and device based on a container cloud platform, which is used to solve the problem in the prior art that the IP address of a multi-copy deployment service instance pod cannot be fixed.
[0006] In a first aspect, the present application provides a container IP network configuration method based on a container cloud platform, comprising:
[0007] Creating an Internet Protocol IP collection file and a resource object of the IP collection file, and setting IP resource pool information and IP number information in the description information of the resource object of the IP collection file;
[0008] Obtaining the status information of the IP set file, determining the target IP according to the IP resource pool information and the IP number information, and setting the IP information of the target IP in the state information of the IP set file in an orderly manner;
[0009] Create a Kubernetes deployment model, obtain all pods in the deployment model, add the status information of the IP set file to the description information template of the pod, and establish a correspondence between the pod and the IP information in the status information of the IP set file in the description information template as the pod description information;
[0010] Configuring the pod on a Kubernetes node and creating a pod container on the node based on the pod description information;
[0011] The IP information required by the pod container is determined according to the corresponding relationship in the pod description information, and the network configuration of the pod container is completed according to the IP information.
[0012] In one possible design, the state information of the IP collection file is obtained, the target IP is determined according to the IP resource pool information and the IP number information, and the IP information of the target IP is set in order to the state information of the IP collection file, including: obtaining the state information of the IP collection file, determining the target IP resource pool according to the IP resource pool information; determining the number of target IPs according to the IP number information; obtaining the number of target IPs from the target IP resource pool that is the number of target IPs; and setting the IP information of the target IP to the state information of the IP collection file in order.
[0013] In one possible design, the correspondence between the pod and the IP information in the status information of the IP collection file is established in the description information template, including: setting the name of each pod in all pods in the description information template of the pod; and making a one-to-one correspondence between the name of the pod and the IP information in the status information of the IP collection file to obtain the correspondence between the pod and the IP information in the status information of the IP collection file.
[0014] In one possible design, the IP information required for the pod container is determined according to the correspondence in the pod description information, and the network configuration of the pod container is completed according to the IP information, including: obtaining the correspondence between the name of the pod in the pod description information and the IP information in the status information of the IP collection file; determining the IP information required for the pod container according to the correspondence; determining the target container network configuration method according to the environment where the deployment model is located; and performing the network configuration of the pod container according to the IP information using the target container network configuration method.
[0015] In one possible design, before creating the IP collection file and the resource object of the IP collection file, and setting the IP resource pool information and IP number information in the description information of the resource object of the IP collection file, it also includes: creating a custom file for the IP collection file, creating a resource object for the IP collection file based on the custom file of the IP collection file; creating a custom file for the IP resource pool, creating an IP resource pool resource object based on the custom file of the IP resource pool, and configuring the IP resource pool based on the IP resource pool resource object.
[0016] In a second aspect, the present application provides a container IP network configuration device based on a container cloud platform, comprising:
[0017] A first creation module is used to create an Internet Protocol IP collection file and a resource object of the IP collection file, and set IP resource pool information and IP number information in the description information of the resource object of the IP collection file;
[0018] a determination module, configured to obtain the status information of the IP set file, determine the target IP according to the IP resource pool information and the IP number information, and set the IP information of the target IP in the status information of the IP set file in an orderly manner;
[0019] Establish a module for creating a Kubernetes deployment model, obtaining all pods in the deployment model, adding the status information of the IP set file to the description information template of the pod, and establishing a correspondence between the pod and the IP information in the status information of the IP set file in the description information template as the pod description information;
[0020] A second creation module is used to configure the pod to a Kubernetes node and create a pod container on the node according to the pod description information;
[0021] A network configuration module is used to determine the IP information required by the pod container according to the corresponding relationship in the pod description information, and complete the network configuration of the pod container according to the IP information.
[0022] In one possible design, the determination module is specifically used to: obtain the status information of the IP collection file, determine the target IP resource pool based on the IP resource pool information; determine the number of target IPs based on the IP number information; obtain the number of target IPs from the target IP resource pool that is the number of target IPs; and set the IP information of the target IPs in an orderly manner into the status information of the IP collection file.
[0023] In a third aspect, the present application provides an electronic device comprising: at least one processor and a memory; the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory to implement a container IP network configuration method based on a container cloud platform as in the first aspect and any possible design of the first aspect.
[0024] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to implement a container IP network configuration method based on a container cloud platform as in the first aspect and any possible design of the first aspect.
[0025] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements a container IP network configuration method based on a container cloud platform as in the first aspect and any possible design of the first aspect.
[0026] The container IP network configuration method and device based on the container cloud platform provided in this application determines the target IP by pre-creating an IP collection file and a resource object of the IP collection file, thereby realizing the pre-application of the pod container network IP and improving the efficiency of the containerized application launch. In addition, by adding the status information of the IP collection file with the IP information of the target IP to the description information template of the pod, a correspondence between the IP information of the pod and the target IP is established in the description information template, thereby determining the IP information required for the pod container based on the correspondence, realizing the fixation of the pod container network IP of multiple instances of the containerized application, and meeting the security requirements of financial-grade network security. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0028] Figure 1 A schematic diagram of the container IP network configuration system architecture based on the container cloud platform provided in an embodiment of the present application;
[0029] Figure 2 The process of the container IP network configuration method based on the container cloud platform provided in the embodiment of this application Figure 1 ;
[0030] Figure 3 The process of the container IP network configuration method based on the container cloud platform provided in the embodiment of this application Figure 2 ;
[0031] Figure 4 The process of the container IP network configuration method based on the container cloud platform provided in the embodiment of this application Figure 3 ;
[0032] Figure 5 A schematic diagram of the structure of a container IP network configuration device based on a container cloud platform provided in an embodiment of the present application;
[0033] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0034] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0035] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0036] Technical term explanation:
[0037] Container cloud platform: In this article, it refers to a container cluster orchestration system based on Kubernetes. It is a scalable and portable containerized load scheduling and management platform that can provide containerized applications with container deployment, resource management, cluster scheduling, elastic scaling, service discovery, and other functions required for full container lifecycle management.
[0038] CRD (Custom Resource Definitions): A custom resource in Kubernetes that stores structured data. It extends the Kubernetes API, enhances capabilities not native to Kubernetes, and makes Kubernetes more modular.
[0039] Operator (custom controller): A model for implementing Kubernetes extensibility. An Operator is a client of the Kubernetes API and acts as a controller for custom resource definitions (CRDs). Based on CRD resource definitions, it automatically implements the required business logic.
[0040] StatefulSet: A built-in Kubernetes resource object used to manage stateful application workloads. Pods created based on StatefulSet have some stable identifiers, such as an unchanging pod name and a stable unique identifier.
[0041] Pod: The smallest deployable computing unit that can be created and managed in Kubernetes, which contains a group of containers, these containers have networking and storage, and are scheduled together in Kubernetes and run in a shared context.
[0042] CNI (Container Network Interface) plug-in: A program used to implement the Kubernetes container network interface, which meets the Kubernetes container network model and can provide interconnected network services for containers on the Kubernetes container cloud platform. It is deployed as a binary file on every Kubernetes node.
[0043] In line with financial-grade computer information system security requirements, production practices for financial-grade container cloud platforms often encounter the following requirements: First, the IP addresses of containerized application service instances must be fixed. This must remain unchanged during image updates, container restarts, and even container migration across nodes. This requirement not only meets financial-grade security compliance requirements, but also requires that service instances report relevant information to the CMDB (Configuration Management Database) during production operations, consistent with data center management requirements, to meet business application service instance registration requirements. Furthermore, from a production and maintenance perspective, when production issues arise, service instances can be promptly located based on their IP addresses, enabling rapid problem analysis and resolution. Second, containerized application IP addresses must be pre-approved. In financial-grade data centers, due to strict network security regulations, availability zones for different purposes are isolated by default, with no connectivity between networks (for example, between the application network and the database network). This requires that network access relationships be activated before services go live. Considering the application process for opening network access relationships, in order to speed up the efficiency of service launch, the container cloud platform needs to provide a method for pre-applying for IP addresses and normal container usage. In response to these requirements, the current open source Kubernetes container orchestration system and container network solution can support direct manipulation of pod description files to fix IP addresses, enabling pod containers to use specific IP addresses. However, there are also the following problems: it only supports IP fixation for a single service instance (one pod) and cannot meet the requirements for deploying service instances with multiple replicas, such as deploying multiple replicas in a StatefulSet. It cannot automatically assign IP addresses to pods, which is suitable for simple manual manipulation of pod description files but not for large-scale production applications. It cannot achieve unified IP allocation management, which can easily cause container IP usage conflicts and cause network problems.
[0044] In response to the above technical problems, this application proposes the following technical concept: by pre-creating an IP collection file and a resource object of the IP collection file, the target IP is determined. By setting the IP information of the target IP into the status information of the IP collection file, and adding the status information of the IP collection file to the description information template of the pod, a correspondence between the pod and the IP information in the status information of the IP collection file is established in the description information template as the pod description information. Therefore, the IP information required by the pod container can be determined based on the correspondence in the pod description information, and the network configuration of the pod container is completed based on the IP information, thereby realizing the pre-application of IP and the pre-application of IP.
[0045] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0046] Figure 1 This is a schematic diagram of the container IP network configuration system architecture based on the container cloud platform provided in the embodiment of this application. Figure 1 In the above architecture, the above architecture includes at least one of a receiving device 101, a processor 102 and a display device 103.
[0047] It is understood that the structure illustrated in the embodiment of this application does not constitute a specific limitation on the architecture of the container IP network configuration system based on the container cloud platform. In other feasible implementations of this application, the above architecture may include more or fewer components than shown in the figure, or combine or split certain components, or arrange components differently. The specific configuration can be determined according to the actual application scenario and is not limited here. Figure 1 The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0048] In a specific implementation process, the receiving device 101 may be an input / output interface or a communication interface.
[0049] Processor 102 can be the processor of the server or the server itself. It can determine the target IP by pre-creating an IP collection file and a resource object of the IP collection file, and by setting the IP information of the target IP to the status information of the IP collection file, and adding the status information of the IP collection file to the description information template of the pod. A correspondence between the pod and the IP information in the status information of the IP collection file is established in the description information template as the pod description information, so that the IP information required for the pod container can be determined according to the correspondence in the pod description information, and the network configuration of the pod container can be completed according to the IP information, thereby realizing the pre-application of the IP and the fixation of the IP.
[0050] The display device 103 can be used to display the above results and the like.
[0051] The display device may also be a touch screen display, which is used to receive user instructions while displaying the above content to achieve interaction with the user.
[0052] It should be understood that the above-mentioned processor can be implemented by the processor reading instructions in the memory and executing the instructions, or it can be implemented by a chip circuit.
[0053] In addition, the network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0054] The technical solution of this application is described in detail below with reference to specific embodiments:
[0055] Figure 2 The process of the container IP network configuration method based on the container cloud platform provided in the embodiment of this application Figure 1 The execution entity of this embodiment can be Figure 1 The processor shown can also be an electronic device such as a server or a personal computer, such as Figure 2 As shown, the container IP network configuration method based on the container cloud platform includes:
[0056] S201: Create an Internet Protocol IP collection file and a resource object of the IP collection file, and set IP resource pool information and IP number information in the description information of the resource object of the IP collection file.
[0057] In this embodiment, before creating the IP set file and the resource object of the IP set file and setting the IP resource pool information and the IP number information in the description information of the resource object of the IP set file, the following steps are further included:
[0058] Step a1: Create a custom file for the IP collection file, and create a resource object for the IP collection file according to the custom file for the IP collection file.
[0059] Specifically, a CRD custom file for the IP collection file is created through the kube-apiserver, and the CRD custom resource is imported into Kubernetes. The kube-apiserver creates a resource object for the IP collection file based on the CRD custom resource, and sets the IP resource pool information and IP quantity information in the description information of the resource object of the IP collection file, as well as other parameter information that may be related to the specific network implementation technology, such as whether to set an elastic exclusive network card in a public cloud environment. Among them, kube-apiserver is one of the core components of Kubernetes. Resource objects are resource entities operated in Kubernetes, which are used to define resource types and uniqueness. Resource objects can be created, modified, or deleted.
[0060] Step a2: Create a custom file for the IP resource pool, create a resource object for the IP resource pool based on the custom file, and configure the IP resource pool based on the resource object.
[0061] Specifically, create a CRD definition file for the IP resource pool through the kube-apiserver and import the CRD custom resource into Kubernetes to prepare for creating the resource object for the IP resource pool. After creating the resource object for the IP resource pool, configure the IP resource pool based on the IP description in the resource object to provide an IP source for subsequent IP allocation in the IP collection file.
[0062] In this embodiment, the IP resource pool refers to a Kubernetes custom resource (CRD), which is responsible for the configuration and management of the IP resource pool of the container network, and maintains the IP allocation information of the IP collection file. In this embodiment, the IP resource pool allocates IP to the IP collection file and provides an IP source.
[0063] The IP collection file refers to a Kubernetes custom resource (CRD) that is responsible for configuring and allocating IP information in the IP collection file. In this embodiment, the IP collection file is a core resource responsible for maintaining information related to the binding relationship between multiple fixed IPs and pods.
[0064] S202: Acquire the status information of the IP collection file, determine the target IP according to the IP resource pool information and the IP number information, and set the IP information of the target IP in the status information of the IP collection file in an orderly manner.
[0065] In this embodiment, ss-ipam monitors the status changes of the IP collection file, obtains the newly created IP collection file information, obtains the corresponding number of unused IP information from the specified IP resource pool based on the IP resource pool information and IP number information, and sets the allocated IP information in an orderly manner to the status information of the IP collection file, providing IP collection file information for the subsequent configuration of the pod container network.
[0066] Specifically, ss-ipam is a Kubernetes operator controller implementation that is responsible for the lifecycle management of custom resource objects (CRDs) IP resource pools and IP collection files. In an embodiment of the present invention, ss-ipam registers with kube-apiserver to monitor resource events of IP resource pools and IP collection files. When a creation, update, or deletion event occurs in the resource objects of the IP resource pool or IP collection file, ss-ipam can promptly perceive and automatically complete business logic processing, implement functions such as container IP resource pool management and IP collection file IP allocation, and promptly update the resource object status of the IP resource pool and IP collection file, providing necessary information for subsequent container network IP configuration.
[0067] S203. Create a Kubernetes deployment model, obtain all pods in the deployment model, add the status information of the IP collection file to the pod description information template, and establish a correspondence between the pod and the IP information in the status information of the IP collection file in the description information template as the pod description information.
[0068] In this embodiment, the Kubernetes deployment model can be StatefulSet or other deployment models, all of which include multiple pods. The pod description template can contain the state information of the IP set file, and a correspondence between the pod and the IP information in the state information of the IP set file is established in the description template.
[0069] Specifically, Kubernetes is a container cluster management system developed in the Go language and open-sourced by Google in June 2014. It's also known as K8S. Kubernetes aims to simplify and efficiently deploy containerized applications, providing a mechanism for application deployment, planning, updating, and maintenance. A core feature of Kubernetes is its ability to autonomously manage containers, ensuring that containers on the cloud platform run as expected. A pod is the smallest deployable computing unit created and managed by Kubernetes.
[0070] S204: Configure the pod on the Kubernetes node and create a pod container on the node according to the pod description information.
[0071] In this embodiment, based on the basic functions of Kubernetes, the kubelet running on each Kubernetes node listens to the kube-apiserver, perceives the pod description information assigned to a node by the kube-scheduler in real time, configures the pod to the node of Kubernetes, and creates a pod container on the node.
[0072] A node is a server role in a Kubernetes cluster. A node can be a virtual machine or a physical machine, depending on the cluster. Each node contains the services required to run a pod and is managed by the master component.
[0073] S205. Determine the IP information required by the pod container according to the corresponding relationship in the pod description information, and complete the network configuration of the pod container according to the IP information.
[0074] In this embodiment, step S205 specifically includes the following steps:
[0075] Step b1: Obtain the correspondence between the pod name in the pod description information and the IP information in the status information of the IP set file.
[0076] Step b2: Determine the IP information required by the pod container based on the corresponding relationship.
[0077] Step b3: Determine the target container network configuration method based on the environment where the model is deployed.
[0078] Specifically, container network configuration methods include ENI, SRIOV, and IPVLAN. The choice of network configuration method for pod containers depends on the deployment environment, such as a public cloud VPC (Virtual Private Cloud) network environment or a physical machine VLAN (Virtual Local Area Network) network environment.
[0079] Step b4: Based on the IP information, use the target container network configuration method to configure the pod container network.
[0080] Specifically, the network configuration of the pod container in this embodiment is implemented by ss-cni. ss-cni is a cni network implementation of Kubenetes, in which kubelet is the core component of Kubenetes. ss-cni accepts the call of kubelet and is responsible for implementing the container network configuration of the pod. ss-cni obtains the IP collection file used by the pod based on the correspondence between the pod name in the pod description information and the IP information in the status information of the IP collection file; ss-cni confirms that the current pod container needs to use IP information by querying the kube-apiserver for the status information of the IP collection file; ss-cni adopts the corresponding target container network configuration method according to the current deployment environment to create network equipment, configure IP, configure routing and other network information for the pod container to achieve interconnection and interoperability of the container network.
[0081] In summary, the container IP network configuration method based on the container cloud platform of this embodiment determines the target IP by pre-creating an IP collection file and resource objects of the IP collection file, thereby realizing the pre-application of the pod container network IP and improving the efficiency of the containerized application launch. In addition, by adding the status information of the IP collection file with the IP information of the target IP to the pod description information template, a correspondence between the IP information of the pod and the target IP is established in the description information template, thereby determining the IP information required for the pod container based on the correspondence, realizing the fixation of the pod container network IP for multiple instances of the containerized application, and meeting the security requirements of financial-grade network security.
[0082] Figure 3 The process of the container IP network configuration method based on the container cloud platform provided in the embodiment of this application Figure 2 This embodiment describes in detail the steps of determining the target IP in step S202 and sequentially setting the IP information of the target IP into the status information of the IP set file. Figure 3 As shown, the method comprises the following steps:
[0083] S301. Obtaining the status information of the IP set file. In this embodiment, the status information of the IP set file is obtained by monitoring by ss-ipam.
[0084] S302: Determine the target IP resource pool according to the IP resource pool information.
[0085] In this embodiment, the IP resource pool information includes the user's demand information for the IP resource pool. The target IP resource pool is determined based on the user's demand information for the IP resource pool, and the target IP resource pool provides an IP source for the user.
[0086] S302: Determine the target IP number according to the IP number information.
[0087] In this embodiment, the IP number information includes the user's demand information on the IP number, and the target IP number is determined based on the user's demand information on the IP number.
[0088] S303: Acquire target IPs whose number is the target number of IPs from the target IP resource pool.
[0089] In this embodiment, ss-ipam obtains unused target IP information of the target IP number from the target IP resource pool based on the IP resource pool information and the IP number information.
[0090] S304: Set the IP information of the target IP in order into the status information of the IP set file.
[0091] In this embodiment, ss-ipam sets the allocated target IP information in an orderly manner to the status information of the IP set file, providing IP information for subsequent configuration of the pod container network.
[0092] In summary, the container IP network configuration method based on the container cloud platform of this embodiment determines the target IP resource pool and target IP number required by the user according to the IP resource pool information and IP number information respectively, and obtains the target IP number equal to the target IP number from the target IP resource pool, so as to pre-apply for IP according to the different needs of users.
[0093] Figure 4 The process of the container IP network configuration method based on the container cloud platform provided in the embodiment of this application Figure 3 This embodiment describes in detail the step of establishing the corresponding relationship between the pod in the description information template and the IP information in the status information of the IP set file in step S203. Figure 4 As shown, the method comprises the following steps:
[0094] S401. Set the name of each pod in the pod description information template.
[0095] In this embodiment, for Statefulset or other ordered stateful deployment models, a suffix may be added to the pod name, such as adding numbers 1, 2, 3, etc.
[0096] S402: A one-to-one correspondence is made between the name of the pod and the IP information in the status information of the IP set file, to obtain a correspondence between the pod and the IP information in the status information of the IP set file.
[0097] In this embodiment, the pod names are mapped one-to-one with the IP information in the IP set file's status information based on the pod name suffix. For example, the pods are named pod name-1, pod name-2, and pod name-3, and the IP information in the IP set file's status information is 10.10.2.0 / 24, 10.10.2.0 / 26, and 10.10.2.0 / 28. By setting pod name-1 to correspond to IP information 10.10.2.0 / 24, pod name-2 to correspond to IP information 10.10.2.0 / 26, and pod name-3 to correspond to IP information 10.10.2.0 / 28, a one-to-one correspondence is established between the pods and the IP information in the IP set file's status information.
[0098] In summary, the container IP network configuration method based on the container cloud platform of this embodiment establishes a one-to-one correspondence between the pod name and the IP information in the status information of the IP set file, so that the IP of the pod container can be kept fixed during the process of container restart or even container drift across nodes.
[0099] Figure 5 This is a schematic diagram of the structure of the container IP network configuration device based on the container cloud platform provided in the embodiment of the present application. Figure 5 As shown, the container IP network configuration device based on the container cloud platform includes: a first creation module 501, a determination module 502, an establishment module 503, a second creation module 504 and a network configuration module 505.
[0100] The first creation module 501 is used to create an Internet Protocol IP collection file and a resource object of the IP collection file, and set IP resource pool information and IP number information in the description information of the resource object of the IP collection file.
[0101] The determination module 502 is used to obtain the status information of the IP set file, determine the target IP according to the IP resource pool information and the IP number information, and set the IP information of the target IP in the status information of the IP set file in an orderly manner.
[0102] Establish module 503, which is used to create a Kubernetes deployment model, obtain all pods in the deployment model, add the status information of the IP collection file to the pod description information template, and establish a correspondence between the pod and the IP information in the status information of the IP collection file in the description information template as the pod description information.
[0103] The second creation module 504 is used to configure the pod to the Kubernetes node and create a pod container on the node according to the pod description information.
[0104] The network configuration module 505 is used to determine the IP information required by the pod container according to the corresponding relationship in the pod description information, and complete the network configuration of the pod container according to the IP information.
[0105] In one possible implementation, the determination module 502 is specifically used to: obtain the status information of the IP collection file, determine the target IP resource pool based on the IP resource pool information; determine the number of target IPs based on the IP number information; obtain the target IP number equal to the target IP number from the target IP resource pool; and set the IP information of the target IP in an orderly manner into the status information of the IP collection file.
[0106] In one possible implementation, module 503 is established, specifically for setting the name of each pod in all pods in the pod description information template; and making a one-to-one correspondence between the pod name and the IP information in the status information of the IP set file to obtain a correspondence between the pod and the IP information in the status information of the IP set file.
[0107] In one possible implementation, the network configuration module 505 is specifically used to obtain the correspondence between the pod name in the pod description information and the IP information in the status information of the IP set file; determine the IP information required for the pod container based on the correspondence; determine the target container network configuration method based on the environment where the deployment model is located; and perform network configuration of the pod container using the target container network configuration method based on the IP information.
[0108] In one possible implementation, the container IP network configuration device based on the container cloud platform also includes: a third creation module 506, which is used to: create a custom file for the IP collection file, and create a resource object for the IP collection file based on the custom file of the IP collection file; create a custom file for the IP resource pool, and create an IP resource pool resource object based on the custom file of the IP resource pool, and configure the IP resource pool based on the IP resource pool resource object.
[0109] The container IP network configuration device based on the container cloud platform provided in the embodiment of the present application can be used to implement the technical solution of the container IP network configuration method based on the container cloud platform in the above embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0110] It should be noted that it should be understood that the division of the various modules of the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. Moreover, these modules can all be implemented in the form of software called by processing elements; they can also all be implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, these modules can be fully or partially integrated together or implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or by instructions in the form of software.
[0111] Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. Figure 6 As shown, the electronic device includes: memory 601 and at least one processor 602. Memory 601 is used to store computer-executable instructions. Memory 601 may include high-speed random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. It may also be a USB flash drive, a mobile hard drive, a read-only memory, a magnetic disk, or an optical disk.
[0112] At least one processor 602 is used to execute computer-executable instructions stored in the memory to implement the container IP network configuration method based on the container cloud platform in the above embodiment. For details, please refer to the relevant description in the above method embodiment. The processor 602 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the present invention can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0113] Optionally, the memory 601 may be independent or integrated with the processor 602 .
[0114] When the memory 601 is a device independent of the processor 602, the signal processing and analysis server 604 may further include a bus 603. The bus 603 is used to connect the memory 601 and the processor 602. The bus 603 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0115] The electronic device provided in this embodiment can be used to execute the above-mentioned container IP network configuration method based on the container cloud platform. Its implementation method and technical effects are similar, and this embodiment will not be repeated here.
[0116] The present application also provides a computer-readable storage medium, which stores computer-executable instructions for implementing the methods provided in the various embodiments described above.
[0117] Among them, the computer-readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, a computer-readable storage medium is coupled to a processor so that the processor can read information from the computer-readable storage medium and write information to the computer-readable storage medium. Of course, the computer-readable storage medium can also be an integral part of the processor. The processor and the computer-readable storage medium can be located in an application-specific integrated circuit (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the computer-readable storage medium can also exist in a communication device as discrete components.
[0118] Specifically, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0119] The present application also provides a computer program product, comprising a computer program / instructions stored in a computer-readable storage medium. At least one processor of a device can read the computer program / instructions from the computer-readable storage medium, and at least one processor can execute the computer program / instructions to cause the device to implement the methods provided in the various embodiments described above.
[0120] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0121] The modules may be physically separate, for example, installed in different locations on a single device, or installed on different devices, or distributed across multiple network units, or distributed across multiple processors. The modules may also be integrated, for example, installed in the same device, or integrated into a set of codes. The modules may exist in the form of hardware, or in the form of software, or may be implemented in the form of software plus hardware. The present application may select some or all of the modules according to actual needs to achieve the purpose of the present embodiment.
[0122] When each module is implemented as an integrated module in the form of a software function module, it can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0123] It should be understood that, although the various steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they may be performed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times, and their execution order is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of sub-steps or stages of other steps.
[0124] Finally, it should be noted that the above embodiments are intended only to illustrate the technical solutions of this application and are not intended to limit them. Although this application has been described in detail with reference to the aforementioned embodiments, those skilled in the art will appreciate that they may modify the technical solutions described in the aforementioned embodiments or replace some or all of the technical features therein with equivalents. However, such modifications or replacements do not deviate from the essence of the corresponding technical solutions within the scope of the various embodiments of this application.
Claims
1. A container IP network configuration method based on a container cloud platform, characterized in that: Applied to container cloud platforms, including: Creating an Internet Protocol IP collection file and a resource object of the IP collection file, and setting IP resource pool information and IP number information in the description information of the resource object of the IP collection file; Obtaining the status information of the IP set file, determining the target IP according to the IP resource pool information and the IP number information, and setting the IP information of the target IP in the state information of the IP set file in an orderly manner; Create a Kubernetes deployment model, obtain all pods in the deployment model, add the status information of the IP set file to the description information template of the pod, and establish a correspondence between the pod and the IP information in the status information of the IP set file in the description information template as the pod description information; Configuring the pod on a Kubernetes node and creating a pod container on the node based on the pod description information; The IP information required by the pod container is determined according to the corresponding relationship in the pod description information, and the network configuration of the pod container is completed according to the IP information.
2. The method according to claim 1, characterized in that The obtaining of the status information of the IP set file, determining the target IP according to the IP resource pool information and the IP number information, and sequentially setting the IP information of the target IP into the status information of the IP set file includes: Obtaining status information of the IP set file; Determine the target IP resource pool according to the IP resource pool information; Determine the target IP number according to the IP number information; Acquire target IPs having the same number as the target IPs from the target IP resource pool; The IP information of the target IP is sequentially set into the status information of the IP set file.
3. The method according to claim 1, characterized in that The establishing of a correspondence between the pod and the IP information in the status information of the IP set file in the description information template includes: Set the name of each pod in the description information template of the pod; The names of the pods are matched one-to-one with the IP information in the status information of the IP set file to obtain a corresponding relationship between the pods and the IP information in the status information of the IP set file.
4. The method according to claim 1, wherein Determining the IP information required by the pod container according to the corresponding relationship in the pod description information, and completing the network configuration of the pod container according to the IP information, including: Obtain the correspondence between the name of the pod in the pod description information and the IP information in the status information of the IP set file; Determine the IP information required by the pod container based on the corresponding relationship; Determine the target container network configuration method based on the environment where the deployment model is located; According to the IP information, the network configuration of the pod container is performed using the target container network configuration method.
5. The method according to any one of claims 1 to 4, characterized in that Before creating the IP collection file and the resource object of the IP collection file and setting the IP resource pool information and the IP number information in the description information of the resource object of the IP collection file, the method further includes: Creating a custom file for an IP collection file, and creating a resource object for the IP collection file according to the custom file for the IP collection file; A custom file for the IP resource pool is created, an IP resource pool resource object is created according to the custom file for the IP resource pool, and the IP resource pool is configured according to the IP resource pool resource object.
6. A container IP network configuration device based on a container cloud platform, characterized in that: include: A first creation module is used to create an Internet Protocol IP collection file and a resource object of the IP collection file, and set IP resource pool information and IP number information in the description information of the resource object of the IP collection file; a determination module, configured to obtain the status information of the IP set file, determine the target IP according to the IP resource pool information and the IP number information, and set the IP information of the target IP in the status information of the IP set file in an orderly manner; Establish a module for creating a Kubernetes deployment model, obtaining all pods in the deployment model, adding the status information of the IP set file to the description information template of the pod, and establishing a correspondence between the pod and the IP information in the status information of the IP set file in the description information template as the pod description information; A second creation module is used to configure the pod to a Kubernetes node and create a pod container on the node according to the pod description information; A network configuration module is used to determine the IP information required by the pod container according to the corresponding relationship in the pod description information, and complete the network configuration of the pod container according to the IP information.
7. The device according to claim 6, characterized in that The determining module is specifically configured to: Obtaining status information of the IP set file, and determining a target IP resource pool according to the IP resource pool information; Determine the target IP number according to the IP number information; Acquire target IPs having the same number as the target IPs from the target IP resource pool; The IP information of the target IP is sequentially set into the status information of the IP set file.
8. An electronic device, characterized in that: include: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.
10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 5 when executed by a processor.
Citation Information
Patent Citations
Container address setting method and device and computer readable storage medium
CN110716787A
Deployment method and device of main node in cluster and computer readable storage medium
CN112214330A