Pod address management method and device, electronic equipment and storage medium

By creating and writing multiple auxiliary IP addresses in the Kubernetes cluster, the problem of failures in address pool elastic management cannot be discovered, isolated and lossless recovery in time, ensuring that there are always available addresses in the IP pool and avoiding the failure to create new pods.

CN120281747APending Publication Date: 2025-07-08BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510446152.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In Kubernetes cluster, the elastic management of address pools has problems such as failures that cannot be discovered in time, cannot be isolated, and cannot be recovered without loss, resulting in the inability to create a new pod when the IP address is insufficient, and the resource competition problem cannot be solved by adding a new subnet.

Method used

When creating requirements for virtual network interfaces, create a target virtual network interface bound to the target node and write multiple auxiliary IP addresses into the interface to ensure that there are always available addresses in the IP pool and avoid insufficient IP addresses.

Benefits of technology

It realizes that there are always available auxiliary IP addresses in the IP pool during resource competition, avoiding the problem of not being able to create a new Pod due to insufficient IP addresses, and solving the defects of address pool elastic management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281747A_ABST
    Figure CN120281747A_ABST
Patent Text Reader

Abstract

The invention provides a Pod address management method and device, electronic equipment and a storage medium, and the method comprises the steps: creating a target virtual network interface bound to a target node in response to a virtual network interface creation demand; a plurality of auxiliary IP addresses in a subnet where the target node is located are written into the target virtual network interface, and the auxiliary IP addresses are IP addresses used for being distributed to Pod. According to the method and the device, the target virtual network interface is created after the virtual network interface creation demand exists, and the auxiliary IP address is written, so that the purpose that available auxiliary IP addresses always exist in the IP pool can be realized, the technical effect that a new Pod cannot be created due to insufficient auxiliary IP addresses is avoided, and the user experience is improved. Therefore, the problem that the elastic management of the address pool has defects during resource competition in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of containerized deployment, and particularly to a Pod address management method and apparatus, an electronic device, and a storage medium. Background Art

[0002] K8s (i.e., Kubernetes) is a powerful container orchestration platform that provides the ability to automate the deployment, scaling, and management of containerized applications. Through its rich features and large ecosystem, K8s has become an indispensable tool for modern cloud-native application development and operation, which can improve development efficiency and system reliability. In K8s, elastic management of the address pool is very important. Especially in large-scale clusters or containerized applications, effective address pool management can ensure smooth communication between Pods and nodes. However, in related technologies, there are the following problems in the elastic management of the address pool:

[0003] 1. Faults cannot be detected in time: It is expected that the subnet resources are exhausted. However, when new Pods cannot be created due to insufficient subnet IP addresses, no alarm can be issued in time, resulting in users being unable to add new subnets to the K8s cluster configuration in time.

[0004] Since subnets are user-controlled resources, creating subnets is to allocate the IP addresses of the subnets to network elements such as services or LBs (Load Balancers). Therefore, in most scenarios, it is expected that the subnet IPs are exhausted.

[0005] 2. Faults cannot be isolated: When a Pod cannot be assigned an IP address on a node, more Pods will continue to be scheduled to the node, making more Pods unable to start normally.

[0006] 3. Faults cannot be recovered without loss: When a node cannot continue to allocate IP addresses due to insufficient available IPs in the subnet. Under the following frequently triggered conditions, it will fall into an unrecoverable state, and the problem can only be solved by replacing the new node: The quota of ENIs (Elastic Network Interfaces) that a node can bind is exhausted: For example, a single instance can only bind 8 ENIs, and when 8 ENIs have been bound, the quota is exhausted; The VPC (Virtual Private Cloud) restricts that an ENI can only use one subnet, and ENIs do not support changing subnets; The subnet cannot be expanded; Users cannot solve the problem by adding new subnets; IP caching problems.

[0007] Therefore, there are defects in the elastic management of the address pool in related technologies during resource competition. Summary of the Invention

[0008] The present application provides a Pod address management method, an apparatus, an electronic device, and a storage medium, so as to at least solve the problem that there are defects in the elastic management of the address pool in resource competition in the related art.

[0009] According to one aspect of the embodiments of the present application, a Pod address management method is provided, including:

[0010] In response to a virtual network interface creation requirement, create a target virtual network interface bound to a target node;

[0011] Write multiple auxiliary IP addresses in the subnet where the target node is located into the target virtual network interface, where the auxiliary IP addresses are IP addresses used to be assigned to Pods.

