CN110442421B - Kubernetes-based general service conversion method and system - Google Patents
Kubernetes-based general service conversion method and system Download PDFInfo
- Publication number
- CN110442421B CN110442421B CN201910578655.XA CN201910578655A CN110442421B CN 110442421 B CN110442421 B CN 110442421B CN 201910578655 A CN201910578655 A CN 201910578655A CN 110442421 B CN110442421 B CN 110442421B
- Authority
- CN
- China
- Prior art keywords
- service
- container
- conversion
- kubernetes
- pod
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a Kubernetes-based universal service conversion method and a Kubernetes-based universal service conversion system, which comprise the following steps: constructing a Kubernetes system consisting of a plurality of nodes, wherein the Pod of a node is provided with an original service container for providing service, and a conversion program is added into the Pod of the node in a way of newly adding the container in the Pod or in a way of mirroring the original container; when a service calling request occurs once, the conversion container or the program converts the service calling request into an original service execution request according to the configuration, provides corresponding service by calling the original service container, and converts the service calling request into a service result corresponding to the service calling request. The invention can solve the problem of inconsistent interface between Kubernets service and caller; and the network overhead between the conversion program and the service program and between the conversion program and the calling program can be reduced, and the conversion program is automatically deployed along with the redeployment of the service program by combining the Kubernetes characteristic.
Description
Technical Field
The invention relates to the field of software architecture of containerized application, in particular to a Kubernetes-based universal service conversion method and a Kubernetes-based universal service conversion system.
Background
Kubernetes (K8s) is an open source system for managing containerized applications in a cloud platform, and the Kubernetes aims to ensure that the application of deploying containerization is simple and efficient, and is widely applied at present.
Kubernets may create a Pod in a Node, which is a set of containers and resources related to the containers in kubernets. The containers in the Pod will share IP and port resources.
It provides a service management approach that can organize several pods into services. The application may make calls to the service using the service name.
At present, in Kubernetes, in practical application, a plurality of second parties or a plurality of development departments often occur, and developers can have misunderstandings or imperfect places when communicating with each other, so that service calling interfaces of a service caller and an implementation party are inconsistent and are difficult to match.
The interface inconsistency refers to inconsistency between an interface used by a caller and an interface provided by a service implementer when a RESTful interface is used for service call, and includes but is not limited to the following 4 cases:
1. the parameter name sent by the calling party is inconsistent with the parameter name expected by the service party;
2. the parameter format sent by the calling party is inconsistent with the parameter format expected by the service party;
3. the format of the result returned by the server is different from that of the caller, but the content is consistent;
4. the Header returned by the server does not coincide with the caller expectation.
Especially, when workflow software or third-party software is adopted, the workflow software or the third-party software is difficult to modify and only can be passively adapted, so that extra development cost and version management cost are increased. It is also sometimes the case that certain detail problems are not matched, such as inconsistent returned document types, when joint debugging is performed.
In addition, in multi-party development, if an error occurs, error location is required.
Disclosure of Invention
The invention mainly aims to solve the problems of development and maintenance cost and wrong positioning caused by inconsistent interfaces due to multi-party development.
Aiming at the defects of the prior art, the invention provides a Kubernetes-based general service conversion method, which comprises the following steps:
and 2, acquiring a service calling request, converting the service calling request into a service execution request by the conversion container according to preset configuration, and providing a service corresponding to the service name by the node through running the original service container according to the service name in the service execution request as a service result of the service calling request.
The Kubernetes-based general service conversion method comprises the following steps of:
and 11, adding the conversion container into the Pod of the original service container by modifying the Pod deployment description file.
The Kubernetes-based general service conversion method, wherein the configuration in step 2 comprises: the conversion rule of the parameter name and the conversion rule of the service return content.
The Kubernetes-based universal service conversion method is characterized in that the conversion container and the original service container share the same Pod.
According to the Kubernetes-based general service conversion method, the node is a physical machine or a virtual machine.
The invention also provides a Kubernetes-based general service conversion system, which comprises:
the method comprises the following steps that a module 1 is used for constructing a Kubernets system formed by a plurality of nodes, wherein Pods of the nodes are provided with original service containers used for providing services, and conversion containers are added in the Pods in a new container building mode;
and the node provides a service corresponding to the service name as a service result of the service calling request by operating the original service container according to the service name in the service execution request.
The Kubernetes-based universal service conversion system, wherein the module 1 comprises:
the module 11 adds the conversion container to the Pod of the original service container by modifying the Pod deployment description file.
The Kubernetes-based general service conversion system, wherein the configuration in the module 2 includes: the conversion rule of the parameter name and the conversion rule of the service return content.
The Kubernetes-based universal service conversion method is characterized in that the conversion container and the original service container share the same Pod.
The Kubernetes-based general service conversion system is characterized in that the node is a physical machine or a virtual machine.
According to the scheme, the invention has the advantages that:
1. the problem of inconsistent interfaces between K8s services is solved by using a universal agent mode;
2. the method of implanting the container is used to reduce the additional network overhead, and there are two implantation methods: one is a mode of adding a container in the Pod, therefore, when the service is down, the conversion container is restarted together with the original service container by using a restarting mechanism of K8s, and the resource waste caused by deploying the conversion container again due to the down can be avoided;
3. the proxy supports the use of the lua language description translation process;
4. the agent supports the preservation of interaction data between the agent's run and its actual calling service container for problem location.
Drawings
FIG. 1 is a block diagram of a prior art system of the standard Kubernets;
FIG. 2 is a block diagram of a system incorporating a converter according to the present invention;
FIG. 3 is a flow chart of the converter operation of the present invention;
fig. 4 is a configuration format diagram of the management module.
Detailed Description
The inventor of the present invention has found that the above-mentioned needs can be met by using a general configurable agent, and the general purpose of the present invention is:
1. based on a universal conversion container, similar scenes are changed, only configuration files need to be changed, and development is not needed;
2. the container can read in configuration and complete the conversion of interface data between the calling party and the service party.
In addition, in the process of using the proxy, if the proxy runs and the service container actually called by the proxy is not on one Node, additional cross-machine network overhead exists. In order to reduce the cost, it should be noted that the present invention uses a method of implanting container, so that the agent (transformation container) and the actual service program (original service container) are both in one Pod, and are different from a method of converting independent from the node, and further, when the K8s is scheduled, the present invention ensures that the agent (transformation container) and the actual service program (original service container) are both on one node, and the node may be a physical machine (e.g. a server) or a virtual machine.
Such agents may assist in problem location, i.e., the ability to record data that is interacted with by both parties. In order to make the aforementioned features and effects of the present invention more comprehensible, embodiments accompanied with figures are described in detail below.
Development agent (translator) container:
in the standard K8s, the relationship between the original Node, service Pod and Container is shown in fig. 1. The Node, service Pod and Container relations of the present invention are shown in fig. 2, a new converter Container is added, and the converter reads ConfigMap in K8s as configuration. Wherein the working flow of the converter is shown in figure 3.
ConfigMap is actually a configuration, the configuration format (json) is shown in fig. 4. Wherein Input is the conversion rule of parameter name, in this case, convert query to q; the Output includes conversion of the return content, including conversion of the header, requiring the header to return "text/play", and the transform _ lua is a conversion lua, supporting conversion of the return result into another return result character string by the lua program, and the empty character string indicates no conversion. Record indicates that the interactive character string is recorded when Record is 1, and Record indicates that the interactive character string is not recorded when Record is 0.
When the ConfigMap is updated, the services and the translator are restarted.
The flow of worker thread in the converter container:
1. and acquiring the calling parameters of the calling party, and converting according to the parameter name conversion rule ConfigMap.
2. Call service (record input and output if recording is required)
3. According to the returned result, if the header needs to be modified, the header is modified, the content needs to be changed, the lua statement is explained to process the content, and the result is returned
Implanting the agent container:
adding the agent container into the Pod of the original service by modifying the yaml service file to form a new Pod;
the following are system examples corresponding to the above method examples, and this embodiment can be implemented in cooperation with the above embodiments. The related technical details mentioned in the above embodiments are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the above-described embodiments.
The invention also provides a Kubernetes-based general service conversion system, which comprises:
the method comprises the following steps that a module 1 is used for constructing a Kubernets system formed by a plurality of nodes, wherein Pods of the nodes are provided with original service containers used for providing services, and conversion containers are added in the Pods in a new container building mode;
and the node provides a service corresponding to the service name as a service result of the service calling request by operating the original service container according to the service name in the service execution request.
The Kubernetes-based universal service conversion system, wherein the module 1 comprises:
the module 11 adds the conversion container to the Pod of the original service container by modifying the Pod deployment description file.
The Kubernetes-based general service conversion system, wherein the configuration in the module 2 includes: the conversion rule of the parameter name and the conversion rule of the service return content.
The Kubernetes-based universal service conversion method is characterized in that the conversion container and the original service container share the same Pod.
The Kubernetes-based general service conversion system is characterized in that the node is a physical machine or a virtual machine.
Claims (8)
1. A general service conversion method based on Kubernetes is characterized by comprising the following steps:
step 1, constructing a Kubernets system composed of a plurality of nodes, wherein Pod of the nodes is provided with an original service container for providing service, and a conversion container is added in the Pod in a way of newly building the container;
step 2, obtaining a service calling request, wherein the conversion container converts the service calling request into a service execution request according to preset configuration, and the node provides a service corresponding to the service name as a service result of the service calling request by operating the original service container according to the service name in the service execution request;
wherein the conversion container and the original service container share the same Pod.
2. The Kubernetes-based generic service conversion method according to claim 1, wherein the step 1 comprises:
and 11, adding the conversion container into the Pod of the original service container by modifying the Pod deployment description file.
3. The Kubernetes-based generic service translation method of claim 1, wherein the configuring in step 2 comprises: the conversion rule of the parameter name and the conversion rule of the service return content.
4. The Kubernetes-based universal service translation method according to claim 1, wherein the node is a physical machine or a virtual machine.
5. A Kubernetes-based universal service switching system is characterized by comprising:
the method comprises the following steps that a module 1 is used for constructing a Kubernets system formed by a plurality of nodes, wherein Pods of the nodes are provided with original service containers used for providing services, and conversion containers are added in the Pods in a new container building mode;
the node provides a service corresponding to a service name by operating the original service container according to the service name in the service execution request, and the service is used as a service result of the service calling request;
wherein, the conversion container and the original service container share the same Pod.
6. A kubernets-based universal service switching system according to claim 5, wherein said module 1 comprises:
and the module 11 adds the conversion container to the Pod of the original service container by modifying the Pod deployment description file.
7. A Kubernetes-based universal service switching system according to claim 5, wherein said configuration in module 2 comprises: the conversion rule of the parameter name and the conversion rule of the service return content.
8. A Kubernetes-based universal service translation system according to claim 5, wherein said nodes are physical or virtual machines.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910578655.XA CN110442421B (en) | 2019-06-28 | 2019-06-28 | Kubernetes-based general service conversion method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910578655.XA CN110442421B (en) | 2019-06-28 | 2019-06-28 | Kubernetes-based general service conversion method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110442421A CN110442421A (en) | 2019-11-12 |
CN110442421B true CN110442421B (en) | 2022-04-01 |
Family
ID=68428677
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910578655.XA Active CN110442421B (en) | 2019-06-28 | 2019-06-28 | Kubernetes-based general service conversion method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110442421B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107508795A (en) * | 2017-07-26 | 2017-12-22 | 中国联合网络通信集团有限公司 | Across the access process device and method of container cluster |
CN108369622A (en) * | 2015-12-18 | 2018-08-03 | 亚马逊技术股份有限公司 | Software container registration table service |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3477470A4 (en) * | 2016-06-28 | 2019-07-10 | Nec Corporation | Control device, container starting method, and program |
-
2019
- 2019-06-28 CN CN201910578655.XA patent/CN110442421B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108369622A (en) * | 2015-12-18 | 2018-08-03 | 亚马逊技术股份有限公司 | Software container registration table service |
CN107508795A (en) * | 2017-07-26 | 2017-12-22 | 中国联合网络通信集团有限公司 | Across the access process device and method of container cluster |
Non-Patent Citations (2)
Title |
---|
"Enabling Docker Containers for High-Performance and Many-Task Computing";Abdulrahman Azab等;《2017 IEEE International Conference on Cloud Engineering (IC2E)》;20170511;第279-285页 * |
"基于Openstack的云计算平台的门户的研究与实现";张志昊;《中国优秀硕士学位论文全文数据库 信息科技辑》;20180315(第03期);第I139-259页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110442421A (en) | 2019-11-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111290753B (en) | Method, device, equipment and storage medium for building front-end development environment | |
JP4509916B2 (en) | SNMP-based network management apparatus and method | |
KR100845234B1 (en) | Apparatus and method for parsing domain profile in software communication architecture | |
JP2018530070A (en) | System and method for building, optimizing and implementing a platform on a cloud-based computing environment | |
KR20040051738A (en) | XML based network management system and method for configuration management of heterogeneous network devices | |
CN104536890A (en) | Testing system, method and device | |
CN112235357B (en) | Cross-platform application development system | |
CN101795206B (en) | Method and device for realizing SNMP agent on distributed equipment | |
CN113515278A (en) | Low code model processing method, system, electronic device and storage medium | |
US20070288512A1 (en) | Resource management program, resource management process, and resource management apparatus | |
CN111414261B (en) | Cross-network calling method and device of distributed system and related components | |
CN112286628A (en) | System for unifying nanotube Kubernetes heterogeneous applications and operation method | |
CN113360386B (en) | Method and device for testing driving of switching chip, electronic equipment and storage medium | |
CN111061745A (en) | Data synchronization system and method | |
CN112765246B (en) | Task processing method, device, electronic equipment and storage medium | |
CN110442421B (en) | Kubernetes-based general service conversion method and system | |
CN111913721B (en) | Automatic deployment method, device, equipment and storage medium | |
CN109683916A (en) | A kind of method of cloud mirrored host computer of the autonomous creation comprising application software | |
WO2021093671A1 (en) | Task processing method, system, apparatus and device, and computer readable storage medium | |
CN104333806A (en) | Set top box parameter operation method and device | |
US8464218B2 (en) | Method port arrangement and configuration method thereof for robot software component | |
CN107885604B (en) | Method and device for communication between heterogeneous systems, computer equipment and storage medium | |
CN115695537A (en) | Method, system and device for realizing service grid adapting to traditional micro-service registration center | |
CN112398870B (en) | Cross-platform protocol generation method, device, system, equipment and storage medium | |
CN113641641A (en) | Switching method, switching system, equipment and storage medium of file storage service |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |