Method, device and storage medium for implementing communication between Kubernetes and OpenStack
By configuring open virtual network service ports in the Kubernetes cluster and modifying the network components and parameters of the OpenStack cluster, the network isolation problem between Kubernetes and OpenStack was solved, achieving efficient interconnection and resource sharing, and improving network performance and security.
Patent Information
- Application Number
- CN202311854279.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2043-12-29
AI Technical Summary
Kubernetes and OpenStack face network isolation issues in the same physical environment, leading to increased management complexity and performance bottlenecks, making it difficult for existing technologies to achieve efficient interoperability.
Configure the service port of the open virtual network in the Kubernetes cluster, deploy the OpenStack cluster and shut down the Open vSwitch service, modify the Neutron configuration file of the OpenStack cluster network component and the network parameters of the compute nodes, detect resource information and create a resource subnet to achieve interconnection.
It enables seamless communication between Kubernetes and OpenStack, improves network performance and resource sharing, provides a flexible, high-performance and secure network solution, and overcomes network isolation and configuration complexity issues.
Smart Images

Figure CN118381733B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud computing, and particularly relates to a method and device for realizing communication between Kubernetes and OpenStack, equipment and storage medium. BACKGROUND
[0002] With the rapid development of cloud computing and container technology, enterprises and organizations increasingly rely on these platforms to manage and deploy applications and network services. Kubernetes, as a popular container orchestration tool, provides powerful container orchestration and management functions, while OpenStack, as a cloud infrastructure management platform, provides support for the management and allocation of virtualized resources.
[0003] Currently, the deployment of OpenStack has realized the use of Kubernetes as a base platform. Although OpenStack and Kubernetes are in the same physical environment, they are usually operated in independent environments, resulting in network isolation between the two. To solve the network isolation, the existing technology needs complex configuration and management to realize the network interconnection between the two platforms, which not only increases the management complexity, but also may cause performance bottlenecks and security problems. SUMMARY
[0004] The present application provides a method and device for realizing communication between Kubernetes and OpenStack, equipment and storage medium, to solve the defect of network isolation between Kubernetes and OpenStack in the prior art, and to realize the technical effect of interconnection and intercommunication between OpenStack and Kubernetes.
[0005] The present application provides a method for realizing communication between Kubernetes and OpenStack, comprising:
[0006] creating a Kubernetes cluster and configuring a service port for an open virtual network in the Kubernetes cluster;
[0007] deploying an OpenStack cluster in the Kubernetes cluster and closing the Open vSwitch service in the OpenStack cluster; wherein the OpenStack cluster includes a first control node and a first compute node;
[0008] obtaining network service information of the open virtual network of the Kubernetes cluster;
[0009] modifying a configuration file of a network component Neutron in the first control node according to the network service information, and modifying network parameters in the first computing node for the open virtual network;
[0010] detecting whether first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detecting whether second resource information about the OpenStack cluster is received in the Kubernetes cluster;
[0011] if both are received, creating a resource subnet Subnet in the Kubernetes cluster according to the second resource information, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
[0012] According to the method for realizing communication between Kubernetes and OpenStack provided by the application, the method for modifying the configuration file of the network component Neutron in the first control node according to the network service information comprises the following steps:
[0013] modifying port information in the configuration file for the open virtual network to port information recorded in the network service information; wherein the port information recorded in the network service information comprises port information of NodePort ports of ovn-controller, ovn-nb and ovn-sb;
[0014] restarting a neutron-server service of the network component Neutron.
[0015] According to the method for realizing communication between Kubernetes and OpenStack provided by the application, the method for modifying the network parameters in the first computing node for the open virtual network comprises the following steps:
[0016] modifying an ovn-remote parameter in the first computing node to an address and a port number of an ovn-central node in the Kubernetes cluster through an ovs-vsctl command; and
[0017] modifying an ovn-encap-type parameter in the first computing node to an ovn network protocol of the Kubernetes cluster; and
[0018] modifying an ovn-encap-ip parameter in the first computing node to an ovn-central node ip of the Kubernetes cluster.
[0019] According to the method for realizing communication between Kubernetes and OpenStack provided by the application, the detection of whether the first resource information about the Kubernetes cluster is received in the OpenStack cluster comprises:
[0020] In the OpenStack cluster, whether the ovn0 network card resource information used by the Kubernetes cluster is received is inquired through an ovs-vsctl show command.
[0021] According to the method for realizing communication between Kubernetes and OpenStack provided by the application, the detection of whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster comprises:
[0022] In the Kubernetes cluster, whether the OpenStack network information named neutron reported in the form of VPC resource is received is detected.
[0023] According to the method for realizing communication between Kubernetes and OpenStack provided by the application, after the resource subnet Subnet is created in the Kubernetes cluster according to the second resource information, the method further comprises:
[0024] A test Pod and a test virtual machine are created.
[0025] The network connectivity of the Kubernetes cluster and the OpenStack cluster is detected through the test Pod and the test virtual machine.
[0026] According to the method for realizing communication between Kubernetes and OpenStack provided by the application, after the detection of whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster, the method further comprises:
[0027] If either of the following conditions is met: the first resource information is not received in the OpenStack cluster and the second resource information is not received in the Kubernetes cluster, the step of creating a Kubernetes cluster is jumped to execute.
[0028] The application further provides a device for realizing communication between Kubernetes and OpenStack, comprising:
[0029] A first creation module is configured to create a Kubernetes cluster and configure a service port for an open virtual network in the Kubernetes cluster.
[0030] a deployment module configured to deploy an OpenStack cluster in the Kubernetes cluster and close an Open vSwitch service in the OpenStack cluster, wherein the OpenStack cluster comprises a first control node and a first compute node;
[0031] an acquisition module configured to acquire network service information of the open virtual network of the Kubernetes cluster;
[0032] a modification module configured to modify a configuration file of a network component Neutron in the first control node according to the network service information, and modify network parameters for the open virtual network in the first compute node;
[0033] a first detection module configured to detect whether first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detect whether second resource information about the OpenStack cluster is received in the Kubernetes cluster;
[0034] a second creation module configured to create a resource subnet Subnet in the Kubernetes cluster according to the second resource information if both are received, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
[0035] The application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for realizing communication between Kubernetes and OpenStack according to any one of the above methods when executing the program.
[0036] The application further provides a non-transitory computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the method for realizing communication between Kubernetes and OpenStack according to any one of the above methods.
[0037] The application further provides a computer program product, which comprises a computer program, wherein the computer program is executed by a processor to implement the method for realizing communication between Kubernetes and OpenStack according to any one of the above methods.
[0038] The application provides a method, device, equipment and storage medium for realizing communication between Kubernetes and OpenStack, which creates a Kubernetes cluster, configures a service port for an open virtual network in the Kubernetes cluster, realizes network communication of the Kubernetes cluster through the open virtual network, deploys an OpenStack cluster in the Kubernetes cluster, and closes an Open vSwitch service in the OpenStack cluster to avoid network service conflict. According to network service information of the open virtual network of the Kubernetes cluster, a configuration file of a network component Neutron in a first control node of the OpenStack cluster is modified, and network parameters for the open virtual network in a first computing node of the OpenStack cluster are modified, so that the OpenStack cluster can simultaneously use the development virtual network foundation of the Kubernetes cluster. Whether first resource information about the Kubernetes cluster is received in the OpenStack cluster and whether second resource information about the OpenStack cluster is received in the Kubernetes cluster is detected, and configuration of the Kubernetes cluster and the OpenStack cluster is ensured to be successful. After the corresponding resource information is received, it is determined that the configuration is successful. Finally, a resource subnet Subnet is created in the Kubernetes cluster according to the second resource information, so that a container using the resource subnet Subnet in the Kubernetes cluster will be in the same network plane as a virtual machine of the OpenStack cluster, thereby realizing interconnection and intercommunication between the OpenStack cluster and the Kubernetes cluster, and overcoming the network isolation problem between the OpenStack and the Kubernetes in the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0040] Figure 1 is one of the flowcharts of the method for realizing communication between Kubernetes and OpenStack provided by the application;
[0041] Figure 2 is a structural schematic diagram of the Kubernetes cluster and the OpenStack cluster provided by the application;
[0042] Figure 3 is one of flowcharts of step 140 in the embodiments provided by the present application;
[0043] Figure 4 is another flowchart of step 140 in the embodiments provided by the present application;
[0044] Figure 5 is another flowchart of the method for realizing communication between Kubernetes and OpenStack provided by the present application;
[0045] Figure 6 is a structural schematic diagram of the device for realizing communication between Kubernetes and OpenStack provided by the present application;
[0046] Figure 7 is a structural schematic diagram of the electronic device provided by the present application. DETAILED DESCRIPTION
[0047] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.
[0048] The method for realizing communication between Kubernetes and OpenStack provided by the present application will be described below. Figures 1-5
[0049] Figure 1 is a flowchart of a method for realizing communication between Kubernetes and OpenStack according to an exemplary embodiment. As shown in Figure 1 the method for realizing communication between Kubernetes and OpenStack, includes steps 110 to 160, which are described in detail as follows:
[0050] Step 110, creating a Kubernetes cluster, and configuring a service port for an open virtual network in the Kubernetes cluster.
[0051] In the embodiments of the present application, the Kubernetes cluster is created, please refer to Figure 2 , a corresponding second control node and a second computing node are included in the Kubernetes cluster. The second control node and the second computing node can be physical servers or virtual machines, which implement a Kubernetes containerized environment. The second control node is used for control management of the Kubernetes cluster, and the second computing node is used for running business pods in the Kubernetes cluster.
[0052] The second control node includes a VPC (Virtual Private Cloud), a Subnet and an OVN, and the second computing node includes an OVSDB (Open vSwitch Database) and a Pod.
[0053] The container network in the Kubernetes cluster adopts an open virtual network (OVN) plug-in, and service ports of services such as ovn-controller, ovn-nb and ovn-sb are configured in the Kubernetes cluster through a NodePort mode, so as to realize efficient network communication.
[0054] In step 120, an OpenStack cluster is deployed in the Kubernetes cluster, and an Open vSwitch service in the OpenStack cluster is closed. The OpenStack cluster includes a first control node and a first computing node.
[0055] In the embodiment of the application, in the Kubernetes cluster, the OpenStack cluster is deployed in a containerized manner, and the OpenStack cluster is responsible for management and virtualization of cloud resources and is used for deployment of virtual machines and network services. Deployment of the Kubernetes cluster and the OpenStack cluster will provide infrastructure between the Kubernetes and the OpenStack. The OpenStack cluster includes a first control node and a first computing node. The first control node is used for management control of the OpenStack cluster, and the first computing node is used for running virtual machines. The first control node includes a Neutron, a network and a Subnet, and the first computing node includes an OVSDB and a VM (Virtual Machine).
[0056] In the OpenStack cluster, the Open vSwitch (OVS) service in the OpenStack is closed to avoid the conflict between the two network services after the OVN network of the Kubernetes cluster deployed in the OpenStack cluster. The OVS is a high-quality, multi-layer virtual switch software which can support large-scale network automation through programming extension, and also supports standard management interface and protocol.
[0057] In step 130, the network service information of the OVN of the Kubernetes cluster is acquired.
[0058] In the embodiment of the present application, in the Kubernetes cluster, the network service information of the OVN is acquired, including the NodePort port of the services such as ovn-controller, ovn-nb and ovn-sb.
[0059] In step 140, according to the network service information, the configuration file of the network component Neutron in the first control node is modified, and the network parameter of the OVN in the first computing node is modified.
[0060] In the embodiment of the present application, the configuration file of the network component Neutron of the first control component in the OpenStack cluster is modified, and the network parameter of the OVN in the first computing node is modified, so that the network component is configured to use the OVN network substrate in the Kubernetes cluster. To ensure that the containerized environment of the Kubernetes cluster and the virtualized environment of the OpenStack cluster can communicate seamlessly.
[0061] In step 150, whether the first resource information about the Kubernetes cluster is received in the OpenStack cluster is detected, and whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster is detected.
[0062] In the embodiment of the present application, after the OVN is configured in the OpenStack cluster and the Kubernetes cluster, whether the configuration is successful is detected in the OpenStack cluster and the Kubernetes cluster respectively. When the configuration is successful, the first resource information about the Kubernetes cluster is detected in the OpenStack cluster, and the second resource information about the OpenStack cluster is detected in the Kubernetes cluster.
[0063] In step 160, if the second resource information is received, a resource subnet Subnet is created in the Kubernetes cluster according to the second resource information, so that communication is realized between the OpenStack cluster and the Kubernetes cluster.
[0064] In the embodiment of the present application, when the first resource information about the Kubernetes cluster is detected in the OpenStack cluster, and the second resource information about the OpenStack cluster is detected in the Kubernetes cluster, it indicates that the configuration for the OVN in the OpenStack cluster and the Kubernetes cluster is successful. Then, the resource subnet Subnet is created according to the second resource information. The containers using the Subnet in the Kubernetes cluster will be in the same network plane as the virtual machines of the OpenStack cluster, so that the interconnection and intercommunication between the OpenStack cluster and the Kubernetes cluster are realized.
[0065] In the embodiment of the present application, the Kubernetes cluster is created, and the service port for the open virtual network is configured in the Kubernetes cluster, so as to realize network communication through the open virtual network. The OpenStack cluster is deployed in the Kubernetes cluster, and the Open vSwitch service in the OpenStack cluster is closed to avoid network service conflict. Then, the configuration file of the network component Neutron in the first control node of the OpenStack cluster is modified according to the network service information of the open virtual network of the Kubernetes cluster, and the network parameter for the open virtual network in the first compute node of the OpenStack cluster is modified, so that the OpenStack cluster can simultaneously use the development virtual network substrate of the Kubernetes cluster. Whether the first resource information about the Kubernetes cluster is received in the OpenStack cluster and whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster is detected, so as to ensure that the configuration of the Kubernetes cluster and the configuration of the OpenStack cluster are successful. After the corresponding resource information is received, it is determined that the configuration is successful. Finally, the resource subnet Subnet is created in the Kubernetes cluster according to the second resource information, so that the container using the resource subnet Subnet in the Kubernetes cluster will be in the same network plane as the virtual machine of the OpenStack cluster, thereby realizing the interconnection and intercommunication between the OpenStack cluster and the Kubernetes cluster, sharing network resources, and obtaining high-performance network connection. The open virtual network provides a virtualized network layer, connects the container of Kubernetes and the virtual machine of OpenStack to the physical network, and provides a highly scalable network solution, which overcomes the problems of network isolation, configuration complexity and resource sharing in the prior art. Through the technical scheme provided in the embodiment of the present application, network intercommunication between Kubernetes and OpenStack can be realized, network performance, resource sharing and security are improved, and a more flexible, high-performance and secure network solution is provided for the cloud computing environment.
[0066] In an example embodiment of the present application, please refer to Figure 3 In step 140, modifying the configuration file of the network component Neutron in the first control node according to the network service information includes steps 310 to 320, which are described in detail as follows:
[0067] Step 310, modify the port information in the configuration file for the open virtual network to the port information recorded in the network service information; wherein the port information recorded in the network service information includes the port information of the NodePort port of the ovn-controller, ovn-nb and ovn-sb.
[0068] In the embodiment of the application, in the first control node of the OpenStack cluster, the port information in the configuration file of the network component Neutron for the open virtual network is modified to the port information recorded in the network service information, that is, the related content of the open virtual network in the configuration file is modified to the port information of the NodePort port of the ovn-controller, ovn-nb and ovn-sb of the Kubernetes cluster.
[0069] Step 320, restart the neutron-server service of the network component Neutron.
[0070] In the embodiment of the application, after the modification is completed, the neutron-server service of the network component Neutron is restarted, so that the restarted Neutron is configured to use the OVN network foundation of the Kubernetes cluster. The neutron-server service is the main service process of the network component Neutron, which can provide the OpenStack network API externally as an access entrance of Neutron, collect the request, call the plugin for processing, and finally complete the request by various agents in the first computing node.
[0071] In an exemplary embodiment of the application, please refer to Figure 4 The modification of the network parameter in the first computing node for the open virtual network in step 140 includes steps 410 to 430, which are described in detail as follows:
[0072] Step 410, modify the ovn-remote parameter in the first computing node to the address and port number of the ovn-central node in the Kubernetes cluster by the ovs-vsctl command.
[0073] In the embodiment of the application, in the first computing node of the OpenStack cluster, the service address of the ovn is modified by the ovs-vsctl command, and the ovn-remote parameter in the first computing node is modified to the address and port number of the ovn-central node of the Kubernetes cluster.
[0074] Step 420, modify the ovn-encap-type parameter in the first computing node to the ovn network protocol of the Kubernetes cluster.
[0075] In the embodiment of the application, the protocol type of the first computing node is modified, that is, the ovn-encap-type parameter in the first computing node is modified to be consistent with the ovn network protocol in the Kubernetes cluster.
[0076] Step 430, modify the ovn-encap-ip parameter in the first computing node to the ovn-central node ip of the Kubernetes cluster.
[0077] In the embodiment of the application, the ovn-encap-ip parameter in the first computing node is modified to the ovn-central node ip in the Kubernetes cluster.
[0078] In the embodiment of the application, through the modification of the above steps 410 to 430, the configuration of the OVN in the first computing node is realized.
[0079] In an exemplary embodiment of the application, the detection of whether the first resource information about the Kubernetes cluster is received in the OpenStack cluster in step 150 includes the following steps, which are described in detail as follows:
[0080] In the OpenStack cluster, whether the ovn0 network card resource information used by the Kubernetes cluster is queried through the ovs-vsctl show command.
[0081] In the embodiment of the application, in the OpenStack cluster, the related network resources are checked to determine whether the configuration of the OpenStack cluster for the OVN is successful. Specifically, when the configuration is successful, the subnet resource is queried, and the network of the Kubernetes cluster can be seen. Therefore, through the ovs-vsctl show command query, when it is detected that the ovn0 network card resource information used by the Kubernetes cluster can be queried, it can be determined that the configuration of the OpenStack cluster end for the OVN is successful.
[0082] In an exemplary embodiment of the application, the detection of whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster in step 150 includes the following steps, which are described in detail as follows:
[0083] In the Kubernetes cluster, it is detected whether the OpenStack network information named neutron reported in the form of VPC resources is received.
[0084] In the embodiment of the present application, in the Kubernetes cluster, if the configuration of the Kubernetes cluster for the OVN succeeds, the VPC resources are queried, and the OpenStack network information named neutron reported in the form of VPC resources to the Kubernetes cluster side can be queried. Therefore, whether the configuration of the Kubernetes cluster for the OVN succeeds can be determined by detecting whether the OpenStack network information named neutron reported in the form of VPC resources is received.
[0085] In an exemplary embodiment of the present application, please refer to Figure 5 After the step 160 of creating the resource subnet Subnet in the Kubernetes cluster according to the second resource information, the method further includes steps 510 to 520, which are described in detail as follows:
[0086] Step 510, create a test Pod and a test virtual machine;
[0087] In the embodiment of the present application, the test Pod and the test virtual machine are created based on the ping test.
[0088] Step 520, detect the network connectivity of the Kubernetes cluster and the OpenStack cluster through the test Pod and the test virtual machine.
[0089] In the embodiment of the present application, the network connectivity of the Kubernetes cluster is detected through the test Pod, and the network connectivity of the OpenStack cluster is detected through the test virtual machine, so as to ensure the normal operation of the Kubernetes cluster and the OpenStack cluster.
[0090] In an exemplary embodiment of the present application, after the step 150 of detecting whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster, the method further includes the following steps, which are described in detail as follows:
[0091] If either of the first resource information is not received in the OpenStack cluster and the second resource information is not received in the Kubernetes cluster is true, jump to execute the step of creating a Kubernetes cluster.
[0092] In the examples of the present application, if the first resource information is not received in the OpenStack cluster and / or the second resource information is not received in the Kubernetes cluster, it indicates that the configuration of the OpenStack cluster or the Kubernetes cluster for the OVN is not successful, and the step of creating the Kubernetes cluster is jumped to for reconfiguration. In other embodiments of the present application, when the configuration of the OpenStack cluster or the Kubernetes cluster for the OVN is not successful, the failure reason for the unsuccessful configuration is further analyzed, and the reconfiguration is performed according to the failure reason.
[0093] The device for realizing the communication between the Kubernetes and the OpenStack provided by the present application is described below, and the device for realizing the communication between the Kubernetes and the OpenStack described below can be correspondingly referred to the method for realizing the communication between the Kubernetes and the OpenStack described above. It should be noted that the device provided by the embodiments below and the method provided by the above embodiments belong to the same concept, and the specific manner in which each module and unit performs operations has been described in detail in the method embodiments, which will not be described here.
[0094] In an example embodiment of the present application, please refer to Figure 6 , Figure 6 The device for realizing the communication between the Kubernetes and the OpenStack according to an example embodiment is shown in FIG. 6, which comprises:
[0095] The first creation module 610 is configured to create a Kubernetes cluster and configure a service port for an open virtual network in the Kubernetes cluster;
[0096] The deployment module 620 is configured to deploy an OpenStack cluster in the Kubernetes cluster and close the Open vSwitch service in the OpenStack cluster; wherein the OpenStack cluster comprises a first control node and a first computing node;
[0097] The acquisition module 630 is configured to acquire network service information of the open virtual network of the Kubernetes cluster;
[0098] The modification module 640 is configured to modify the configuration file of the network component Neutron in the first control node and modify the network parameter for the open virtual network in the first computing node according to the network service information;
[0099] The first detection module 650 is configured to detect whether the first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detect whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster.
[0100] The second creation module 660 is configured to create a resource subnet Subnet in the Kubernetes cluster according to the second resource information if both are received, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
[0101] In an example embodiment of the present application, the modification module 640 comprises:
[0102] The first modification submodule is configured to modify the port information of the open virtual network in the configuration file to the port information recorded in the network service information; wherein the port information recorded in the network service information comprises the port information of the NodePort port of the ovn-controller, the ovn-nb and the ovn-sb.
[0103] The restart submodule is configured to restart the neutron-server service of the network component Neutron.
[0104] In an example embodiment of the present application, the modification module 640 comprises:
[0105] The second modification submodule is configured to modify the ovn-remote parameter in the first computing node to the address and port number of the ovn-central node in the Kubernetes cluster through the ovs-vsctl command; and
[0106] The third modification submodule is configured to modify the ovn-encap-type parameter in the first computing node to the ovn network protocol of the Kubernetes cluster; and
[0107] The fourth modification submodule is configured to modify the ovn-encap-ip parameter in the first computing node to the ovn-central node ip of the Kubernetes cluster.
[0108] In an example embodiment of the present application, the first detection module 650 comprises:
[0109] The query submodule is configured to query, in the OpenStack cluster, whether the ovs-vsctl show command receives the ovn0 network card resource information used by the Kubernetes cluster.
[0110] In an example embodiment of the present application, the first detection module 650 includes:
[0111] The detection submodule is configured to detect, in the Kubernetes cluster, whether the OpenStack network information named neutron in the form of VPC resource is received.
[0112] In an example embodiment of the present application, the device for realizing communication between Kubernetes and OpenStack further includes:
[0113] The third creation module is configured to create a test Pod and a test virtual machine.
[0114] The second detection module is configured to detect network connectivity of the Kubernetes cluster and the OpenStack cluster through the test Pod and the test virtual machine.
[0115] In an example embodiment of the present application, the device for realizing communication between Kubernetes and OpenStack further includes:
[0116] The jump module is configured to jump to execute the step of creating a Kubernetes cluster if either of the following conditions is met: the first resource information is not received in the OpenStack cluster and the second resource information is not received in the Kubernetes cluster.
[0117] Figure 7 An example of an entity structure diagram of an electronic device is shown in Figure 7 As shown, the electronic device can include a processor 710, a communications interface 720, a memory 730, and a communications bus 740, wherein the processor 710, the communications interface 720, and the memory 730 complete mutual communication through the communications bus 740. The processor 710 can invoke a logical instruction in the memory 730 to execute a method for realizing communication between Kubernetes and OpenStack, which includes:
[0118] Creating a Kubernetes cluster and configuring a service port for an open virtual network in the Kubernetes cluster;
[0119] deploying an OpenStack cluster in the Kubernetes cluster and shutting down an Open vSwitch service in the OpenStack cluster; wherein the OpenStack cluster comprises a first control node and a first compute node;
[0120] obtaining network service information of the Open virtual network of the Kubernetes cluster;
[0121] modifying a configuration file of a network component Neutron in the first control node according to the network service information, and modifying network parameters for the Open virtual network in the first compute node;
[0122] detecting whether first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detecting whether second resource information about the OpenStack cluster is received in the Kubernetes cluster;
[0123] if both are received, creating a resource subnet Subnet in the Kubernetes cluster according to the second resource information, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
[0124] In addition, the logical instructions in the memory 730 described above can be implemented in the form of a software functional unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can 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. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0125] On the other hand, the present application also provides a computer program product, the computer program product comprising a computer program, the computer program being stored on a non-transitory computer readable storage medium, and the computer program being executable by a processor to cause a computer to perform the method for realizing communication between Kubernetes and OpenStack, the method comprising:
[0126] create a Kubernetes cluster, and configure a service port for an open virtual network in the Kubernetes cluster;
[0127] deploy an OpenStack cluster in the Kubernetes cluster, and close an Open vSwitch service in the OpenStack cluster; wherein the OpenStack cluster comprises a first control node and a first compute node;
[0128] obtain network service information of the open virtual network of the Kubernetes cluster;
[0129] modify a configuration file of a network component Neutron in the first control node according to the network service information, and modify network parameters for the open virtual network in the first compute node;
[0130] detect whether first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detect whether second resource information about the OpenStack cluster is received in the Kubernetes cluster;
[0131] if both are received, create a resource subnet Subnet in the Kubernetes cluster according to the second resource information, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
[0132] In another aspect, the application further provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the method for realizing communication between Kubernetes and OpenStack provided by the above-mentioned methods, and the method comprises:
[0133] create a Kubernetes cluster, and configure a service port for an open virtual network in the Kubernetes cluster;
[0134] deploy an OpenStack cluster in the Kubernetes cluster, and close an Open vSwitch service in the OpenStack cluster; wherein the OpenStack cluster comprises a first control node and a first compute node;
[0135] obtain network service information of the open virtual network of the Kubernetes cluster;
[0136] According to the network service information, a configuration file of a network component Neutron in the first control node is modified, and network parameters in the first computing node for the open virtual network are modified;
[0137] It is detected whether first resource information about the Kubernetes cluster is received in the OpenStack cluster, and whether second resource information about the OpenStack cluster is received in the Kubernetes cluster;
[0138] If both are received, a resource subnet Subnet is created in the Kubernetes cluster according to the second resource information, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
[0139] The apparatus embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0140] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and necessary general hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0141] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for enabling communication between Kubernetes and OpenStack, the method comprising: The method comprises the following steps: creating a Kubernetes cluster and configuring a service port for an open virtual network in the Kubernetes cluster; deploying an OpenStack cluster in the Kubernetes cluster and shutting down an OpenvSwitch service in the OpenStack cluster; wherein the OpenStack cluster comprises a first control node and a first compute node; obtaining network service information of the open virtual network of the Kubernetes cluster; modifying a configuration file of a network component Neutron in the first control node according to the network service information, and modifying network parameters for the open virtual network in the first compute node; detecting whether first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detecting whether second resource information about the OpenStack cluster is received in the Kubernetes cluster; if both are received, creating a resource subnet Subnet in the Kubernetes cluster according to the second resource information, so as to realize communication between the OpenStack cluster and the Kubernetes cluster. 2.The method for realizing communication between Kubernetes and OpenStack according to claim 1, wherein, The method further comprises the following steps: modifying port information for the open virtual network in the configuration file to port information recorded in the network service information; wherein the port information recorded in the network service information comprises port information of NodePort ports of ovn-controller, ovn-nb and ovn-sb; restarting a neutron-server service of the network component Neutron. 3.The method for realizing communication between Kubernetes and OpenStack according to claim 1, wherein, The method further comprises the following steps: modifying an ovn-remote parameter in the first compute node to an address and a port number of an ovn-central node in the Kubernetes cluster through an ovs-vsctl command; and modifying an ovn-encap-type parameter in the first compute node to an ovn network protocol of the Kubernetes cluster; and modifying an ovn-encap-ip parameter in the first compute node to an ovn-central node ip of the Kubernetes cluster. 4.The method for realizing communication between Kubernetes and OpenStack according to claim 1, wherein, The method further comprises the following steps: in the OpenStack cluster, querying whether ovn0 network card resource information used by the Kubernetes cluster is received through an ovs-vsctl show command. 5.The method for realizing communication between Kubernetes and OpenStack according to claim 1, wherein, The method further comprises the following steps: In the Kubernetes cluster, it is detected whether the OpenStack network information named neutron reported in the form of VPC resource is received.
6. The method for enabling Kubernetes and OpenStack communication according to any one of claims 1 to 5, wherein, After the resource subnet Subnet is created in the Kubernetes cluster according to the second resource information, the method further comprises: A test Pod and a test virtual machine are created. Network connectivity of the Kubernetes cluster and the OpenStack cluster is detected through the test Pod and the test virtual machine.
7. The method for enabling Kubernetes and OpenStack communication according to any one of claims 1 to 5, wherein, After the detection of whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster, the method further comprises: If either the first resource information is not received in the OpenStack cluster or the second resource information is not received in the Kubernetes cluster, the step of creating a Kubernetes cluster is executed.
8. An apparatus for enabling communication between Kubernetes and OpenStack, the apparatus comprising: Comprise: The first creation module is configured to create a Kubernetes cluster and configure a service port for an open virtual network in the Kubernetes cluster; The deployment module is configured to deploy an OpenStack cluster in the Kubernetes cluster and close the Open vSwitch service in the OpenStack cluster; wherein the OpenStack cluster comprises a first control node and a first compute node; The acquisition module is configured to acquire network service information of the open virtual network of the Kubernetes cluster; The modification module is configured to modify a configuration file of a network component Neutron in the first control node according to the network service information, and modify network parameters for the open virtual network in the first compute node; The first detection module is configured to detect whether the first resource information about the Kubernetes cluster is received in the OpenStack cluster, and detect whether the second resource information about the OpenStack cluster is received in the Kubernetes cluster; The second creation module is configured to create a resource subnet Subnet in the Kubernetes cluster according to the second resource information if both are received, so as to realize communication between the OpenStack cluster and the Kubernetes cluster.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method for realizing communication between Kubernetes and OpenStack according to any one of claims 1 to 7 when executing the program. 10.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program implements the method for realizing communication between Kubernetes and OpenStack according to any one of claims 1 to 7 when executed by the processor.
Citation Information
Patent Citations
Kubernetes cluster building and deploying method and architecture based on OpenStack and storage medium
CN111522628A
Method for connecting Kubernetes cluster network and OpenStack network
CN112035216A