[0012] Optionally, in the method as described above, the method further includes:

[0013] Obtain the IP address consumption information of the existing virtual network interface;

[0014] In the case where it is determined that the IP address consumption information indicates that the number of remaining IP addresses is less than a preset number, generate the virtual network interface creation requirement, where the number of remaining IP addresses is the number of unallocated auxiliary IP addresses.

[0015] Optionally, in the method as described above, the preset number is: a preset multiple of the auxiliary IP address capacity, where the auxiliary IP address capacity is the maximum number of auxiliary IP addresses that can be attached to each virtual network interface.

[0016] Optionally, in the method as described above, the method for determining the preset multiple includes:

[0017] Obtain a reservation parameter;

[0018] Determine the preset multiple according to the parameter value of the reservation parameter.

[0019] Optionally, in the method as described above, the step of creating a target virtual network interface bound to a target node in response to a virtual network interface creation requirement includes:

[0020] Obtain the maximum available number of IP addresses M, where the maximum available number of IP addresses is a preset maximum number of IP addresses in the IP pool, and the IP pool is the set of all available IP addresses on the target node;

[0021] When the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of a node, P target virtual network interfaces are created, where the maximum number of IP addresses N of the node = P×(Q - 1), P is the maximum number of virtual network interfaces that the target node can have, and Q is the number of auxiliary IP addresses that can be attached to each virtual network interface;

[0022] When the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, W target virtual network interfaces are created, where W is the ceiling integer of M / P.

[0023] Optionally, as in the foregoing method, the method further includes:

[0024] Reading specified parameters in the kubelet configuration file;

[0025] When the specified parameters are read, determining the value corresponding to the specified parameters as the maximum available number of IP addresses;

[0026] When the specified parameters are not read, determining the default value as the maximum available number of IP addresses.

[0027] Optionally, as in the foregoing method, writing multiple auxiliary IP addresses in the target subnet where the target node is located into the target virtual network interface includes:

[0028] When the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of the node, attaching auxiliary IP addresses with an auxiliary IP address capacity to each target virtual network interface, where the auxiliary IP address capacity is the maximum number of auxiliary IP addresses that can be attached to each virtual network interface;

[0029] When the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, attaching auxiliary IP addresses with the auxiliary IP address capacity to V target virtual network interfaces among the W target virtual network interfaces, and attaching the remainder of M divided by Q auxiliary IP addresses to the remaining one target virtual network interface among the W target virtual network interfaces other than the V target virtual network interfaces, where V = W - 1.

[0030] According to another aspect of the embodiments of the present application, there is also provided a Pod address management device, including:

[0031] A creation module, configured to create a target virtual network interface bound to a target node in response to a virtual network interface creation requirement;

[0032] A writing module, configured to write a plurality of auxiliary IP addresses in the subnet where the target node is located into the target virtual network interface, where the auxiliary IP address is an IP address for allocation to a Pod.

[0033] According to another aspect of the embodiments of the present application, an electronic device is further provided, including a processor, a communication interface, a memory, and a communication bus. The processor, the communication interface, and the memory complete communication with each other through the communication bus. The memory is used to store a computer program. The processor is configured to execute the method steps in any of the above embodiments by running the computer program stored on the memory.

[0034] According to another aspect of the embodiments of the present application, a computer-readable storage medium is further provided. The storage medium stores a computer program, where the computer program is configured to execute the method steps in any of the above embodiments when running.

[0035] In the embodiments of the present application, a method is adopted in which a plurality of auxiliary IP addresses are allocated after the virtual network interface is established. By responding to the virtual network interface creation requirement, a target virtual network interface bound to the target node is created. A plurality of auxiliary IP addresses in the subnet where the target node is located are written into the target virtual network interface, where the auxiliary IP address is an IP address for allocation to a Pod. Since the target virtual network interface is created after the virtual network interface creation requirement appears and the auxiliary IP address is written, the purpose that there are always available auxiliary IP addresses in the IP pool can be achieved, the technical effect that new Pods cannot be created due to insufficient auxiliary IP addresses will not occur, and further the problem of defects in the elastic management of the address pool in resource competition in the related art is solved. Description of the Drawings

[0036] The drawings here are incorporated into the specification and constitute a part of this specification, showing the embodiments in line with the present application, and are used together with the specification to explain the principles of the present application.

[0037] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.

[0038] Figure 1 It is a schematic diagram of the hardware environment of an optional Pod address management method according to the embodiments of the present application;

[0039] Figure 2It is a flowchart of an optional Pod address management method according to an embodiment of the present application;

[0040] Figure 3 It is a flowchart of another optional Pod address management method according to an embodiment of the present application;

[0041] Figure 4 It is a structural block diagram of an optional Pod address management device according to an embodiment of the present application;

[0042] Figure 5 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. Detailed implementation manners

[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0045] In a cloud K8s cluster, there is a clear physical relationship between nodes and the IP pool. This relationship involves EC2 instances, ENIs (Elastic Network Interfaces), and the allocation and management of private IP addresses.

[0046] 1. Node: A node is a computing unit that runs Kubernetes workloads. The node is responsible for running containerized applications (i.e., Pods) and providing the necessary computing resources (CPU, memory, storage, and network) to support these applications.

[0047] 2. ENI (Elastic Network Interface): That is, a virtual network interface that can be attached to an instance to provide network connectivity. Each ENI can have a primary IP address and multiple secondary IP addresses. The primary IP address is used for communication and management between nodes, while the secondary IP addresses are used for network communication of Pods. Each Kubernetes node (e.g., an EC2 instance) has a primary ENI to provide the basic network connectivity for that node. Attached ENI: As the number of Pods increases, additional ENIs may be required to meet the need for more IP addresses. These attached ENIs can be automatically created and attached to the node through CNI (Container Network Interface) plugins.

[0048] 3. IP Pool: An IP pool refers to the set of all available IP addresses on a node, and these IP addresses come from the secondary IP addresses of all ENIs on that node. Each Pod needs a unique IP address for network communication. The CNI plugin (such as the Amazon VPC CNI plugin) allocates an available private IP address from the ENI to the Pod. Shared ENI: Some CNI plugins (such as the Amazon VPC CNI plugin) allow multiple Pods to share the same ENI, reducing the need for ENIs and IP addresses.

[0049] 4. Subnet: A subnet in a cluster is a logical division within a VPC (Virtual Private Cloud) that defines the IP address range for all resources (including instances, ENIs, etc.) within that subnet.

[0050] According to one aspect of the embodiments of the present application, a method for managing Pod addresses is provided. Optionally, in this embodiment, the above-mentioned method for managing Pod addresses can be applied to a hardware environment composed of a terminal 1402 and a server 1404 as Figure 1 shown. As Figure 1 shown, the server 1404 is connected to the terminal 1402 through a network and can be used to provide services (such as game services, application services, etc.) for the terminal or the client installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 1404.

[0051] The above network can include, but is not limited to, at least one of the following: a wired network, a wireless network. The above-mentioned wired network can include, but is not limited to, at least one of the following: a wide area network, a metropolitan area network, a local area network. The above-mentioned wireless network can include, but is not limited to, at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal is not limited to a PC, a mobile phone, a tablet computer, etc.

[0052] The Pod address management method according to the embodiment of the present application can be executed by a server, or by a terminal, or jointly by a server and a terminal. Among them, the execution of the Pod address management method according to the embodiment of the present application by the terminal can also be executed by a client installed thereon.

[0053] Taking the execution of the Pod address management method in this embodiment by the server as an example, Figure 2 A Pod address management method provided by an embodiment of the present application includes the following steps:

[0054] Step S202, in response to a virtual network interface creation requirement, create a target virtual network interface bound to a target node.

[0055] The Pod address management method in this embodiment can be applied to a scenario of managing auxiliary IP addresses allocated to Pods in a K8s cluster on the cloud.

[0056] In this embodiment, the virtual network interface creation requirement may be a requirement generated when the system automatically determines that the auxiliary IP addresses in the current IP pool are insufficient. That is to say, the foregoing virtual network interface creation requirement is to allocate auxiliary IP addresses to Pods running on the target node.

[0057] After obtaining the virtual network interface creation requirement, a target virtual network interface for binding to the target node can be created. That is to say, after obtaining the virtual network interface creation requirement, it is necessary to expand the virtual network interface to supplement the available IP addresses in the IP pool. Further, the number of target virtual network interfaces obtained by expansion can be one or more.

[0058] Step S204, write multiple auxiliary IP addresses in the subnet where the target node is located into the target virtual network interface, where the auxiliary IP addresses are IP addresses allocated to Pods.

[0059] Specifically, after creating the target virtual network interface, multiple auxiliary IP addresses within the IP range corresponding to the subnet where the target node is located can be written into the target virtual network interface.

[0060] In the embodiment of the present application, a virtual network interface is adopted to allocate multiple auxiliary IP addresses after being established. By responding to the virtual network interface creation requirement, a target virtual network interface bound to the target node is created; multiple auxiliary IP addresses in the subnet where the target node is located are written into the target virtual network interface, where the auxiliary IP address is an IP address used to be allocated to a Pod. Since the target virtual network interface is created and the auxiliary IP addresses are written after there is a virtual network interface creation requirement, the purpose that there are always available auxiliary IP addresses in the IP pool can be achieved, and the technical effect that new Pods cannot be created due to insufficient auxiliary IP addresses will not occur. Furthermore, the problem of the elastic management of the address pool having defects in resource competition in the related art is solved, and thus the problems of failure not being detected in time, failure not being isolated, and failure not being recoverable without loss can be avoided.

[0061] As Figure 3 shown, as an optional embodiment, for the method as described above, the method further includes the following steps:

[0062] Step S302, obtain the IP address consumption information of the existing virtual network interface.

[0063] Specifically, the IP addresses idle on the existing virtual network interfaces bound to the target node can be monitored to obtain the IP address consumption information of the existing virtual network interface.

[0064] The IP address consumption information can be used to indicate the number of remaining IP addresses of the virtual network interface.

[0065] Step S304, generate a virtual network interface creation requirement when it is determined that the IP address consumption information indicates that the number of remaining IP addresses is less than a preset number, where the number of remaining IP addresses is the number of unallocated auxiliary IP addresses.

[0066] Specifically, after obtaining the IP address consumption information, the number of remaining IP addresses indicated by the IP address consumption information can be determined; then the number of remaining IP addresses can be compared with the preset number to determine whether a new virtual network interface needs to be created. That is, when it is determined that the IP address consumption information indicates that the number of remaining IP addresses is less than the preset number, a virtual network interface creation requirement is generated. On the contrary, when it is determined that the IP address consumption information indicates that the number of remaining IP addresses is greater than or equal to the preset number, no virtual network interface creation requirement is generated.

[0067] As an alternative embodiment, in the method as described above, the preset quantity is: a preset multiple of the auxiliary IP address capacity, where the auxiliary IP address capacity is the maximum number of auxiliary IP addresses that can be attached to each virtual network interface. As an alternative embodiment, in the method as described above, the method for determining the preset multiple includes: obtaining a reservation parameter; determining the preset multiple according to the parameter value of the reservation parameter. Specifically, the reservation parameter may be the important parameter burstableMehrfachENI in the Burstable IP address pool, which defines the number of idle IPs for the minimum reserved ENI IP capacity multiple. After determining the reservation parameter, the preset quantity can be determined based on the product between the reservation parameter and the auxiliary IP address capacity. The auxiliary IP address capacity is the number of IP addresses included in a virtual network interface. For example, in the Burstable IP address pool mode, if burstableMehrfachENI is 1, there is always at least one IP address with the ENI IP capacity available. If the total available IPs are less than burstableMehrfachENI * (maxIPsPerENI - 1), ENI expansion will be immediately triggered to supplement the available IP addresses in the IP pool. maxIPsPerENI is the maximum number of IP addresses for one ENI.

[0068] For example, when an instance (i.e., a host) has 8 ENIs (virtual network interfaces), the maximum IP capacity for each ENI is 30.

[0069] If 1 IP has already been allocated to a Pod, even if there are 28 idle IPs (the primary IP of the ENI occupies one IP), a second ENI will be created. At this time, the total consumed IPs are 1, and one IP is occupied by the primary IPs of the two ENIs respectively. Therefore, the total reserved IPs are 60 - 2 = 58, and the total reserved IPs include the IPs already allocated to the Pod and the IPs not allocated to the Pod.

[0070] If 29 IPs have already been allocated to a Pod, a second ENI will also be created. At this time, the total consumed IPs are 31, and the total reserved IPs are 60 - 2 = 58.

[0071] As an alternative embodiment, in the method as described above, the foregoing step S202 of creating a target virtual network interface bound to the target node in response to a virtual network interface creation requirement may also be implemented through the following steps:

