CN114371914A - Container IP address configuration method and device, storage medium and electronic equipment - Google Patents

Container IP address configuration method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114371914A
CN114371914A CN202210022924.6A CN202210022924A CN114371914A CN 114371914 A CN114371914 A CN 114371914A CN 202210022924 A CN202210022924 A CN 202210022924A CN 114371914 A CN114371914 A CN 114371914A
Authority
CN
China
Prior art keywords
container
address
target
template
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210022924.6A
Other languages
Chinese (zh)
Inventor
侯诗军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Bodun Xiyan Technology Co ltd
Original Assignee
Hangzhou Bodun Xiyan Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Bodun Xiyan Technology Co ltd filed Critical Hangzhou Bodun Xiyan Technology Co ltd
Priority to CN202210022924.6A priority Critical patent/CN114371914A/en
Publication of CN114371914A publication Critical patent/CN114371914A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Abstract

The disclosure relates to a container IP address configuration method, a device, a storage medium and an electronic device, relating to the technical field of computers, wherein the method comprises the following steps: the template IP binding relationship corresponding to the container template may be determined first, then the target IP address for binding the container template is obtained according to the template IP binding relationship, and finally the target IP address is configured to the virtual network card corresponding to the target container, where the target container is a container created according to the container template. Therefore, the IP address corresponding to the container can be determined by determining the binding relationship between the container template and the IP address, so that the process of determining the IP address configured by the container by using a service layer can be omitted, and further, when the container fails in operation, the IP address configured by the container can be directly determined according to the binding relationship between the container template and the IP address, so that the problem that the IP address configured by the container cannot be found back due to the container failure can be avoided, and the operation stability of the container can be improved.

Description

