A method and system for intelligent operation and maintenance of IP addresses based on a container cloud platform
By introducing IP address operation and maintenance strategies and two-way binding technology into the container cloud platform, an IP address pool bound to the target application is automatically created, which solves the inefficiency and conflict problems caused by the participation of multiple roles in the existing technology, and realizes the automation and intelligent operation and maintenance of IP addresses.
Patent Information
- Application Number
- CN202211591762.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-12-12
AI Technical Summary
In the prior art, the IP address operation and maintenance of container cloud platforms requires the participation of multiple management roles, resulting in inefficiency and prone to IP address allocation conflicts and unreasonable configuration.
By introducing IP address operation and maintenance policies into the container cloud platform, an IP address pool bound to the target application is automatically created, and two-way binding is achieved using the application affinity fields and tag fields of the IP address pool to reduce manual intervention and realize the automation and intelligent operation and maintenance of IP addresses.
It realizes automatic creation and maintenance of IP address pools, reduces the workload of container cloud platform administrators, avoids IP address allocation conflicts, and improves operation and maintenance efficiency and resource utilization.
Smart Images

Figure CN116016439B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of container cloud platforms, and particularly to a method, system, computer-readable storage medium, and electronic device for intelligent operation and maintenance of IP addresses based on a container cloud platform. Background Art
[0002] In a container cloud platform, an application usually includes multiple application instances, and each application instance runs in a container group (Pod). To enable communication between application instances, an IP address needs to be assigned to each container group where an application instance is located.
[0003] In the related art, to assign IP addresses to application instances, the container cloud platform administrator first plans the network resources of the container cloud platform, that is, divides all IP address resources into multiple subnets; then divides the IP addresses included in each subnet into several IP address pools, and at least one IP address in a preset network segment is recorded in the IP address pool; then, the container cloud platform administrator manually binds a pre-created IP address pool to a certain application according to the usage of network resources, or the application administrator submits an IP address allocation request to the container cloud platform administrator according to the application requirements, requesting the container cloud platform administrator to create an IP address pool that meets the application requirements, and manually binds the IP address pool to one or more applications. In this way, when creating a new application instance, the Container Network Interface (CNI) plugin can select an unallocated IP address from the IP address pool bound to the application and assign it to the application instance.
[0004] However, the existing IP address operation and maintenance method has the following deficiencies: The work of creating, maintaining the IP address pool, and binding the IP address pool to the application is completed by the container cloud platform administrator or the application administrator in cooperation with the container cloud platform administrator. In practice, the main work content of the container cloud platform administrator is to manage the resources of the container cloud platform and is not familiar with the situation of each application. It is difficult to optimize the configuration when planning IP address resources for the application by the administrator, and sometimes errors even occur.
[0005] Therefore, an improved technical solution is needed to address the above deficiencies in the existing technology. Summary of the Invention
[0006] The purpose of this application is to provide a method, system, computer-readable storage medium, and electronic device for intelligent operation and maintenance of IP addresses based on a container cloud platform to solve or alleviate the problems existing in the above-mentioned existing technology.
[0007] To achieve the above purpose, this application provides the following technical solutions:
[0008] The present application provides a method for intelligent operation and maintenance of IP addresses based on a container cloud platform, including:
[0009] In response to receiving an IP address pool creation request, create the IP address pool according to the IP address operation and maintenance policy of the target application to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application;
[0010] Set the application affinity field of the IP address pool to the identification information of the target application, and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
[0011] In this embodiment, by writing the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application into the IP address operation and maintenance policy of the target application, the container cloud platform automatically creates an IP address pool bound to the target application according to the identification information of the subnet and the IP address requirements recorded in the IP address operation and maintenance policy of the target application. Thus, the container cloud platform administrator only needs to focus on the reasonable division of subnets and does not need to understand the IP address requirements of the target application; the application administrator does not need to know the IP address usage of the entire container cloud platform and does not need to apply to the container cloud platform administrator. Only by specifying the subnet and IP address requirements in the IP address operation and maintenance policy of the target application, the container cloud platform will automatically create and maintain an IP address pool that matches the IP address requirements of the target application and bind the IP address pool to the target application. Specifically, the identification information of the target application is set in the application affinity field of the IP address pool, and at the same time, the identification information of the IP address pool is set in the IP address pool label field of the target application, so as to bind the target application and the IP address pool bidirectionally, making the IP addresses in the IP address pool the exclusive IP addresses of the target application, avoiding IP address allocation conflicts caused by misoperations of application administrators of other applications, and realizing automated and intelligent operation and maintenance of IP addresses.
[0012] In the above technical solution, before receiving the IP address pool creation request and creating the IP address pool according to the IP address operation and maintenance policy of the target application to be bound to the IP address pool, the method further includes:
[0013] In response to monitoring that a subnet resource object is created, create at least one subnet in the container cloud platform; the subnet is used to group all the IP addresses in the container cloud platform, and each subnet includes at least one IP address;
[0014] In response to detecting that the identification information of the subnet and the IP address requirement of the target application are newly added to the annotation field of the resource file of the target application, an IP address pool creation request is generated.
[0015] In this embodiment, the container cloud platform administrator creates at least one subnet by writing a subnet CRD into the Kubernetes cluster to group the IP addresses of the container cloud platform; when the application administrator deploys the target application, he only needs to add the identification information of the subnet and the IP address requirement of the target application to the annotation field of the resource file of the target application, then the address pool controller can generate an IP address pool creation request, and then automatically create and maintain the IP address pool. In this way, the container cloud platform administrator only needs to focus on optimizing the IP address grouping scheme of the container cloud platform and dividing the IP addresses of the container cloud platform into different subnets for each application to use, without having to respond to the specific IP address requirements of each application; on the other hand, when the application administrator allocates IP addresses for the target application, he only needs to set the IP address requirement and select the affiliated subnet according to the scale of the application instances of the target application, and can complete the creation and maintenance of the IP address pool that needs to be bound to the target application without the cooperation of the container cloud platform administrator, and then allocate IP addresses for the target application, realizing the separation of responsibilities between the container cloud platform administrator and the application administrator, greatly reducing the workload of the container cloud platform administrator, and at the same time making it more convenient and fast for the application administrator to allocate IP addresses for the applications he manages.
[0016] In the above technical solution, the step of creating the IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool in response to receiving the IP address pool creation request is specifically as follows:
[0017] In response to receiving the IP address pool creation request, parse the IP address operation and maintenance policy of the target application to obtain the identification information of the subnet and the IP address requirement of the target application;
[0018] Allocate available IP addresses from the subnet that match the IP address requirement of the target application to create the IP address pool.
[0019] In this embodiment, parse the IP address operation and maintenance policy of the target application to determine the identification information of the subnet and the IP address requirement of the target application, and allocate available IP addresses from the subnet that match the IP address requirement of the target application to form an IP address pool, so as to realize the automatic creation and maintenance of the IP address pool.
[0020] In the above technical solution, the quantity requirement of the IP address of the target application is a non-fixed value.
[0021] After allocating the unallocated IP addresses in the IP address pool to the application instance of the target application, the method further includes:
[0022] Continuously monitoring changes in the number of application instances of the target application;
[0023] In response to the fact that the quantity relationship between the application instances of the target application and the IP addresses contained in the IP address pool satisfies the conditions set in the IP address operation and maintenance policy of the target application, at least one available IP address in the subnet is included in the IP address pool, or at least one available IP address in the IP address pool is removed.
[0024] In this embodiment, by setting the number requirement of the IP addresses of the target application to a non-fixed value, after the application is expanded or reduced in capacity, the number of IP addresses included in the IP address pool can dynamically change according to the number of application instances, and the dynamic change is constrained by the quantitative relationship between the application instances of the target application set in the IP address operation and maintenance strategy and the IP addresses included in the IP address pool, so that the number of IP addresses included in the IP address pool automatically increases or decreases with the expansion or reduction of the target application, thereby improving the utilization rate of IP addresses in the context of scarce Underlay IP address resources.
[0025] In the above technical solution, the condition set in the IP address operation and maintenance policy of the target application is that the number of IP addresses contained in the IP address pool is N more than the number of application instances of the target application, where N is a positive integer.
[0026] In this embodiment, the condition set in the IP address operation and maintenance policy is set to that the number of IP addresses included in the IP address pool is N more than the application instance data of the target application, so that when the number of application instances of the target application increases or decreases, the number of IP addresses included in the IP address pool is automatically adjusted, so that when the number of application instances increases, the IP address pool can provide enough unallocated IP addresses, and when the number of application instances decreases, the redundant IP addresses in the IP address pool can be released in time. In the context of scarce Underlay IP address resources, it is ensured that the application instances of the target application can be allocated IP addresses, avoiding IP address shortages, and further improving the utilization efficiency of IP address resources and the intelligence level of IP address operation and maintenance.
[0027] In the above technical solution, after allocating the unallocated IP addresses in the IP address pool to the application instance of the target application, the method further includes:
[0028] In response to the target application being removed from the container cloud platform, all IP addresses in the IP address pool are removed.
[0029] In this embodiment, when the target application no longer provides services externally and the application administrator removes it from the container cloud platform, by monitoring the removal event of the target application, the IP address resources occupied by the target application are recovered in a timely manner to release the IP address pool bound to it, improving the utilization rate of IP addresses.
[0030] In the above technical solution, the quantity requirement of the IP addresses of the target application is a fixed value.
[0031] After allocating the unallocated IP addresses in the IP address pool to the application instances of the target application, the method further includes:
[0032] In response to the number of application instances of the target application being equal to the number of IP addresses included in the IP address pool, rejecting the request to increase application instances for the target application.
[0033] In this embodiment, when the quantity requirement of the IP addresses of the target application is a fixed value, that is to say, after the IP address pool is created, its quantity will not change with the expansion or contraction of the target application. When the number of application instances of the target application is equal to the number of IP addresses in the IP address pool and there are no unallocated IP addresses in the IP address pool to be allocated to new application instances, at this time, rejecting the addition of application instances for the target application can avoid incorrect IP address allocation or IP address conflicts.
[0034] The embodiment of the present application further provides a system for intelligent operation and maintenance of IP addresses based on a container cloud platform, including:
[0035] A creation unit configured to, in response to receiving an IP address pool creation request, create the IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirement of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirement of the target application;
[0036] An allocation unit configured to set the application affinity field of the IP address pool to the identification information of the target application and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
[0037] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is the method for intelligent operation and maintenance of IP addresses based on a container cloud platform as described in any one of the above.
[0038] An embodiment of the present application further provides an electronic device, including: a memory, a processor, and a program stored in the memory and executable on the processor, where when the processor executes the program, the method for intelligent operation and maintenance of IP addresses based on a container cloud platform as described in any one of the above is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings forming a part of this application are used to provide a further understanding of this application. The schematic embodiments and descriptions thereof of this application are used to explain this application and do not constitute an improper limitation to this application. Among them:
[0040] Figure 1 It is a schematic diagram for the container cloud platform in the related art to uniformly manage application instances deployed on different nodes;
[0041] Figure 2 It is a logical schematic diagram of the process of allocating IP addresses to application instances in the related art;
[0042] Figure 3 It is a logical schematic diagram of intelligent operation and maintenance of IP addresses based on a container cloud platform provided by some embodiments of this application;
[0043] Figure 4 It is a flowchart of the method for intelligent operation and maintenance of IP addresses based on a container cloud platform provided by some embodiments of this application;
[0044] Figure 5 It is a schematic structural diagram of a system for intelligent operation and maintenance of IP addresses based on a container cloud platform provided by some embodiments of this application;
[0045] Figure 6 It is a schematic structural diagram of an electronic device provided by some embodiments of this application;
[0046] Figure 7 It is a hardware structure diagram of an electronic device provided by some embodiments of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0047] The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments. Each example is provided by way of explanation of the present application rather than a limitation of the present application. In fact, those skilled in the art will clearly understand that modifications and variations can be made to the present application without departing from the scope or spirit of the present application. For example, features shown or described as part of one embodiment can be used in another embodiment to yield yet another embodiment. Therefore, it is desirable that the present application includes such modifications and variations that fall within the scope of the appended claims and their equivalents.
[0048] In the following description, the terms "first / second / third" involved are only used to distinguish similar objects and do not represent a specific order of the objects. Understandably, "first / second / third" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0049] To facilitate the understanding of the technical solution of the present application, the related technologies will be explained below.
[0050] The container cloud platform described in the present application is a lightweight cloud platform constructed by relying on container technology and combining cloud native technology, and adopting technologies such as containers, container orchestration, service mesh, and microservices. The Kubernetes cluster is one of the most widely used container cloud platforms. Among them, the Kubernetes system is an open-source container orchestration engine developed by Google and is used to manage containerized application instances on multiple hosts in the container cloud platform. The Kubernetes cluster is a cluster deployed with the Kubernetes system and includes multiple nodes. From the perspective of cluster management, the Kubernetes system divides the hosts in the cluster into control nodes and worker nodes. A set of programs related to cluster management run on the control nodes, which are used to automatically complete management capabilities such as resource management, container group scheduling, elastic scaling, security control, system monitoring, and error correction of the entire cluster. The worker nodes are used to deploy application instances of the business system.
[0051] The Container Network Interface (CNI) specification is a set of specifications and libraries for configuring Linux container network interfaces, which includes a network resource allocation interface and a network resource release interface.
[0052] The CNI plugin is a set of programs that implement the CNI specification and is used to allocate network resources such as IP addresses for a container group when it is created, and release the IP addresses and other network resources occupied by it when the container group is deleted.
[0053] In the related technology, the container cloud platform uniformly manages server nodes based on a flat network model. In the flat network model, container groups are in a unified network, and container groups deployed on different nodes can communicate directly without Network Address Translation (NAT conversion). Understandably, application instances running in the container groups can also communicate directly without Network Address Translation (NAT conversion).
[0054] Figure 1 It is a schematic diagram of the unified management of application instances deployed on different nodes by the container cloud platform in the related technology. As Figure 1As shown in the figure, a container cloud platform usually manages multiple nodes. Taking node A and node B as examples, several Pods are deployed on node A and node B respectively, and at least one application instance runs in each Pod. Since the network model of the container cloud platform is a flat network model, all application instances in node A and node B are located in the same network, and different application instances can directly send communication data packets for communication without going through a gateway jump or network address translation.
[0055] In production practice, in order to meet different usage requirements, the container cloud platform administrator can divide the network of the container cloud platform into multiple subnets. After subnet division, different subnets cannot communicate directly with each other to achieve network logical isolation. For example, application instances belonging to different business systems are assigned to different subnets, so that application instances belonging to different business systems cannot communicate directly with each other to ensure the network communication security within the business system. Another example is that due to the needs of application development, the cluster needs to be divided into a production environment and a test environment, which belong to different subnets respectively, so that all application instances in the production environment and the test environment are isolated from each other.
[0056] It can be understood that one or more applications can run in the same subnet. To facilitate the management of IP address allocation for applications, the container cloud platform administrator can further divide all IP addresses included in the subnet into several IP address pools, and at least one IP address in a preset network segment is recorded in each IP address pool. When deploying an application, the container cloud platform administrator can manually bind a pre-created IP address pool to a certain application according to the usage of network resources, or the application administrator can submit an IP address allocation request to the container cloud platform administrator to request the container cloud platform administrator to create an IP address pool that meets the application requirements and manually bind the IP address pool to the application, so as to fix the IP address of the application instance of the application within the range defined by the IP address pool.
[0057] As can be seen from the above, in the existing IP address operation and maintenance method, if you want to allocate a specified range of IP addresses to an application, the container cloud platform administrator needs to pre-create or create an IP address pool that meets the application requirements according to the IP address allocation request of the application administrator, and manually bind the IP address pool to the application. However, each application in the container cloud platform corresponds to at least one application instance, and each application instance needs to occupy an IP address. That is to say, the number of IP addresses that need to be included in the IP address pool bound to the application depends on the number of application instances of the application. Since the container cloud platform administrator is usually not familiar with the business status of a certain application, it is impossible to accurately grasp the IP address requirements of the application, and it is easy to have a situation where the IP address planning does not match the actual situation. Therefore, allocating an IP address pool for an application usually requires the joint efforts of the container cloud platform administrator and the application administrator. That is, the application administrator submits the IP address requirements to the container cloud platform administrator. Since the application administrator is most familiar with the business status of the application, and the container cloud platform administrator can master the usage of all IP addresses included in each subnet, therefore, the container cloud platform administrator refers to the network resource usage of the entire subnet and selects from all the IP addresses included in the entire subnet. An IP address pool composed of the number of IP addresses that meet the application requirements is created, and then the IP address pool is manually bound to the application, which can formulate a more reasonable IP address allocation plan for the application. In other words, in order to obtain an IP address allocation plan that matches the application requirements, the container cloud platform administrator not only needs to manage the IP addresses of the entire container cloud platform, but also participate in the IP address allocation management of specific applications; and the application administrator cannot create and bind the IP address pool alone because they do not understand the overall IP address usage of the container cloud platform. If the IP address range is randomly specified for the application regardless of the overall IP address usage, it is easy to have the problem of IP address allocation conflicts caused by different applications specifying the same IP address. Therefore, the application administrator can only request the container cloud platform administrator to create the required IP address pool. It can be seen from this that in the prior art, the IP address operation and maintenance of applications requires the joint participation of multiple management roles, and there are problems of unclear IP address operation and maintenance responsibilities and management overlap, resulting in low IP operation and maintenance efficiency and inability to achieve automation and intelligence.
[0058] After in-depth analysis of the prior art, the applicant found that the existing IP address operation and maintenance requires the joint participation of the container cloud platform and the application administrator, and the creation and maintenance of the IP address pool are mainly completed manually, resulting in low efficiency. Based on this, the applicant believes that an automated and intelligent maintenance method should be provided to create and maintain the IP address pool. At the same time, on the basis of automated and intelligent operation and maintenance, the application administrator should also be allowed to manually maintain the corresponding IP address pool according to the actual situation of the application to meet the IP address allocation requirements in special scenarios.
[0059] To this end, the present application provides a method, a system, a computer-readable storage medium, and an electronic device for intelligent operation and maintenance of IP addresses based on a container cloud platform. By writing the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application into the IP address operation and maintenance policy of the target application, the container cloud platform automatically creates an IP address pool bound to the target application according to the identification information of the subnet and the IP address requirements recorded in the IP address operation and maintenance policy of the target application. Thus, the administrator of the container cloud platform only needs to focus on the reasonable division of subnets and does not need to understand the IP address requirements of the target application; the application administrator does not need to know the IP address usage of the entire container cloud platform and does not need to apply to the container cloud platform administrator. The application administrator only needs to specify the subnet and the IP address requirements in the IP address operation and maintenance policy of the target application, and the container cloud platform will automatically create and maintain an IP address pool that matches the IP address requirements of the target application and bind the IP address pool to the target application. Specifically, the identification information of the target application is set in the application affinity field of the IP address pool, and at the same time, the identification information of the IP address pool is set in the IP address pool label field of the target application, so as to bind the target application and the IP address pool bidirectionally, making the IP addresses in the IP address pool the exclusive IP addresses of the target application, avoiding IP address allocation conflicts caused by misoperations of application administrators of other applications, and realizing automatic and intelligent operation and maintenance of IP addresses.
[0060] Exemplary method
[0061] An embodiment of the present application provides a method for intelligent operation and maintenance of IP addresses based on a container cloud platform, as Figure 3 、 Figure 4 shown, the method includes:
[0062] Step S101, in response to receiving an IP address pool creation request, create an IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool.
[0063] Among them, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application.
[0064] For the convenience of understanding, taking the Kubernetes cluster as an example, the process of allocating IP addresses to application instances in the related art is described.
[0065] Figure 2 is a logical schematic diagram of the process of allocating IP addresses to application instances in the related art. As Figure 2As shown in the figure, an API-Server component, a Scheduler component, a Kubelet component, and a CNI plugin are deployed in the Kubernetes cluster. When deploying an application to the Kubernetes cluster, the Scheduler component selects a suitable node as the scheduling target node from multiple nodes in the cluster according to relevant filtering conditions and scores, and schedules the application instances of the application to the target node.
[0066] The Kubelet component is deployed on each node of the Kubernetes cluster. The Kubelet components of each node listen to the scheduling of the application through the API-Server component. When the target node determines that the application is to be scheduled to itself, the Kubelet component of the target node creates a new Pod to deploy the application, and during the process of creating the Pod, sends a request for IP address allocation to the CNI plugin through the Kubelet component, instructing the CNI plugin to allocate an IP address for the created Pod.
[0067] Upon receiving the request for IP address allocation, the CNI plugin selects an unallocated IP address from the IP address pool manually bound in advance by the container cloud platform administrator and allocates it to the Pod.
[0068] The above process requires the participation of multiple management roles and is operated manually, resulting in low efficiency and easy errors. To improve the IP address operation and maintenance efficiency and achieve the automatic creation and maintenance of the IP address pool, this application implementation introduces an address pool controller to automatically complete the creation and maintenance of the IP address pool. Among them, the address pool controller is a custom controller used to create and maintain multiple IP address pools according to the content of the resource file of the IP address pool (i.e., the address pool CRD).
[0069] That is to say, an address pool CRD and an address pool controller are also deployed in the control node in the container cloud platform. The address pool CRD is automatically generated by the address pool controller according to the IP address operation and maintenance policy of the target application, and is used to implement the automatic creation and operation and maintenance work of the IP address pool.
[0070] In the embodiments of the present application, the container cloud platform administrator divides all IP addresses into one or more subnets in advance based on the overall network resource situation, and each subnet contains at least one IP address. When deploying a target application, the application administrator determines the IP address requirements according to the business situation of the target application, and the requirements include, but are not limited to: the number of IP address requirements of the target application, routing, gateway, IP address recycling mechanism, etc. After determining the above IP address requirements, the application administrator writes the IP address requirements and the identification information of the subnet to which the target application belongs into the IP address operation and maintenance policy of the target application. In this way, when the address pool controller receives an IP address pool creation request, it can automatically create the IP address pool required by the target application according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool, without manual operation by the application administrator, improving the IP address operation and maintenance efficiency.
[0071] It should be understood that in the traditional technical solution, the IP address pool is a set composed of one or more IP addresses manually specified by the container cloud platform administrator, and the management and maintenance work is the responsibility of the container cloud platform administrator. However, the IP address pool implemented in the present application is a custom resource (Custom Resources Definition, CRD) of the container cloud platform, and its corresponding resource file is called the address pool CRD, and the address pool controller is responsible for automatically managing and maintaining the IP address pool according to the configuration information recorded in the address pool CRD.
[0072] Specifically, the address pool controller listens to the creation event of the IP address pool through the interface provided by the API-Server component. When it listens to an IP address pool creation request, it generates a corresponding address pool CRD according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool. Among them, the address pool CRD records the basic information of the IP address pool, such as the identification information of the IP address pool and the IP addresses included in the IP address pool (allocated from the subnet). Subsequently, the address pool controller component creates the IP address pool according to the basic information of the IP address pool in the address pool CRD.
[0073] To facilitate understanding of the technical solution for the automatic creation and operation and maintenance of the IP address pool in the embodiments of the present application, the system architecture of the embodiments of the present application will be described in detail below.
[0074] Figure 3 Shows the operation logic of the IP address intelligent operation and maintenance system taking the Kubernetes cluster as an example. As Figure 3As shown in the figure, the Kubernetes cluster includes control nodes and worker nodes. Among them, control plane components such as the API-Server component and the Scheduler component are deployed on the control nodes and are used to manage the Kubernetes cluster; node components such as the Kubelet component, the CNI plugin, and the IPAM plugin are deployed on the worker nodes and are used to run and manage application instances of the target application. The application instances of the target application run on the Pods of the worker nodes.
[0075] Based on the foregoing description, when a Pod is created, the CNI plugin assigns an IP address to the created Pod. It should be noted that the CNI plugin can be divided into three categories, namely: the main plugin, the IPAM plugin, and the meta plugin. Among them, the main plugin is mainly used to create binary files of specific network devices; the IPAM plugin is mainly responsible for assigning IP addresses to Pods in the Kubernetes cluster; the meta plugin is an extension plugin and needs to be implemented in combination with the main plugin and the IPAM plugin.
[0076] Based on the functions of the above three types of CNI plugins, the specific process for the Kubelet component to call the CNI plugin to assign an IP address to a Pod is: the Kubelet component calls the main plugin, and then the main plugin calls the IPAM plugin to assign an IP address to the Pod.
[0077] In order to automatically create an IP address pool for the target application and select an unallocated IP address from the IP address pool to assign to the application instance of the target application, in the embodiments of the present application, an address pool controller, an address pool proxy, a subnet CRD, and an address pool CRD are used to replace the IPAM plugin in the original CNI plugin to assign an IP address to the application instance of the target application.
[0078] Among them, the address pool proxy is deployed in all worker nodes of the Kubernetes cluster in the form of a Daemonset. When an application instance of the target application is scheduled to a certain worker node of the Kubernetes cluster, the Kubelet component on this worker node creates a Pod for deploying the application instance and sends a request to the CNI plugin to assign an IP address to the Pod. The address pool proxy on this worker node receives the request to assign an IP address forwarded by the IPAM plugin in the CNI plugin and selects an unallocated IP address from the IP address pool bound to the target application to assign to the Pod.
[0079] The address pool controller is deployed on the control node in the form of a Deployment and is used to manage the custom resources provided in the embodiments of the present application, that is, to automatically create, update, and maintain the status of subnets and IP address pools according to the content of the subnet CRD and the address pool CRD. Among them, the subnet CRD is set by the container cloud platform administrator according to the overall planning of the container cloud platform network resources and is used to define subnet resource objects.
[0080] Specifically, before receiving an IP address pool creation request and creating an IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool, the method further includes: in response to detecting the creation of a subnet resource object, creating at least one subnet in the container cloud platform; the subnet is used to group all the IP addresses in the container cloud platform, and each subnet contains at least one IP address; in response to detecting the addition of the identification information of the subnet and the IP address requirement of the target application in the annotation field of the resource file of the target application, generating an IP address pool creation request.
[0081] That is to say, the subnet resource object is defined by the corresponding subnet CRD and is used to group all the IP addresses in the container cloud platform. Each subnet CRD records several IP addresses included in the subnet corresponding to the subnet resource object, such as Figure 3 the subnets in include available IP address 1, available IP address 2, and IP address 1, IP address 2, and IP address 3 in the IP address pool. Among them, the available IP address means that the IP address has not been assigned to any IP address pool and has not been assigned to any application instance as a public IP address.
[0082] Generally, the subnet CRD can be set in the form of a YAML file. The container cloud platform administrator writes the subnet CRD into the Kubernetes cluster, and the container cloud platform will create a subnet resource object according to the content of the subnet CRD. The address pool controller listens for this event. When it detects the creation of a subnet resource object, it creates at least one subnet defined by the subnet CRD in the container cloud platform.
[0083] After subnet division, the application administrator adds an annotation field (such as the annotation field) to the resource file of the target application (such as the Deployment file), and adds an IP address operation and maintenance policy to the annotation field. The IP address operation and maintenance policy includes, but is not limited to, the identification information of the subnet to which the target application belongs (such as the value of subnet represents the subnet) and the IP address requirement of the target application (such as the value of ippool-ip-number represents the IP address quantity requirement).
[0084] For example, in an example, the annotation field of the resource file of the target application is configured as follows:
[0085]
[0086] To respond to the resource file of the target application configured by the application administrator, the address pool controller is further configured to listen for change events of the resource file of the target application through the API-Server component. When the identification information of the new subnet and the IP address requirement of the target application are newly added in the annotation field of the resource file of the target application, an IP address pool creation request is generated.
[0087] In this embodiment, the container cloud platform administrator creates at least one subnet by writing a subnet CRD into the Kubernetes cluster to group the IP addresses of the container cloud platform. When the application administrator deploys the target application, only the identification information of the new subnet and the IP address requirement of the target application need to be newly added in the annotation field of the resource file of the target application, so that the address pool controller can generate an IP address pool creation request, and then automatically create and maintain the IP address pool. In this way, the container cloud platform administrator only needs to focus on optimizing the IP address grouping scheme of the container cloud platform and divide the IP addresses of the container cloud platform into different subnets for each application to use, without having to respond to the specific IP address requirements of each application. On the other hand, when the application administrator allocates IP addresses for the target application, only the IP address requirement needs to be set according to the application instance scale of the target application and the subnet to which it belongs is selected. Without the cooperation of the container cloud platform administrator, the creation and maintenance of the IP address pool that needs to be bound to the target application can be completed, and then the IP addresses are allocated to the target application, realizing the separation of responsibilities between the container cloud platform administrator and the application administrator, greatly reducing the workload of the container cloud platform administrator, and at the same time making it more convenient and fast for the application administrator to allocate IP addresses for the applications under management.
[0088] After generating the IP address pool creation request based on the annotation field in the resource file of the target application, in some embodiments, in response to receiving the IP address pool creation request, an IP address pool is created according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool. Specifically, in response to receiving the IP address pool creation request, the IP address operation and maintenance policy of the target application is parsed to obtain the identification information of the subnet and the IP address requirement of the target application; available IP addresses matching the IP address requirement of the target application are allocated from the subnet to create an IP address pool.
[0089] In the embodiment of the present application, the address pool controller receives an IP address pool creation request, parses the IP address operation and maintenance policy recorded in the annotation field of the resource file of the target application, that is, parses the newly added annotation field in the Deployment file of the target application, and obtains the corresponding values of subnet and ippool-ip-number recorded in the annotation field, so as to determine the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application. Then, it automatically allocates available IP addresses that meet the IP address requirements from this subnet to form an IP address pool, and generates an address pool CRD. Among them, the basic information of the IP address pool, such as the identification information of the IP address and the included IP addresses, is recorded in the address pool CRD.
[0090] In addition, the address pool CRD can also include the route and gateway of the IP address pool. It should be understood that all the IP addresses included in the IP address pool belong to the subnet, so the route and gateway of the IP address pool can automatically inherit the route and gateway of the subnet.
[0091] Step S102: Set the application affinity field of the IP address pool to the identification information of the target application, and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
[0092] After creating the IP address pool, to prevent other application administrators in the container cloud platform from accidentally binding the managed application to this IP address pool and affecting the management of the IP address pool by this application administrator, in the implementation of the present application, the application affinity field of the IP address pool is set to the identification information of the target application, so as to establish a binding relationship between the IP address pool and the target application through the application affinity field of the IP address pool; at the same time, the IP address pool label of the target application is set to the identification information of the IP address pool, so as to reversely bind the IP address pool through the IP address pool label of the target application, so that the IP address pool and the target application have a two-way binding relationship.
[0093] Specifically, after the address pool controller completes the creation of the IP address pool, according to the identification information of the target application included in the IP address pool creation request, it can set the value of the application affinity field (such as the podAffinity field) in the address pool CRD corresponding to this IP address pool to the identification information of the target application (such as the name of the target application or the ID of the target application). Then, according to the identification information of the target application, find the Deployment file of the target application, and add an IP address pool label field in the annotation field of the Deployment file of the target application, and set the identification information of the IP address pool in the IP address pool label field, so as to realize the two-way binding between the target application and the IP address pool.
[0094] It should be understood that the above two-way binding relationship can be that the target application establishes a two-way binding with an IP address pool, or the target application establishes a two-way binding with multiple IP address pools, or multiple applications establish a two-way binding with an IP address pool. This application does not make any limitations in this regard.
[0095] After the target application establishes a two-way binding relationship with the IP address pool, unallocated IP addresses can be selected from the IP address pool based on this two-way binding relationship and assigned to the application instances of the target application. Specifically, still taking the Kubernetes cluster shown in Figure 3 as an example, during the process of creating a Pod for an application instance of the target application, the Scheduler component will select a suitable node as the scheduling target node from multiple nodes in the cluster according to relevant screening conditions and scores, and schedule the application instance of the application to this target node. The Kubelet component on the target node creates the Pod and calls the CNI plugin to allocate network resources such as IP addresses for the Pod, that is, to allocate network resources such as IP addresses for the application instance running in the Pod.
[0096] In the embodiment of this application, the CNI plugin receives the request from the Kubelet component to allocate an IP address for the Pod, forwards it to the IPAM plugin, and then the IPAM plugin forwards it to the address pool proxy deployed in the form of a Daemonset on the target node. After receiving the request, the address pool proxy accesses the Deployment file of the target application through the API-Server component to determine the IP address pool bound to the target application and the affinity relationship between the IP address pool and the target application. After the above two-way binding relationship is determined, according to the IP address allocation data recorded in the IP address pool, an unallocated IP address is selected from the bound IP address pool, the IP address is bound to the Pod, and the IP address is marked as the allocated state.
[0097] Among them, the IP address allocation data in the IP address pool records the usage status of each IP address in the IP address pool, and this usage status reflects whether the IP address can be allocated. For example, an IP address that is unallocated and unoccupied can be allocated for the Pod to use, while an IP address in the allocated state or occupied state cannot be used for allocation to the Pod.
[0098] As described above, the IP address requirement of the target application includes a quantity requirement. In some embodiments, the quantity requirement of the IP address of the target application is a non-fixed value. After allocating the unallocated IP addresses in the IP address pool to the application instances of the target application, the method further includes: continuously monitoring the changes in the quantity of application instances of the target application; in response to the quantity relationship between the application instances of the target application and the IP addresses contained in the IP address pool satisfying the conditions set in the IP address operation and maintenance policy of the target application, at least one available IP address in the subnet is included in the IP address pool, or at least one available IP address in the IP address pool is removed.
[0099] It should be understood that in production practice, the number of application instances of an application will increase or decrease with changes in load conditions. This increase or decrease of application instances with load conditions is also called expansion or contraction of the application. In the traditional IP address operation and maintenance method, the IP address pool is divided by manual operation. Once the division is completed, the number of IP addresses contained in each IP address pool is fixed, while the number of application instances of the application changes with the load of the business. When the application expansion causes the number of application instances to exceed the number of IP addresses contained in the IP address pool, the new application instance will fail to be created due to the inability to allocate IP addresses; when the load of the business is reduced and the number of application instances of the application is reduced, the application is reduced, the number of application instances is reduced, and the number of occupied IP addresses decreases. However, the unallocated IP addresses still belong to the IP address pool corresponding to the application and cannot be transferred to other IP address pools, resulting in a waste of IP address resources. At present, although the relevant technology allows the container cloud platform administrator to manually adjust each IP address pool as needed to adapt to the expansion and contraction of the application, this undoubtedly greatly increases the workload of the container cloud platform administrator.
[0100] In the embodiment of the present application, by setting the number of IP addresses required for the target application to a non-fixed value (also called an associated value), that is, setting the ippool-ip-number in the annotation field to a non-fixed value, thus, after the application is expanded or reduced, the number of IP addresses contained in the IP address pool will also be an associated value, which can change dynamically according to the number of application instances. When the number of application instances increases, first select unallocated IP addresses from the IP address pool for allocation, and then divide the corresponding number of available IP addresses in the subnet into the IP address pool to ensure the association between the number of IP addresses and the number of application instances, so as to meet the conditions set in the IP address operation and maintenance strategy. If there is no corresponding number of available IP addresses in the subnet, the address pool controller will repeatedly try to expand the IP address pool until the expansion is successful. Since the non-fixed value can meet the quantitative relationship between the application instance of the target application set in the IP address operation and maintenance strategy and the IP address contained in the IP address pool, it can be realized that the number of IP addresses contained in the IP address pool automatically increases or decreases with the expansion or reduction of the target application.
[0101] Specifically, in order to realize that the number of IP addresses in the IP address pool automatically increases or decreases with the expansion or reduction of the target application, after setting the number requirement of the IP addresses of the target application to a non-fixed value, the address pool controller is also used to continuously monitor the changes in the number of application instances of the target application. When the target application is monitored to be expanded, that is, a new application instance is added, the quantitative relationship between the application instances of the target application after the expansion and the IP addresses contained in the IP address pool is determined, and compared with the conditions set in the IP address operation and maintenance strategy to determine that the two match each other; after determining that the two match, the address pool controller allocates the corresponding number of available IP addresses in the subnet to the IP address pool. When the target application is monitored to be reduced, that is, the application instance is reduced, the quantitative relationship between the application instances of the target application after the reduction and the IP addresses contained in the IP address pool is determined, and compared with the conditions set in the IP address operation and maintenance strategy to determine the number of IP addresses that need to be reduced in the IP address pool, and then the address pool controller allocates the corresponding number of available IP addresses from the IP address pool.
[0102] In this embodiment, the number of IP addresses in the IP address pool can be automatically adjusted as the target application scales up or down. When the number of application instances of the target application increases beyond the number of IP addresses in the IP address pool, the corresponding number of available IP addresses can be automatically allocated from the subnet to the IP address pool to provide unallocated IP addresses for the newly added application instances. When the number of application instances of the target application decreases, the excess available IP addresses can be released from the IP address pool in a timely manner for allocation to other applications, without causing waste of IP address resources. This not only makes the scaling up / down of the target application more intelligent, but also improves the utilization rate of IP addresses in the context of scarce Underlay IP address resources. In addition, the address pool controller automatically controls the size of the IP address pool according to the IP address operation and maintenance policy, eliminating the need to manually modify each IP address pool, reducing the possibility of errors, and alleviating the workload of container cloud platform administrators or application administrators.
[0103] In some specific embodiments, the condition set in the IP address operation and maintenance policy of the target application is that the number of IP addresses in the IP address pool is N more than the number of application instances of the target application, where N is a positive integer.
[0104] In this embodiment, the condition set in the IP address operation and maintenance policy is that the number of IP addresses in the IP address pool is N more than the number of application instances of the target application. For example, N can be set to 1, that is, the condition set in the IP address operation and maintenance policy is that the number of IP addresses in the IP address pool is 1 more than the number of application instances of the target application (i.e., add a new annotation field in the Deployment file of the target application and set in the annotation field: ippool-ip-number: "+1"). In this way, regardless of how the target application scales up, the address pool controller selects the corresponding number of IP addresses from the available IP addresses in the subnet and allocates them to the IP address pool, ensuring that the number of available IP addresses in the IP address pool always remains 1 more than the number of application instances. Thus, when the number of application instances of the target application increases or decreases, the number of IP addresses in the IP address pool is automatically adjusted. This can not only ensure that the IP address pool can provide sufficient unallocated IP addresses when the number of application instances increases, but also release the excess IP addresses in the IP address pool in a timely manner when the number of application instances decreases. In the context of scarce Underlay IP address resources, it ensures that all application instances of the target application can be allocated IP addresses, avoiding IP address shortages and further improving the utilization efficiency of IP address resources and the intelligence level of IP address operation and maintenance.
[0105] It should be understood that the specific value of N can be set by the application administrator according to the specific situation of the target application, or calculated by the address pool controller according to certain preset rules. For example, the calculation rule of N can be formulated according to the overall IP address usage. This application does not make any limitations in this regard.
[0106] As mentioned above, the IP address operation and maintenance policy of the target application may also include an IP address recycling mechanism. For this reason, in some embodiments, the annotation field of the Deployment file of the target application may also be set with an ippool-reclaim field to indicate the IP address recycling mechanism. When the value of the ippool-reclaim field is true, the IP address recycling mechanism is automatic recycling. The address pool controller is also used to automatically recycle the IP address pool bound to the target application. That is, when the number of application instances decreases, the IP addresses of the decreased application instances will first be released to the IP address pool, and then the address pool controller will allocate the corresponding number of unallocated IP addresses in the IP address pool, that is, return these IP addresses to the subnet, so as to ensure that the quantitative relationship between the number of IP addresses in the IP address pool and the number of application instances of the target application meets the conditions set in the IP address operation and maintenance policy. At the same time, the IP addresses returned to the subnet can be allocated to other IP address pools to further improve the utilization rate of IP addresses. When the value of the ippool-reclaim field is false, the address pool controller will not perform automatic recycling of IP addresses on the IP address pool. Then, when the number of application instances decreases, the IP addresses of the decreased application instances will be released to the IP address pool, but will not be allocated and returned to the subnet. When the number of application instances recovers, they will be reallocated to the recovered application instances.
[0107] When the target application no longer provides services externally, to save resources, the application administrator will remove it from the container cloud platform. At this time, to improve the utilization rate of IP addresses, the IP address pool bound to it should also be released in a timely manner. For this reason, in some embodiments, after the unallocated IP addresses in the IP address pool are allocated to the application instances of the target application, the method further includes: in response to the removal of the target application from the container cloud platform, allocating all the IP addresses in the IP address pool.
[0108] Taking the Kubernetes cluster as an example, when the application administrator removes the target application from the Kubernetes cluster, the address pool controller listens through the API-Server that all the resource files of the target application have been removed, and will automatically remove the address pool CRD corresponding to this application. All the IP addresses recorded in the address pool CRD will be released as available IP addresses in the subnet and can be allocated to other IP address pools.
[0109] Except for the case where the number requirement of the IP addresses of the foregoing target application is a non-fixed value, in some embodiments, the number requirement of the IP addresses of the target application is a fixed value. After allocating the unallocated IP addresses in the IP address pool to the application instances of the target application, the method further includes: in response to the number of application instances of the target application being equal to the number of IP addresses included in the IP address pool, rejecting the request to increase the application instances of the target application.
[0110] In the embodiments of the present application, the condition set in the IP address operation and maintenance policy is set to that the number requirement of the IP addresses included in the IP address pool is a fixed value. For example, a new annotation field is added to the Deployment file of the target application, and in the annotation field, it is set: ippool-ip-number: "5".
[0111] When the number requirement of the IP addresses of the target application is a fixed value, the number of IP addresses included in the created IP address pool will also be a fixed value and will not change dynamically according to the number of application instances of the target application. When the number of application instances increases, only the unallocated IP addresses in the IP address pool will be selected for allocation. Once the number of application instances exceeds the number of IP addresses in the IP address pool, it will cause the Pod creation to fail. Therefore, in the embodiments of the present application, the address pool controller is further configured to monitor the change in the number of application instances of the target application. When the number of application instances of the target application is equal to the number of IP addresses included in the IP address pool, at this time, if the target application adds new application instances again, since the IP addresses in the IP address pool have been exhausted and no IP addresses can be allocated to the newly added application instances, the address pool controller will reject the request to increase the application instances of the target application.
[0112] It should be noted that whether it is the foregoing non-fixed value or fixed value case, the embodiments of the present application allow the application administrator to manually maintain the IP address pool bound to the application according to the actual situation of the application.
[0113] Specifically, the application administrator can manually modify the content of the address pool CRD. For example, a new IP address is added to the spec.ips field to include the IP address in the IP address pool.
[0114] At this time, the address pool controller also needs to verify the creation process of the IP address pool. That is to say, the address pool controller can monitor the change of the address pool CRD. Once it is monitored that the IP address manually included by the application administrator is incorrect (for example, the IP address does not belong to the subnet where the IP address pool is located), or has been included in other IP address pools by the address pool controller, or has been occupied by other application instances, then the operation request will be rejected to avoid incorrect IP address allocation or IP address conflict.
[0115] In addition, when the number requirement of the IP addresses of the target application is a fixed value, when the number of application instances decreases, the unallocated IP addresses released will still belong to this IP address pool and will not be allocated out. Of course, they will not be allocated into other IP address pools either. When the number of application instances resumes, they will be reallocated to the resumed application instances. Of course, if the application administrator wants to release the unallocated IP addresses in the IP address pool, the content of the address pool CRD can also be manually modified to allocate some unallocated IP addresses in the IP address pool out of the IP address pool.
[0116] In some embodiments, the method for intelligent operation and maintenance of IP addresses based on a container cloud platform provided by this application can be executed according to the following steps:
[0117] Step 1: The container cloud platform administrator creates a subnet in the form of defining a subnet CRD and defines all the IP addresses included in this subnet in the subnet CRD;
[0118] Step 2: The application administrator adds an annotation field to the Deployment file of the application and sets the IP address operation and maintenance policy under the annotation field, such as the identification information of the subnet, the number of IP addresses in the IP address pool, whether to release the redundant IP addresses in the IP address pool, and other contents;
[0119] Step 3: The address pool controller listens through the API-Server component to the content of the newly added annotation field in the Deployment file of this application, that is, allocates the corresponding number of available IP addresses from the subnet to form an IP address pool, creates a corresponding address pool CRD, sets the identification information of the application in the application affinity field of the address pool CRD, and sets the identification information of the IP address pool in the IP address pool label field in the Deployment file of this application to realize the two-way binding between the application and the IP address pool;
[0120] Step 4: The Scheduler component listens to the API-Server component of the Kubernetes cluster;
[0121] Step 5: When the Scheduler component listens that the target application is deployed to the Kubernetes cluster, it screens all the nodes in the Kubernetes cluster and selects the node with the highest score as the target node for application scheduling according to the resource usage of the screened nodes;
[0122] Step 6: After the Kubelet component in the target node listens through the API-Server component that the target application is scheduled to the node where it is located, a new Pod is created and the CNI plugin is called to assign an IP address to the Pod;
[0123] Step 7: The IPAM plugin in the CNI plugin sends the request for assigning an IP address to the Pod to the address pool proxy for processing. The address pool proxy determines the address pool CRD corresponding to the application according to the identification information of the IP address pool in the IP address pool label field of the Deployment file of the application, and verifies the two-way binding relationship between the application and the IP address pool according to the identification information of the application set in the application affinity field of the address pool CRD. According to the IP address allocation data recorded in the address pool CRD, an unallocated IP address is selected and bound to the Pod;
[0124] Step 8: The address pool proxy marks the IP address as the allocated state in the IP address allocation data.
[0125] In summary, in the embodiment of the present application, by listening to the change events of the IP address pool through the address pool controller, when an IP address pool creation request is received, an IP address pool is created according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application; the application affinity field of the IP address pool is set to the identification information of the target application, and the IP address pool label of the target application is set to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application. Since the IP address operation and maintenance policy of the target application includes the identification of the subnet to which the IP addresses in the IP address pool belong and the IP requirements of the target application, based on the IP address operation and maintenance policy, the corresponding relationship between the IP address pool, the subnet to which it belongs, and the IP address requirements of the target application can be established, and the identification information of the target application is set in the application affinity field of the IP address pool, so that the unallocated IP addresses in the IP address pool can be automatically allocated to the application instances of the target application, thereby realizing automatic and intelligent IP address operation and maintenance.
[0126] Since the creation and maintenance of the IP address pool are automatically completed by the address pool controller, and it supports dynamically adjusting the number of IP addresses in the IP address pool according to the change in the number of application instances. When the number of application instances increases, the IP address pool can provide sufficient unallocated IP addresses; when the number of application instances decreases, the redundant unallocated IP addresses in the IP address pool can be released in a timely manner. In the context of scarce Underlay IP address resources, the utilization efficiency of IP address resources is improved.
[0127] By introducing subnet CRD, address pool CRD, address pool controller, and address pool proxy, the container cloud platform administrator creates and maintains subnets by writing and maintaining subnet CRD, and hands over the creation and maintenance of the IP address pool to the application administrator. The application administrator only needs to add an annotation field to the Deployment file of the application and write the corresponding content under the annotation field to create and maintain the IP address pool. Thus, the powers and responsibilities of the container cloud platform administrator and the application administrator are clarified. The application administrator who is familiar with the actual operation of the application maintains the IP address pool, which reduces the burden on the container cloud platform administrator and makes the setting of management powers more reasonable.
[0128] In addition, in special cases, the application administrator can manually modify the content of the address pool CRD to prevent the pre-set content of the IP address operation and maintenance policy of the application from not conforming to the actual situation of the application operation. Combining intelligence and flexibility can meet the usage requirements in various scenarios.
[0129] Exemplary system
[0130] The embodiment of the present application provides a system for intelligent operation and maintenance of IP addresses based on a container cloud platform, as Figure 5 shown. The system includes: a creation unit 501 and an allocation unit 502. Among them:
[0131] The creation unit 501 is configured to, in response to receiving an IP address pool creation request, create an IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool. Among them, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application.
[0132] The allocation unit 502 is configured to set the application affinity field of the IP address pool to the identification information of the target application, and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
[0133] The system for intelligent operation and maintenance of IP addresses based on the container cloud platform provided by the embodiments of the present application can implement the processes and steps of the method for intelligent operation and maintenance of IP addresses based on the container cloud platform in any of the above embodiments, and achieve the same technical effects, which will not be elaborated herein one by one.
[0134] Exemplary device
[0135] Figure 6 Schematic diagram of the structure of an electronic device provided according to some embodiments of the present application; as Figure 6 shown, the electronic device includes:
[0136] One or more processors 601;
[0137] A computer-readable medium that can be configured to store one or more programs 602. When the one or more processors 601 execute the one or more programs 602, the following steps are implemented: in response to receiving an IP address pool creation request, create an IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application; set the application affinity field of the IP address pool to the identification information of the target application, and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
[0138] Figure 7 Hardware structure of an electronic device provided according to some embodiments of the present application; as Figure 7 shown, the hardware structure of the electronic device may include: a processor 701, a communication interface 702, a computer-readable medium 703, and a communication bus 704.
[0139] Wherein, the processor 701, the communication interface 702, and the computer-readable storage medium 703 complete communication with each other through the communication bus 704.
[0140] Optionally, the communication interface 702 may be an interface of a communication module, such as an interface of a GSM module.
[0141] Among them, the processor 701 can be specifically configured to: in response to receiving an IP address pool creation request, create an IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application; set the application affinity field of the IP address pool to the identification information of the target application, and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
[0142] The processor 701 can be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc., and can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) off-the-shelf, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0143] The electronic devices in the embodiments of the present application exist in various forms, including but not limited to:
[0144] (1) Mobile communication devices: The characteristic of such devices is that they have mobile communication functions and mainly aim to provide voice and data communication. Such terminals include: smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones, etc.
[0145] (2) Ultra-mobile personal computer devices: Such devices belong to the category of personal computers, have computing and processing functions, and generally also have the characteristic of mobile Internet access. Such terminals include: PDAs, MIDs, and UMPC devices, etc., such as iPad.
[0146] (3) Portable entertainment devices: Such devices can display and play multimedia content. Such devices include: audio and video players (e.g., iPod), handheld game consoles, e-books, and smart toys and portable in-vehicle navigation devices.
[0147] (4) Servers: Devices that provide computing services. The composition of a server includes a processor, a hard disk, a memory, a system bus, etc. A server is similar to a general computer architecture, but due to the need to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc.
[0148] (5) Other electronic devices with data interaction functions.
[0149] It should be noted that, according to the needs of implementation, each component / step described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0150] The method according to the embodiments of the present application can be implemented in hardware, firmware, or be implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or be implemented as computer code originally stored in a remote recording medium or a non-transitory machine storage medium and downloaded through a network and will be stored in a local recording medium, so that the method described herein can be stored on such a software process on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (such as a RAM, a ROM, a flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method for intelligent operation and maintenance of IP addresses based on a container cloud platform described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown herein, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown herein.
[0151] Those of ordinary skill in the art can realize that the units and method steps of each example described in combination with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and the involved constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0152] It should be noted that the embodiments in this specification are all described in a progressive manner. For the same or similar parts between the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device and the system, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the partial description of the method embodiments for the relevant parts.
[0153] The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0154] The foregoing is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
Claims
1. A method for intelligent operation and maintenance of IP addresses based on a container cloud platform, characterized in that, Including: In response to receiving an IP address pool creation request, create the IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirements of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirements of the target application; Set the application affinity field of the IP address pool to the identification information of the target application, and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the unallocated IP addresses in the IP address pool to the application instances of the target application.
2. The method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to claim 1, wherein Before receiving the IP address pool creation request and creating the IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool, the method further includes: In response to detecting the creation of a subnet resource object, create at least one subnet in the container cloud platform; the subnet is used to group all the IP addresses in the container cloud platform, and each subnet includes at least one IP address; In response to detecting the addition of the identification information of the subnet and the IP address requirements of the target application in the annotation field of the resource file of the target application, generate the IP address pool creation request.
3. The method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to claim 2, wherein The step of, in response to receiving the IP address pool creation request, creating the IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool, specifically is: In response to receiving the IP address pool creation request, parse the IP address operation and maintenance policy of the target application to obtain the identification information of the subnet and the IP address requirements of the target application; Allocate available IP addresses that match the IP address requirements of the target application from the subnet to create the IP address pool.
4. The method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to claim 3, wherein The quantity requirement of the IP addresses of the target application is a non-fixed value. After allocating the unallocated IP addresses in the IP address pool to the application instances of the target application, the method further includes: Continuously monitor the change in the number of application instances of the target application; In response to the quantity relationship between the application instances of the target application and the IP addresses included in the IP address pool satisfying the conditions set in the IP address operation and maintenance policy of the target application, allocate at least one available IP address in the subnet to the IP address pool, or allocate at least one available IP address in the IP address pool out.
5. The method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to claim 4, wherein The condition set in the IP address operation and maintenance policy of the target application is that the number of IP addresses included in the IP address pool is N more than the number of application instances of the target application, and N is a positive integer.
6. The method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to claim 1, wherein after allocating the unallocated IP addresses in the IP address pool to the application instances of the target application, the method further includes: in response to the removal of the target application from the container cloud platform, all the IP addresses in the IP address pool are marked out.
7. The method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to claim 3, wherein The quantity requirement of the IP addresses of the target application is a fixed value. after allocating the unallocated IP addresses in the IP address pool to the application instances of the target application, the method further includes: in response to the number of application instances of the target application being equal to the number of IP addresses included in the IP address pool, rejecting the request to add application instances to the target application.
8. A system for intelligent operation and maintenance of IP addresses based on a container cloud platform, characterized in that, including: a creation unit configured to, in response to receiving an IP address pool creation request, create the IP address pool according to the IP address operation and maintenance policy of the target application that needs to be bound to the IP address pool; wherein, the IP address operation and maintenance policy at least includes the identification information of the subnet to which the IP addresses included in the IP address pool belong and the IP address requirement of the target application, and the number of IP addresses included in the IP address pool matches the IP address requirement of the target application; an allocation unit configured to set the application affinity field of the IP address pool to the identification information of the target application and set the IP address pool label of the target application to the identification information of the IP address pool, so as to allocate the available IP addresses in the IP address pool to the application instances of the target application.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to any one of claims 1-7.
10. An electronic device, characterized in that, including: a memory, a processor, and a program stored in the memory and executable on the processor, and when the processor executes the program, it implements the method for intelligent operation and maintenance of IP addresses based on a container cloud platform according to any one of claims 1-7.
Citation Information
Patent Citations
Container address setting method and device and computer readable storage medium
CN110716787A
Network processing method and device, electronic equipment and storage medium
CN115174529A