[0072] Obtain the maximum available number of IP addresses M, where the maximum available number of IP addresses is the maximum number of IP addresses preset in the IP pool, and the IP pool is the set of all available IP addresses on the target node.

[0073] Specifically, the maximum available number of IP addresses M can be a pre-set parameter used to indicate the maximum available number of IP addresses in the IP pool.

[0074] As an alternative embodiment, for the method as described above, the maximum available number of IP addresses can be obtained through the following method: read the specified parameter in the kubelet configuration file; when the specified parameter is read, determine the value corresponding to the specified parameter as the maximum available number of IP addresses; when the specified parameter is not read, determine the default value as the maximum available number of IP addresses. Optionally, the ipam.pool.max-allocate parameter defines the maximum available number of IP addresses M in the IP pool (i.e., max-allocate in the following text). In the Burstable ENI mode, the maximum available number of IP addresses M is obtained from the kubelet configuration file. Further, the specified parameter in the kubelet configuration file from which the maximum available number of IP addresses M is obtained is the --max-pods parameter, i.e., the maximum number of Pods per machine. Further, the --max-pods parameter is obtained by the nodediscovery module of cce-network-agent through real-time data collection according to the kubelet configuration. When cce-network-agent starts, it reads the value of the --max-pods parameter in the kubelet configuration file as the maximum available number of IP addresses. If the --max-pods parameter in the kubelet configuration file does not exist, the default value (e.g., 110) is used as the maximum available number of IP addresses.

[0075] As an alternative embodiment, after the specified parameter is updated, the reading program needs to be restarted to read the latest specified parameter. Specifically, if the --max-pods parameter in the kubelet configuration file is updated while cce-network-agent is running, cce-network-agent will not re-read the parameter. The cce-network-agent process can be restarted to enable cce-network-agent to read the latest --max-pods parameter. The total number of IP addresses allocated to the target node will not exceed max-allocate + eniNum, and the number of available IP addresses for Pods will not exceed max-allocate, where eniNum is the number of ENIs, that is, the total number of IP addresses allocated to the target node will not exceed the sum of the number of primary IP addresses and the number of secondary IP addresses in each ENI.

[0076] When the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of a node, P target virtual network interfaces are created, where the maximum number of IP addresses N of the node = P×(Q - 1), P is the maximum number of virtual network interfaces that a target node can have, and Q is the number of auxiliary IP addresses that can be attached to each virtual network interface.

[0077] Specifically, when the maximum available number of IP addresses M is greater than the maximum number of IP addresses N of the node, that is, max - allocate is greater than the maximum number of IP addresses of the node (maxAllocateENI*(maxIPsPerENI - 1)), the maximum number of IP addresses N of the target node is used, where maxAllocateENI is the maximum number of virtual network interfaces P, and maxIPsPerENI is the number of auxiliary IP addresses Q that can be attached to each virtual network interface. When the maximum available number of IP addresses M is equal to the maximum number of IP addresses N of the node, that is, max - allocate is equal to the maximum number of IP addresses of the node (maxAllocateENI*(maxIPsPerENI - 1)), then finally maxAllocateENI ENIs are applied for. And the reason for "Q - 1" is that each ENI must have a primary IP address, and only auxiliary IP addresses can be used for Pod allocation. For example, when M is 70, P is 2, and Q is 30, then N is 2×(30 - 1)=58.

[0078] When the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, W target virtual network interfaces are created, where W is the ceiling integer of M / P.

[0079] Specifically, when the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, that is, max - allocate is less than the maximum number of IP addresses of the node (maxAllocateENI*(maxIPsPerENI - 1)), then finally ceil(max - allocate / (maxIPsPerENI - 1)) ENIs are applied for.

[0080] As an alternative embodiment, for the method as described above, writing multiple auxiliary IP addresses in the target subnet where the target node is located into the target virtual network interface includes:

[0081] When the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of the node, auxiliary IP addresses with the capacity of auxiliary IP addresses are attached to each target virtual network interface, where the capacity of auxiliary IP addresses is the maximum number of auxiliary IP addresses that can be attached to each virtual network interface. That is to say, when the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of the node, the auxiliary IP capacity of each ENI is full.