Container IP address configuration method and device, storage medium and electronic equipment
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a container IP address configuration method, a container IP address configuration device, a storage medium and electronic equipment.
Background
At present, with the rapid development of container technology, the container technology has gradually become a standard technology for application deployment in the telecommunication industry, and bears various core services and standard services. As bearer services become more and more important, the requirements for various aspects of container technology are also increasing. In the actual use process, the accessed container IP is often required to be fixed, but when the container fails, for example, the container is restarted, switched, drifted, and the like, the IP address of the container is often changed. For example, when a plurality of databases are used as a high-availability cluster, the IP address of the standby database container needs to be known by the primary database container, and if the IP address of the container changes frequently, the database cluster cannot operate.
Therefore, there is an urgent need for a method for preventing the change of the IP address of the container.
It is to be noted that the information invented in the background section above is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure is directed to a container IP address configuration method, device, storage medium, and electronic apparatus, so as to overcome the above-mentioned related problems at least to some extent.
According to an aspect of the present disclosure, there is provided a container IP address configuration method, including:
determining a template IP binding relationship corresponding to the container template;
acquiring a target IP address for binding the container template according to the template IP binding relationship;
configuring the target IP address to a virtual network card corresponding to a target container; the target container is a container created from the container template.
Optionally, before determining the template IP binding relationship corresponding to the container template, the method further includes:
determining network address information and a first number in the container template;
acquiring the first number of IP addresses from an IP address set as the target IP address according to the network address information;
and binding the target IP address with the container template to generate the template IP binding relationship.
Optionally, when the number of the target containers is greater than one, after the allocating the target IP address to the virtual network card corresponding to the target container, the method further includes:
determining a target name corresponding to the target container;
and storing the corresponding relation between the target name and the allocated target IP address according to the target IP address allocated to the target container.
Optionally, if a faulty container occurs, the method further includes:
determining a failed container template used by the failed container;
and determining a fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to a virtual network card corresponding to the fault container.
According to an aspect of the present disclosure, there is provided a container IP address configuration apparatus, the apparatus including:
the first determining module is used for determining the template IP binding relationship corresponding to the container template;
the first acquisition module is used for acquiring a target IP address for binding the container template according to the template IP binding relationship;
the configuration module is used for configuring the target IP address to a virtual network card corresponding to a target container; the target container is a container created from the container template.
Optionally, the apparatus further comprises:
a second determining module, configured to determine the network address information and the first number in the container template;
a second obtaining module, configured to obtain the first number of IP addresses from an IP address set according to the network address information, where the first number of IP addresses is used as the target IP address;
and the binding module is used for binding the target IP address with the container template to generate the template IP binding relationship.
Optionally, when the number of the target containers is greater than one, the apparatus further includes:
a third determining module, configured to determine a target name corresponding to the target container;
and the storage module is used for storing the corresponding relation between the target name and the allocated target IP address according to the target IP address allocated by the target container.
Optionally, if a faulty container occurs, the apparatus further includes:
a fourth determining module, configured to determine a failed container template used by the failed container;
and the fifth determining module is used for determining the fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to the virtual network card corresponding to the fault container.
According to an aspect of the present disclosure, there is provided a container cluster system including an IP address management module, a storage module, and a storage module, the system including:
the storage module is used for creating a preset number of target containers according to the stored container templates;
the IP address management module is used for determining a template IP binding relationship corresponding to the container template from the storage module;
the IP address management module is used for acquiring a target IP address for binding the container template from the storage module according to the template IP binding relationship;
and the IP address management module is used for configuring the target IP address to a virtual network card corresponding to the target container.
Optionally, when the number of the target containers is greater than one, after the allocating the target IP address to the virtual network card corresponding to the target container, the method further includes:
the IP address management module is configured to determine a target name corresponding to the target container, and store a correspondence between the target name and the allocated target IP address in the storage module.
Optionally, if a faulty container occurs, the system further includes:
and the IP address management module is used for determining a fault container template used by the fault container and determining a fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to a virtual network card corresponding to the fault container.
According to an aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the container IP address configuration method of any one of the above.
To sum up, the method for configuring a container IP address provided in the embodiment of the present disclosure may determine a template IP binding relationship corresponding to a container template, obtain a target IP address for binding the container template according to the template IP binding relationship, and configure the target IP address to a virtual network card corresponding to a target container, where the target container is a container created according to the container template. Therefore, the IP address corresponding to the container can be determined by determining the binding relationship between the container template and the IP address, so that the process of determining the IP address configured by the container by using a service layer can be omitted, and further, when the container fails in operation, the IP address configured by the container can be directly determined according to the binding relationship between the container template and the IP address, so that the problem that the IP address configured by the container cannot be found back due to the container failure can be avoided, and the operation stability of the container can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 is a flowchart illustrating steps of a method for configuring an IP address of a container according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating steps for configuring an IP address of a container according to an embodiment of the present disclosure;
fig. 3 is a flowchart of a container IP address configuration provided by an embodiment of the present disclosure;
fig. 4 is a block diagram illustrating a configuration apparatus of a container IP address according to an embodiment of the present invention;
fig. 5 is an electronic device for implementing the container IP address configuration method according to an embodiment of the present invention.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The container IP address configuration method provided in the embodiment of the present disclosure may be applied to a container platform, where the container platform may be a container arrangement engine (kubernets) configured on a cloud server, and specifically may be an application for managing containerization on multiple hosts in a cloud platform, and a kubernets cluster may include multiple nodes (nodes), and may support automated deployment, large-scale scalable, and application containerization management, so that the application for deploying containerization may be simply and efficiently run.
The IP Address Management module may be a module for IP Address Management (IPAM), and on the container platform, the IP Address Management module may be configured to manage a container IP Address of the kubernets cluster on the container platform, and may be configured to solve important functions of container IP Address extraction, container template and IP association, IP Address allocation, and the like of the kubernets cluster.
The storage module may be a distributed, consistent storage system for sharing configuration and service discovery on the container platform, for example, the storage module may be an ETCD cluster, which is a highly available distributed Key-Value storage system that may be used to solve the problems of distributed system configuration information sharing and service discovery. The storage module may be a distributed storage system, and is mainly used to store an IP address pool preset by a user, container template information, correspondence information between an IP address and a container template, correspondence information between a service (service and/or micro service) and a container, and the like.
The kubbellet module may be a service process running on each Node (Node) in the kubernets cluster, and may be mainly used to read container template information desired by a user from the ETCD module, and then may use the container template to create a container of a number desired by the user.
Fig. 1 is a flowchart illustrating steps of a container IP address configuration method provided in an embodiment of the present disclosure, and as shown in fig. 1, the method may include:
and S101, determining a template IP binding relationship corresponding to the container template.
In the embodiment of the present disclosure, the IP address management module may determine a template IP binding relationship corresponding to the container template, where the template IP binding relationship may be pre-stored in the storage module, and the template IP binding relationship may indicate a binding relationship between the container template and an IP address. Wherein, one container template can be bound with one IP address, and one container template can also be bound with a plurality of IP addresses. For example, if the container template 1 is bound to the IP address 1, and the container template 2 is bound to the IP address 2, the IP address 3, and the IP address 4, it can be obtained that the template IP binding relationship corresponding to the container template 1 is the IP address 1, and the template IP binding relationship corresponding to the container template 2 is the IP address 2, the IP address 3, and the IP address 4.
In the embodiment of the present disclosure, the container template may be a template used for generating a container, where the container template may include a plurality of annotation (annotation) parameters, for example, the annotation parameters may include IP information (ippol), subnet mask information (Netmask), and Gateway information (Gateway), specifically, the IP information (ippol) may be IP address content and number for configuring the container template to be bindable to the container, the subnet mask information (Netmask) may be subnet mask information for configuring the container template to be bindable to the container, and the Gateway information (Gateway) may be Gateway information for configuring the container template to be bindable to the container. And S102, acquiring a target IP address for binding the container template according to the template IP binding relationship.
In the embodiment of the disclosure, the IP address corresponding to the container template for binding may be determined based on the template IP binding relationship, and the IP address management module extracts the corresponding IP address from the IP address pool, and uses the extracted IP address as the target IP address for binding the container template.
Step S103, configuring the target IP address to a virtual network card corresponding to a target container; the target container is a container created from the container template.
In the embodiment of the present disclosure, a target IP address bound to a target container may be determined by an IP address management module, the target container generated based on a container template is determined, and the target IP address is configured on a virtual network card corresponding to the target container, where the virtual network card may be a virtual ethernet module (VETH). Specifically, the IP address management module may send the IP address bound to the target container to the virtual network card, and accordingly, the virtual network card may receive and store the IP address, so that the target container may be connected to the network through the IP address later.
To sum up, the method for configuring a container IP address provided in the embodiment of the present disclosure may determine a template IP binding relationship corresponding to a container template, obtain a target IP address for binding the container template according to the template IP binding relationship, and configure the target IP address to a virtual network card corresponding to a target container, where the target container is a container created according to the container template. Therefore, the IP address corresponding to the container can be determined by determining the binding relationship between the container template and the IP address, so that the process of determining the IP address configured by the container by using a service layer can be omitted, and further, when the container fails in operation, the IP address configured by the container can be directly determined according to the binding relationship between the container template and the IP address, so that the problem that the IP address configured by the container cannot be found back due to the container failure can be avoided, and the operation stability of the container can be improved.
Optionally, before the operation of determining the template IP binding relationship corresponding to the container template in the embodiment of the present disclosure, as shown in fig. 2, the method may further include:
step S21, determining the network address information and the first number in the container template.
In the embodiment of the present disclosure, since the container template is provided with information, such as the number of IP addresses and IP address intervals that the container template can be used for binding, the IP address management module may determine, by reading the information set in the container template, network address information and a first number corresponding to the container template, where the network address information may be an interval that the container template is used for binding IP addresses, the first number may be a number of IP addresses that need to be bound, and the number may be determined according to the number of containers generated by the container template, for example, if 4 containers are generated by using the container template, it may be determined that 4 IP addresses are needed for binding the containers, and the first number is 4.
For example, if the container template 1 is provided with network address information of 192.168.1.100, 192.168.1.137, 192.168.1.205, and the first number is 3, it may be determined that the IP addresses that can be used for binding by the container template 1 are 3, which are 192.168.1.100, 192.168.1.137, 192.168.1.205, respectively. The network address information set in the container template 2 is 192.168.1.120-192.168.1.228, and the first number is 108, it can be determined that the IP addresses that the container template 2 can use for binding are 108, and may be any one of 192.168.1.120-192.168.1.228.
Step S22, according to the network address information, obtaining the first number of IP addresses from an IP address set as the target IP address.
In this embodiment of the present disclosure, the IP address management module may obtain the IP addresses from the stored IP address set according to the IP address range determined by the network address information and the first number of the IP addresses that need to be obtained, obtain a plurality of IP addresses that belong to the network address information and whose number is the first number, and use the obtained IP addresses as the target IP addresses.
And step S23, binding the target IP address with the container template to generate the template IP binding relationship.
In the embodiment of the present disclosure, the binding relationship between the target IP address and the container template may be recorded to obtain the template IP binding relationship. For example, if the obtained target IP address is 192.168.1.100, 192.168.1.137, and the target IP address is used for binding the container template 3, it may be determined that the template IP binding relationship is container template 3 and 192.168.1.100, 192.168.1.137.
It should be noted that, in the embodiment of the present disclosure, template information input by a user may also be received; and generating the container template based on the template information and storing the container template in the ETCD module.
In the embodiment of the present disclosure, a user may input template information on a client, and then the client sends the template information to the container platform, and accordingly, the container platform may receive the template information, or the user may directly input template information on the container platform, and accordingly, the container platform may receive the input template information. The template information may be information for creating a container template, and may be, for example, IP information (Ippool), subnet mask information (Netmask), Gateway information (Gateway), or the like.
In the embodiment of the present disclosure, the container template may be generated according to the template information, and the generated container template may be stored in the ETCD module. For example, the template information may include: the container type is S1, the subnet mask information is 123, the gateway information is 456, and the container name is XX, a container template may be generated according to the template information, the container template may be the container type is S1, the subnet mask information is 123, the gateway information is 456, and the container name is XX, and the generated container template may be stored in the ETCD module.
For example, in practical applications, the container template may be expressed as follows:
Figure BDA0003463341860000091
optionally, in this embodiment of the present disclosure, when the number of the target containers is greater than one, after the configuring the target IP address on the virtual network card corresponding to the target container, the method may further include:
determining a target name corresponding to the target container; and storing the corresponding relation between the target name and the allocated target IP address according to the target IP address allocated to the target container.
In the embodiment of the present disclosure, containers generated based on container templates may be used as target containers, and target names corresponding to the target containers are determined, where each container corresponds to a unique name, and the name may be used as the target name. And then, after the target IP address is configured on the virtual network card corresponding to the target container, the corresponding relation between the target name corresponding to the target container and the allocated target IP address can be stored according to the target IP address configured by the target container. For example, if the name of the target container is f78375b1c487, the name of the target container is f78375b1c487, and the target IP address configured for the target container is 192.168.1.101, a corresponding relationship between the target name f78375b1c487 and the allocated target IP address 192.168.1.101 may be established, which may be represented as f78375b1c487 — 192.168.1.101.
It should be noted that, the embodiment of the present disclosure may also create a container template in the storage module, and generate at least one target container by using the kubel module based on the container template.
In the embodiment of the present disclosure, the creating of the container template in the storage module may be creating the container template according to the attribute information for creating the container template, and storing the created container template on the ETCD module. And generating at least one target container by using the KUBELL module based on the container template, wherein the information of the created container in the container template is read first, and then the at least one target container is generated by using the KUBELL module according to the information. Specifically, the target container may be created according to container parameters set in the container template. If the container template is provided with the target number of created containers, the target containers may be created through a kubel module on each Node (Node), and the number of created target containers is not less than the target number.
Optionally, in this embodiment of the present disclosure, if a failed container occurs, the failed container may be on a node server where the container operates, and the server fails to normally improve service for a server, and the container is used as the failed container, where the method further includes:
determining a failed container template used by the failed container; and determining a fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to a virtual network card corresponding to the fault container.
In the embodiment of the present disclosure, the determining of the failed container template used by the failed container may be that, when the target container fails, the failed target container is used as the failed container, the determining of the container template used by the failed container is performed, and the container template is used as the failed container template. For example, assuming that the target container 3 is failed, the target container 3 may be regarded as a failed container, and the container template used by the target container 3 is determined to be P1, the failed container template may be determined to be P1. In the embodiment of the present disclosure, the fault IP address corresponding to the fault container template is determined according to the template IP binding relationship, so that the fault IP address is configured on the virtual network card corresponding to the fault container, where the stored template IP binding relationship is read by the IP address management module, and the fault IP address corresponding to the fault container template is determined according to the template IP binding relationship.
In the embodiment of the present disclosure, because the failed container may need to be restarted or the configured address is switched, and the like, the originally configured IP address is lost, so that the IP address configured for the failed container is determined again by the IP address management module, and the IP address is configured on the virtual network card, so that the failed container can continue to use the IP address to connect to the network, thereby ensuring that the configured IP address of the container remains unchanged after the container fails.
Optionally, in this embodiment of the present disclosure, the container platform may further include a service agent module, where the service agent module may be configured to read correspondence information between the service and the container from the storage module, and then may create a forwarding agent rule from the service to the backend container according to the correspondence information, so that the client of the user may access the backend container through service load balancing. The Service may be a Service-based Architecture (SBA) or a Microservice (Microservice). This allows outside users to have load balanced access to the backend containers through the service (service and/or microservice).
In this embodiment of the present disclosure, the method for configuring an IP address of a container may further specifically include:
and reading the corresponding relation information of the target container and the specified service from the storage module. And according to the corresponding relation information, the service agent module creates a forwarding agent rule of the specified service to the target container.
In the embodiment of the present disclosure, the storage module may store correspondence information between the target container and the specified service, and the storage module reads the correspondence information, specifically, the service agent module reads the correspondence information from the storage module, or other modules on the container platform read the correspondence information, which is not limited to this disclosure.
In the embodiment of the present disclosure, the service broker module may create a forwarding broker rule that specifies a service to a target container based on the correspondence information. For example, if the service corresponding to the target container 1 is the alert service, the forwarding agent rule created by the service agent module may be to directly access the target container 1, and the service corresponding to the target container 2 is the authentication, and the forwarding agent rule created by the service agent module may be to access the target container 4 before accessing the target container 2.
Fig. 3 is a flowchart of a container IP address configuration implemented by the present disclosure, and as shown in fig. 3, an ETCD module, a NODE server 1 and a NODE server 2 are included on a container platform, where the NODE server includes a KUBELLET module, an IP address management module, a container, and a service agent module. The specific operation can be as follows: 1. acquiring a container template from the ETCD module by the KUBELET module, and creating a container; 2. the IP address management module acquires an IP address from the ETCD module and binds one IP address for each created container; 3. the service agent module refreshes the service agent rule and stores the service agent rule in the ETCD module; 4. the micro-service accesses each container according to the service agent rule configured by the service agent module.
It should be noted that, in the container IP address configuration method provided in the embodiment of the present disclosure, the execution main body may be a container IP address configuration device, or, a control module in the container IP address configuration device, configured to execute the loading container IP address configuration method. In the embodiment of the present disclosure, a container IP address configuration device is used as an example to execute a method for configuring a loaded container IP address, and the method for configuring a container IP address provided in the embodiment of the present disclosure is described. The method for configuring the IP address of the container according to the embodiment of the present invention is described above, and the apparatus according to the embodiment of the present invention will be described below with reference to the accompanying drawings.
Fig. 4 is a block diagram of a structure of a container IP address configuration apparatus according to an embodiment of the present invention, and as shown in fig. 4, the apparatus 40 may include:
a first determining module 401, configured to determine a template IP binding relationship corresponding to a container template;
a first obtaining module 402, configured to obtain a target IP address for binding the container template according to the template IP binding relationship;
a configuration module 403, configured to configure the target IP address to a virtual network card corresponding to the target container; the target container is a container created from the container template.
To sum up, the device for configuring a container IP address provided in the embodiment of the present disclosure may determine a template IP binding relationship corresponding to a container template, obtain a target IP address for binding the container template according to the template IP binding relationship, and configure the target IP address to a virtual network card corresponding to a target container, where the target container is a container created according to the container template. Therefore, the IP address corresponding to the container can be determined by determining the binding relationship between the container template and the IP address, so that the process of determining the IP address configured by the container by using a service layer can be omitted, and further, when the container fails in operation, the IP address configured by the container can be directly determined according to the binding relationship between the container template and the IP address, so that the problem that the IP address configured by the container cannot be found back due to the container failure can be avoided, and the operation stability of the container can be improved.
Optionally, the apparatus 40 further includes:
a second determining module, configured to determine the network address information and the first number in the container template;
a second obtaining module, configured to obtain the first number of IP addresses from an IP address set according to the network address information, where the first number of IP addresses is used as the target IP address;
and the binding module is used for binding the target IP address with the container template to generate the template IP binding relationship.
Optionally, when the number of the target containers is greater than one, the apparatus 40 further includes:
a third determining module, configured to determine a target name corresponding to the target container;
and the storage module is used for storing the corresponding relation between the target name and the allocated target IP address according to the target IP address allocated by the target container.
Optionally, if a faulty container occurs, the apparatus 40 further includes:
a fourth determining module, configured to determine a failed container template used by the failed container;
and the fifth determining module is used for determining the fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to the virtual network card corresponding to the fault container.
The specific details of each module in the container IP address configuration apparatus have been described in detail in the corresponding container IP address configuration method, and therefore are not described herein again.
In an implementation manner, in an embodiment of the present disclosure, a container cluster system may further be provided, where the system may include an IP address management module and a storage module, and the system may specifically include:
the storage module is used for creating a preset number of target containers according to the stored container templates;
the IP address management module is used for determining a template IP binding relationship corresponding to the container template from the storage module;
the IP address management module is used for acquiring a target IP address for binding the container template from the storage module according to the template IP binding relationship;
and the IP address management module is used for configuring the target IP address to a virtual network card corresponding to the target container.
Optionally, when the number of the target containers is greater than one, after the allocating the target IP address to the virtual network card corresponding to the target container, the method may further include:
the IP address management module is configured to determine a target name corresponding to the target container, and store a correspondence between the target name and the allocated target IP address in the storage module.
Optionally, if a faulty container occurs, the system may further include:
and the IP address management module is used for determining a fault container template used by the fault container and determining a fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to a virtual network card corresponding to the fault container.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 500 according to this embodiment of the disclosure is described below with reference to fig. 5. The electronic device 500 shown in fig. 5 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: the at least one processing unit 510, the at least one memory unit 520, a bus 530 connecting the various system components (including the memory unit 520 and the processing unit 510), and a display unit 540.
Wherein the storage unit stores program code that is executable by the processing unit 510 to cause the processing unit 510 to perform steps according to various exemplary embodiments of the present disclosure as described in the above section "exemplary methods" of this specification. For example, the processing unit 510 may execute step S101 shown in fig. 1, determine a template IP binding relationship corresponding to the container template; step S102, acquiring a target IP address for binding the container template according to the template IP binding relationship; step S103, configuring the target IP address to a virtual network card corresponding to a target container; the target container is a container created from the container template.
The memory unit 520 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)5201 and/or a cache memory unit 5202, and may further include a read only memory unit (ROM) 5203.
Storage unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may be one or more of any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 600 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 500, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 550. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 560. As shown, the network adapter 560 communicates with the other modules of the electronic device 500 over the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
According to the program product for implementing the above method of the embodiments of the present disclosure, it may employ a portable compact disc read only memory (CD-ROM) and include program codes, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (11)