[0082] When the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, auxiliary IP addresses with auxiliary IP address capacity are attached to V target virtual network interfaces among the W target virtual network interfaces, and the remainder of the one target virtual network interface among the W target virtual network interfaces except for the V target virtual network interfaces is attached with the number of auxiliary IP addresses obtained by taking the remainder of M divided by Q, where V = W - 1. Specifically, that is, when the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, the auxiliary IP capacities of V ENIs are all filled, and finally the auxiliary IP capacity of the remaining one target virtual network interface among the W target virtual network interfaces except for the V target virtual network interfaces is max - allocate % maxIPsPerENI. For example, when M is 56 and Q is 30, the auxiliary IP capacity of 1 ENI is all filled (i.e., 30), and the auxiliary IP capacity of the remaining one target virtual network interface is 56 - 29 = 27.

[0083] Furthermore, different auxiliary IP addresses are divided by network segments, and the network segments corresponding to different machines are different. Tags can be added to the machines, and the network segment corresponding to each machine can be determined through the tags. And the auxiliary IP addresses are cached on the machines, and the cached auxiliary IP addresses are only used after the services (i.e., Pods) on the machines are started. If it is determined that all the auxiliary IP addresses corresponding to a certain network segment are not in use, that is, all the Pods corresponding to that network segment are deleted, then that network segment is taken down.

[0084] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0085] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM (Read-Only Memory), RAM (Random Access Memory), magnetic disk, optical disk), and includes several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.

[0086] According to another aspect of the embodiments of the present application, there is also provided a Pod address management device for implementing the above-mentioned Pod address management method. Figure 4 FIG. is a structural block diagram of an optional Pod address management device according to an embodiment of the present application. As Figure 4 shown, the device may include:

[0087] A creation module 41, configured to create a target virtual network interface bound to a target node in response to a virtual network interface creation requirement;

[0088] A writing module 42, configured to write a plurality of auxiliary IP addresses in the subnet where the target node is located into the target virtual network interface, where the auxiliary IP address is an IP address used to be assigned to a Pod.

[0089] It should be noted that the creation module 41 in this embodiment may be used to execute the above step S202, and the writing module 42 in this embodiment may be used to execute the above step S204.

[0090] Through the above modules, by adopting the method that a plurality of auxiliary IP addresses are allocated after the virtual network interface is established, in response to the virtual network interface creation requirement, a target virtual network interface bound to the target node is created; and a plurality of auxiliary IP addresses in the subnet where the target node is located are written into the target virtual network interface, where the auxiliary IP address is an IP address used to be assigned to a Pod. Since the target virtual network interface is created and the auxiliary IP address is written after there is a virtual network interface creation requirement, the purpose that there are always available auxiliary IP addresses in the IP pool can be achieved, and the technical effect that new Pods cannot be created due to insufficient auxiliary IP addresses will not occur, thereby solving the problem of the defect in the elastic management of the address pool in resource competition in the related art.

[0091] The device in this embodiment, in addition to including the above modules, may further include a module that executes any method in the embodiments of the foregoing Pod address management method.

[0092] It should be noted here that the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should be noted that the above modules, as part of the device, can run in the hardware environment as shown in Figure 1 and can be implemented by software or by hardware, where the hardware environment includes a network environment.

[0093] According to another aspect of the embodiments of the present application, an electronic device for implementing the above Pod address management method is further provided. The electronic device may be a server, a terminal, or a combination thereof.

[0094] According to another embodiment of the present application, an electronic device is further provided, including: as shown in Figure 5 , the electronic device may include: a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504. Among them, the processor 1501, the communication interface 1502, and the memory 1503 communicate with each other through the communication bus 1504.

[0095] The memory 1503 is used to store a computer program;

[0096] When the processor 1501 is used to execute the program stored in the memory 1503, the following steps are implemented:

[0097] Step S202: In response to a virtual network interface creation requirement, create a target virtual network interface bound to the target node.

[0098] Step S204: Write multiple auxiliary IP addresses in the subnet where the target node is located into the target virtual network interface, where the auxiliary IP address is an IP address used to be assigned to a Pod.

[0099] Optionally, in this embodiment, the above communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used for communication between the above electronic device and other devices.

[0100] The memory may include a Random Access Memory (RAM), or may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0101] As an example, the memory 1503 may, but is not limited to, include the creation module 41 and the writing module 42 in the above-mentioned Pod address management device. In addition, it may also include, but is not limited to, other module units in the above-mentioned Pod address management device, which will not be elaborated in this example.