1. A method for configuring an IP address of a container, the method comprising:
determining a template IP binding relationship corresponding to the container template;
acquiring a target IP address for binding the container template according to the template IP binding relationship;
configuring the target IP address to a virtual network card corresponding to a target container; the target container is a container created from the container template.
2. The method according to claim 1, wherein before the determining the template IP binding relationship corresponding to the container template, the method further comprises:
determining network address information and a first number in the container template;
acquiring the first number of IP addresses from an IP address set as the target IP address according to the network address information;
and binding the target IP address with the container template to generate the template IP binding relationship.
3. The method according to claim 2, wherein when the number of the target containers is greater than one, after the configuring the target IP address on the virtual network card corresponding to the target container, the method further comprises:
determining a target name corresponding to the target container;
and storing the corresponding relation between the target name and the allocated target IP address according to the target IP address allocated to the target container.
4. The method of claim 1, wherein if a faulty container occurs, the method further comprises:
determining a failed container template used by the failed container;
and determining a fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to a virtual network card corresponding to the fault container.
5. An apparatus for configuring an IP address of a container, the apparatus comprising:
the first determining module is used for determining the template IP binding relationship corresponding to the container template;
the first acquisition module is used for acquiring a target IP address for binding the container template according to the template IP binding relationship;
the configuration module is used for configuring the target IP address to a virtual network card corresponding to a target container; the target container is a container created from the container template.
6. The apparatus of claim 5, further comprising:
a second determining module, configured to determine the network address information and the first number in the container template;
a second obtaining module, configured to obtain the first number of IP addresses from an IP address set according to the network address information, where the first number of IP addresses is used as the target IP address;
and the binding module is used for binding the target IP address with the container template to generate the template IP binding relationship.
7. The apparatus of claim 6, wherein when the number of target containers is greater than one, the apparatus further comprises:
a third determining module, configured to determine a target name corresponding to the target container;
and the storage module is used for storing the corresponding relation between the target name and the allocated target IP address according to the target IP address allocated by the target container.
8. The apparatus of claim 5, wherein in the event of a failed container, the apparatus further comprises:
a fourth determining module, configured to determine a failed container template used by the failed container;
and the fifth determining module is used for determining the fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to the virtual network card corresponding to the fault container.
9. A container cluster system, the system comprising an IP address management module, a storage module, the system comprising:
the storage module is used for creating a preset number of target containers according to the stored container templates;
the IP address management module is used for determining a template IP binding relationship corresponding to the container template from the storage module;
the IP address management module is used for acquiring a target IP address for binding the container template from the storage module according to the template IP binding relationship;
and the IP address management module is used for configuring the target IP address to a virtual network card corresponding to the target container.
10. The system according to claim 9, wherein when the number of the target containers is greater than one, after the allocating the target IP address to the virtual network card corresponding to the target container, the method further comprises:
the IP address management module is configured to determine a target name corresponding to the target container, and store a correspondence between the target name and the allocated target IP address in the storage module.
11. The system of claim 9, wherein if a faulty container occurs, the system further comprises:
and the IP address management module is used for determining a fault container template used by the fault container and determining a fault IP address corresponding to the fault container template according to the template IP binding relationship so as to configure the fault IP address to a virtual network card corresponding to the fault container.
CN202210022924.6A 2022-01-10 2022-01-10 Container IP address configuration method and device, storage medium and electronic equipment Pending CN114371914A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210022924.6A CN114371914A (en) 2022-01-10 2022-01-10 Container IP address configuration method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210022924.6A CN114371914A (en) 2022-01-10 2022-01-10 Container IP address configuration method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114371914A true CN114371914A (en) 2022-04-19