[0102] The aforementioned processor may be a general-purpose processor, which may include, but is not limited to: a CPU (Central Processing Unit, central processor), an NP (Network Processor, network processor), etc.; it may also be a DSP (Digital Signal Processor, digital signal processor), an ASIC (Application Specific Integrated Circuit, application-specific integrated circuit), an FPGA (Field-Programmable Gate Array, field programmable gate array), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0103] The embodiment of the present application also provides a computer-readable storage medium. The storage medium includes a stored program, wherein when the program runs, it executes the method steps of the above-mentioned method embodiment.

[0104] Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to: various media such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disc that can store program codes.

[0105] The serial numbers of the embodiments of the present application are only for description and do not represent the superiority or inferiority of the embodiments.

[0106] If the integrated unit in the above-mentioned embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in the above-mentioned computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product. The computer software product is stored in the storage medium and includes several instructions for causing one or more computer devices (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0107] In the above embodiments of the present application, the descriptions of the respective embodiments each have their own focuses. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0108] In several embodiments provided by the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of units or modules can be in an electrical or other form.

[0109] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.

[0110] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0111] The above are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present application.

Claims

1. A method for managing Pod addresses, characterized in that, Including: In response to a virtual network interface creation requirement, create a target virtual network interface bound to a target node; Write multiple secondary IP addresses in the subnet where the target node is located in the target virtual network interface, where the secondary IP address is an IP address used to be assigned to a Pod.

2. The method according to claim 1, characterized in that, The method further includes: Obtain the IP address consumption information of existing virtual network interfaces; When it is determined that the IP address consumption information indicates that the remaining number of IP addresses is less than a preset number, generate the virtual network interface creation requirement, where the remaining number of IP addresses is the number of unallocated secondary IP addresses.

3. The method according to claim 2, wherein The preset number is: a preset multiple of the secondary IP address capacity, where the secondary IP address capacity is the maximum number of secondary IP addresses that can be attached to each virtual network interface.

4. The method according to claim 3, characterized in that The method for determining the preset multiple includes: Obtain a reservation parameter; Determine the preset multiple according to the parameter value of the reservation parameter.

5. The method according to claim 1, wherein The step of creating a target virtual network interface bound to a target node in response to a virtual network interface creation requirement includes: Obtain the maximum available number of IP addresses M, where the maximum available number of IP addresses is a preset maximum number of IP addresses in an IP pool, and the IP pool is the set of all available IP addresses on the target node; When the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of the node, create P target virtual network interfaces, where the maximum number of IP addresses N of the node = P×(Q - 1), P is the maximum number of virtual network interfaces that the target node can have, and Q is the number of secondary IP addresses that can be attached to each virtual network interface; When the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, create W target virtual network interfaces, where W is the ceiling integer of M / P.

6. The method according to claim 5, characterized in that, The method further includes: Read a specified parameter in the kubelet configuration file; When the specified parameter is read, determine the value corresponding to the specified parameter as the maximum available number of IP addresses; When the specified parameter is not read, determine the default value as the maximum available number of IP addresses.

7. The method according to claim 6, characterized in that The step of writing multiple secondary IP addresses in the target subnet where the target node is located in the target virtual network interface includes: When the maximum available number of IP addresses M is greater than or equal to the maximum number of IP addresses N of the node, attach secondary IP addresses with the secondary IP address capacity to each target virtual network interface, where the secondary IP address capacity is the maximum number of secondary IP addresses that can be attached to each virtual network interface; When the maximum available number of IP addresses M is less than the maximum number of IP addresses N of the node, attach secondary IP addresses with the secondary IP address capacity to V target virtual network interfaces among the W target virtual network interfaces, and attach the remainder of M modulo Q secondary IP addresses to the remaining one target virtual network interface among the W target virtual network interfaces, where V = W - 1.

8. A Pod address management device, characterized in that, Including: A creation module, configured to create a target virtual network interface bound to a target node in response to a virtual network interface creation requirement; A writing module, configured to write multiple auxiliary IP addresses in the subnet where the target node is located into the target virtual network interface, where the auxiliary IP address is an IP address for allocation to a Pod.

9. An electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein, The processor, the communication interface, and the memory complete communication with each other through the communication bus, characterized in that The memory is configured to store a computer program; The processor is configured to execute the method according to any one of claims 1 to 7 by running the computer program stored on the memory.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the storage medium, where the computer program is configured to execute the method according to any one of claims 1 to 7 when running.