Family

ID=81144825

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210022924.6A Pending CN114371914A (en) 2022-01-10 2022-01-10 Container IP address configuration method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114371914A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002069A (en) * 2022-06-24 2022-09-02 中国电信股份有限公司 Port mapping method and device, electronic equipment and storage medium
CN116016438A (en) * 2022-12-12 2023-04-25 上海道客网络科技有限公司 Method and system for uniformly distributing IP addresses by multiple subnets based on container cloud platform

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002069A (en) * 2022-06-24 2022-09-02 中国电信股份有限公司 Port mapping method and device, electronic equipment and storage medium
CN115002069B (en) * 2022-06-24 2023-10-31 中国电信股份有限公司 Port mapping method, device, electronic equipment and storage medium
CN116016438A (en) * 2022-12-12 2023-04-25 上海道客网络科技有限公司 Method and system for uniformly distributing IP addresses by multiple subnets based on container cloud platform
CN116016438B (en) * 2022-12-12 2023-08-15 上海道客网络科技有限公司 Method and system for uniformly distributing IP addresses by multiple subnets based on container cloud platform

Similar Documents

Publication Publication Date Title
US9413604B2 (en) Instance host configuration
US20180101371A1 (en) Deployment manager
CN108961033B (en) Multi-service system interaction method and device, storage medium and electronic terminal
US11063815B2 (en) Building and fixing a dynamic application topology in a cloud based environment leveraging log file data
CN107729176B (en) Disaster recovery method and disaster recovery system for configuration file management system
WO2023024629A1 (en) Service access across kubernetes clusters
CN114371914A (en) Container IP address configuration method and device, storage medium and electronic equipment
US20140207919A1 (en) Instance configuration on remote platforms
US10223218B2 (en) Disaster recovery of managed systems
WO2019223136A1 (en) Data acquisition method and apparatus, and computer device and storage medium
CN111414391A (en) Method and system for accessing multiple data sources
US11636139B2 (en) Centralized database system with geographically partitioned data
CN115795211A (en) Page display method, device, system, equipment and storage medium
CN114911518A (en) Cloud function application release management method, system, equipment and storage medium
US11645109B2 (en) Managing failures in edge computing environments
US11200049B2 (en) Automated test authorization management
US11422791B2 (en) Upgrading a sequence of microservices in a cloud computing environment
CN116264538A (en) Data processing method, device, equipment and computer storage medium
CN115048060A (en) Storage management method and device, electronic equipment and storage medium
US11106551B1 (en) Compute capacity reservations for disaster recovery scenarios
CN115485677A (en) Secure data replication in a distributed data storage environment
WO2024055741A1 (en) Method and apparatus for establishing network connection, electronic device and storage medium
US20230394062A1 (en) Data replication in an active-active databases
US11847027B2 (en) Automated configuration conflict resolution and lightweight restoration
CN115484149B (en) Network switching method, network switching device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination