Service access management method and system under a kind of container cloud environment
Technical field
The present invention relates to cloud service technical field, in particular to service access management method under a kind of container cloud environment and
System.
Background technique
Gradually popularizing with cloud computing technology in recent years, more and more enterprises start that deployment cloud computing has been selected to solve
Scheme, public cloud, private clound, mixed cloud manufacturer emerge in large numbers like the mushrooms after rain.Since public cloud security reliability and data are all
There is uncertain and dispute in power, the privately owned cloud management for having the enterprise of development ability that can build oneself in conjunction with enterprise's own characteristic is flat
Platform.
Cloud management platform can easily be provided for user calculating, network, storage resource and serviced component (such as redis,
Zookeeper etc.), calculating, the management of network, storage resource generally can select the openstack of open source and kvm to go to realize, and
The offer of serviced component can refer to currently without specific open source technology, and major public cloud, private clound manufacturer are all provided with common
Serviced component (cloud database redis, the cloud database mongodb of such as Ali), but this is completely enclosed, no to the external world
Transparent, and the component type, function, the performance that provide can be all restricted.Enterprise is flat in the privately owned cloud management for building oneself
When platform, it is unable to satisfy demand if necessary to a new serviced component or existing component, then requires customized development again, makes
At the waste of human resources.
Summary of the invention
In order to solve problems in the prior art, the embodiment of the invention provides the service access tubes under a kind of container cloud environment
Manage method and system.The technical solution is as follows:
On the one hand, the embodiment of the invention provides the service access management method under a kind of container cloud environment, the methods
Include:
Service mirror image needed for obtaining Service Instance operation;
Corresponding specification and service profile information are defined for Service Instance;
Write and upload include required container resource yaml file, the container resource is for constructing kubernetes
The Service Instance of platform;
Converting kubernetes container cloud platform for the yaml file of upload using freemarker template engine can manage
The container resource of reason;
Using Service Instance needed for the container resource construction converted, and the Service Instance to build defines user's visit
Ask entrance;
The Service Instance built is detected, and issues corresponding clothes in kubernetes container cloud platform after detection passes through
Business.
It is described to obtain the required service of Service Instance operation in the above-mentioned service access management method of the embodiment of the present invention
Mirror image, comprising:
The service mirror image required from official website's downloading,
Alternatively, preparing required service mirror image again based on existing foundation image.
In the above-mentioned service access management method of the embodiment of the present invention, described write includes required container resource
Yaml file, comprising:
Yaml file directly is write according to yaml file format,
Alternatively, writing in the information that container resource is filled at preset yaml Document Editing interface, corresponding yaml file is formed.
In the above-mentioned service access management method of the embodiment of the present invention, visited defining user for the Service Instance that builds
When asking entrance, the method also includes:
Service Instance to build is associated with other services that its operation is relied on.
In the above-mentioned service access management method of the embodiment of the present invention, in kubernetes container cloud platform issuing service
Before example, further includes:
Corresponding service essential information is defined for Service Instance, the service essential information includes: the title of service, version
At least one of sheet, icon, description information.
On the other hand, the embodiment of the invention provides the service access management systems under a kind of container cloud environment, comprising:
Module is obtained, for service mirror image needed for obtaining Service Instance operation;
Definition module, for defining corresponding specification and service profile information for Service Instance;
Processing module, for write and upload include required container resource yaml file, the container resource is used for
Construct the Service Instance of kubernetes platform;
The processing module is also used to convert the yaml file of upload to using freemarker template engine
The manageable container resource of kubernetes container cloud platform;
Module is constructed, for the service using Service Instance needed for the container resource construction converted, and to build
Example definition user's access entrance;
The processing module is also used to detect the Service Instance built, and holds after detection passes through in kubernetes
The corresponding service of device cloud platform publication.
In the above-mentioned service access management system of the embodiment of the present invention, the acquisition module is also used to from official website
Service mirror image needed for downloading,
Alternatively, preparing required service mirror image again based on existing foundation image.
In the above-mentioned service access management system of the embodiment of the present invention, the processing module, be also used to directly according to
Yaml file format writes yaml file,
Alternatively, writing in the information that container resource is filled at preset yaml Document Editing interface, corresponding yaml file is formed.
In the above-mentioned service access management system of the embodiment of the present invention, visited defining user for the Service Instance that builds
When asking entrance, the processing module is also used to be associated with other services that its operation is relied on for the Service Instance built.
In the above-mentioned service access management system of the embodiment of the present invention, in kubernetes container cloud platform issuing service
Before example, the definition module is also used to define corresponding service essential information, the service essential information for Service Instance
It include: at least one of the title of service, version, icon, description information.
Technical solution provided in an embodiment of the present invention has the benefit that
The embodiment of the present invention utilizes kubernetes container orchestration technology, and the service for access cloud management platform provides just
Prompt cut-in method, can satisfy the increasing service access demand of cloud management platform, accesses new service and do not need again
Exploitation, it is only necessary to make service mirror image and define kubernetes yaml resource file.Support User Defined Resource rule
Lattice, customized service access module, can effectively improve service access efficiency, so as to possess release quickly new for cloud management platform
Service ability.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for
For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing.
Fig. 1 is the service access management method flow chart under a kind of container cloud environment that the embodiment of the present invention one provides;
Fig. 2 is that a kind of service mirror image that the embodiment of the present invention one provides obtains exemplary diagram;
Fig. 3 is the specification and service profile information exemplary diagram for a kind of Service Instance that the embodiment of the present invention one provides;
Fig. 4 is a kind of yaml file edit exemplary diagram that the embodiment of the present invention one provides;
Fig. 5 is another yaml file edit exemplary diagram that the embodiment of the present invention one provides;
Fig. 6 is that a kind of yaml file that the embodiment of the present invention one provides uploads exemplary diagram;
Fig. 7 is that a kind of Service Instance user access entrance that the embodiment of the present invention one provides defines exemplary diagram;
Fig. 8 is a kind of service essential information exemplary diagram for Service Instance that the embodiment of the present invention one provides;
Fig. 9 is a kind of Service Instance publication exemplary diagram that the embodiment of the present invention one provides;
Figure 10 is the exemplary diagram that a kind of user that the embodiment of the present invention one provides applies for service;
Figure 11 is the access exemplary diagram after a kind of Service Instance activation that the embodiment of the present invention one provides;
Figure 12 is the service access management system structural representation under a kind of container cloud environment provided by Embodiment 2 of the present invention
Figure.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention
Formula is described in further detail.
Embodiment one
The embodiment of the invention provides the service access management methods under a kind of container cloud environment, are suitable for Kubernetes
Container cloud platform, referring to Fig. 1, this method may include:
Step S11, service mirror image needed for obtaining Service Instance operation.
In the present embodiment, a Service Instance is exactly the set of several resource objects, is added in container cloud platform
Service Instance can access new service for container cloud platform.Service Instance is operated in kubernetes container cluster,
And the operation of container needs to rely on mirror image, it is therefore desirable to the corresponding service mirror image of first building.Wherein, Kubernetes is automation
The Open Source Platform of container operation, these operations include deployment, are extended between scheduling and node cluster.
Specific above-mentioned steps S11 can be accomplished in that
From service mirror image needed for official website's downloading, alternatively, preparing required clothes again based on existing foundation image
Business mirror image.
In the present embodiment, mirror image can be downloaded from official, can also be remake completely based on foundation image, container fortune
Kubernetes incoming environmental variance can be received when row, therefore will consider to need to transmit which environment becomes when making mirror image
Amount passes through the configuration item of shell script replacement service before container starting.After having made mirror image, need to be pushed to kubernetes
The associated mirror image warehouse of cluster, when so as to Service Instance starting, mirror image can be pulled normally.Fig. 2 is to be with redis Service Instance
Example, the explanation of progress make redis mirror image in Fig. 2, and push redis is mirrored to mirror image warehouse.
Step S12 defines corresponding specification and service profile information for Service Instance;
In the present embodiment, each service is different using CPU, memory, storage, can be used according to service and business
Scene flexibly formulates multiple resource specifications, gives user different selection spaces.Can with the CPU of flexible customization Service Instance, memory,
Specification equal-specification and service profile information (such as example of Fig. 3) are stored, user demand is farthest met.In Service Instance
The regular expression, default value of field and field to be shown, verification specification when can configure user's application, activation in configuration,
These field configuration information can be transmitted to freemarker template engine in service request or starting, then have freemarker template
Engine parsing, passes to container.
Step S13, write and upload include required container resource yaml file, container resource is for constructing
The Service Instance of kubernetes platform.
In the present embodiment, yaml is the language for being specifically used to write configuration file, very succinct and powerful, more than json lattice
Formula is convenient.All resources of Kubernetes management can be known as resource object, and kubernetes supports to use yaml file
Establishing resource object (pod, deployment, replicationController etc.), a Service Instance are exactly several moneys
The set of source object.The creation of Service Instance is exactly that yaml file is converted into the manageable resource object of Kubernetes.?
In practical application, a yaml can be write for every kind of kubernetes resource type, it can also be by all resource types
All write on a yaml file.The content that can be changed in Yaml file is substituted using placeholder, when service-creation,
Freemarker template engine can be automatically by the truthful data for being substituted for example of placeholder.
Specifically, above-mentioned steps S13 can be accomplished in that
Yaml file (example referring to fig. 4) directly is write according to yaml file format,
Alternatively, writing in the information that container resource is filled at preset yaml Document Editing interface, corresponding yaml file is formed
(referring to the example of Fig. 5).
In the present embodiment, tenant can realize the access of service by system access interface, and operation is managed
Reason person can write kubernetes yaml resource file and realize quickly accessing for service.Due to the displaying of different access means
Mode and ability are all different, provide the support for different access ways thus, to guarantee that various access ways can obtain
Relatively good using effect.
Step S14 converts kubernetes container cloud for the yaml file of upload using freemarker template engine
The manageable container resource of platform.
In the present embodiment, right in conjunction with freemarker template engine dynamic using yaml filing serviced component
Yaml resource file is modified, and creation meets the Service Instance of different demands.Fig. 6 is the example for uploading yaml file.
Step S15, using Service Instance needed for the container resource construction converted, and it is fixed for the Service Instance built
Adopted user's access entrance.
In the present embodiment, access entrance be can finally be provided to user access entrance, support different agreements (http,
Tcp, udp), Fig. 7 is the definition example of Service Instance user access entrance.
Step S16, the Service Instance to build are associated with other services that its operation is relied on.
In the present embodiment, other services that service relies on can be defined when access service, between decoupling service and service
Dependence, i.e., service rely on can by other rely on service associate, such as access kafka cluster need to access simultaneously
At this moment zookeeper cluster can first access zookeeper cluster, need to only select to rely on when accessing kafka cluster
Zookeeper cluster.It should be noted that being not that each Service Instance is required to rely on other services, therefore, step
S16 can select to use according to specific Service Instance, and (such as redis Service Instance does not depend on other with no restrictions here
Service, so do not have to fill in).
Step S17, for the corresponding service essential information of Service Instance definition, service essential information include: service title,
At least one of version, icon, description information.
In the present embodiment, service essential information may include the information such as title, version, icon, the description of service, these
Information can show service list interface, and such user can have rough understanding (such as example shown in 8) to service.Creation clothes
Corresponding access service is selected when business, defines name of product, catalogue, icon, the remark information of service, and icon default can take
The icon for servicing access, can also modify herein.
Step S18 detects the Service Instance built, and issues after detection passes through in kubernetes container cloud platform
Corresponding service.
In the present embodiment, by information preservation that above-mentioned steps are inserted it is good after can create service, service access personnel,
Tester can first carry out functional test, and verifying mirror image, configuration, yaml file whether there is problem, after being verified
Current service is issued.It should be noted that can not be influenced original with upgrade service component when component has new characteristic publication
The operation of Service Instance, new Service Instance have new characteristic, and two version instances can be run simultaneously.
Fig. 9 be Service Instance (redis service) after tested after after there is no problem, issue on platform, make for user's application
With.Figure 10 is that user applies for redis service, including fills instance name, selection deployment mode, selection example specification, selection
Storage size.System can provide access address after Service Instance (redis service) activation in Figure 11, and application program can pass through
The address accesses the Service Instance, i.e. user can be used.
The embodiment of the present invention utilizes kubernetes container orchestration technology, and the service for access cloud management platform provides just
Prompt cut-in method, can satisfy the increasing service access demand of cloud management platform, accesses new service and do not need again
Exploitation, it is only necessary to make service mirror image and define kubernetes yaml resource file.Support User Defined Resource rule
Lattice, customized service access module, can effectively improve service access efficiency, so as to possess release quickly new for cloud management platform
Service ability.
Embodiment two
The embodiment of the invention provides one kind.Service access management system under container cloud environment, performs embodiment one
The method, referring to Figure 12, which may include: to obtain module 100, definition module 200, processing module 300, building mould
Block 400.
Module 100 is obtained, for service mirror image needed for obtaining Service Instance operation.
In the present embodiment, a Service Instance is exactly the set of several resource objects, is added in container cloud platform
Service Instance can access new service for container cloud platform.Service Instance is operated in kubernetes container cluster,
And the operation of container needs to rely on mirror image, it is therefore desirable to the corresponding service mirror image of first building.Wherein, Kubernetes is automation
The Open Source Platform of container operation, these operations include deployment, are extended between scheduling and node cluster.
Definition module 200, for defining corresponding specification and service profile information for Service Instance.
In the present embodiment, each service is different using CPU, memory, storage, can be used according to service and business
Scene flexibly formulates multiple resource specifications, gives user different selection spaces.Can with the CPU of flexible customization Service Instance, memory,
Specification equal-specification and service profile information (such as example of Fig. 3) are stored, user demand is farthest met.In Service Instance
The regular expression, default value of field and field to be shown, verification specification when can configure user's application, activation in configuration,
These field configuration information can be transmitted to freemarker template engine in service request or starting, then have freemarker template
Engine parsing, passes to container.
Processing module 300, for write and upload include required container resource yaml file, container resource be used for structure
Build the Service Instance of kubernetes platform.
In the present embodiment, yaml is the language for being specifically used to write configuration file, very succinct and powerful, more than json lattice
Formula is convenient.All resources of Kubernetes management can be known as resource object, and kubernetes supports to use yaml file
Establishing resource object (pod, deployment, replicationController etc.), a Service Instance are exactly several moneys
The set of source object.The creation of Service Instance is exactly that yaml file is converted into the manageable resource object of Kubernetes.?
In practical application, a yaml can be write for every kind of kubernetes resource type, it can also be by all resource types
All write on a yaml file.The content that can be changed in Yaml file is substituted using placeholder, when service-creation,
Freemarker template engine can be automatically by the truthful data for being substituted for example of placeholder.
Processing module 300 is also used to convert the yaml file of upload to using freemarker template engine
The manageable container resource of kubernetes container cloud platform.
In the present embodiment, right in conjunction with freemarker template engine dynamic using yaml filing serviced component
Yaml resource file is modified, and creation meets the Service Instance of different demands.
Module 400 is constructed, for the clothes using Service Instance needed for the container resource construction converted, and to build
Business example definition user access entrance.
In the present embodiment, access entrance be can finally be provided to user access entrance, support different agreements (http,
tcp、udp)。
Processing module 300 is also used to detect the Service Instance built, and in kubernetes container after detection passes through
The corresponding service of cloud platform publication.
In the present embodiment, by information preservation that above-mentioned steps are inserted it is good after can create service, service access personnel,
Tester can first carry out functional test, and verifying mirror image, configuration, yaml file whether there is problem, after being verified
Current service is issued.It should be noted that can not be influenced original with upgrade service component when component has new characteristic publication
The operation of Service Instance, new Service Instance have new characteristic, and two version instances can be run simultaneously.
Specifically, module 100 is obtained, the service mirror image needed for being also used to download from official website,
Alternatively, preparing required service mirror image again based on existing foundation image.
In the present embodiment, mirror image can be downloaded from official, can also be remake completely based on foundation image, container fortune
Kubernetes incoming environmental variance can be received when row, therefore will consider to need to transmit which environment becomes when making mirror image
Amount passes through the configuration item of shell script replacement service before container starting.After having made mirror image, need to be pushed to kubernetes
The associated mirror image warehouse of cluster, when so as to Service Instance starting, mirror image can be pulled normally.
Specifically, processing module 300 are also used to directly write yaml file according to yaml file format,
Alternatively, writing in the information that container resource is filled at preset yaml Document Editing interface, corresponding yaml file is formed.
In the present embodiment, tenant can realize the access of service by system access interface, and operation is managed
Reason person can write kubernetes yaml resource file and realize quickly accessing for service.Due to the displaying of different access means
Mode and ability are all different, provide the support for different access ways thus, to guarantee that various access ways can obtain
Relatively good using effect.
Optionally, when defining user's access entrance for the Service Instance that builds, processing module 300 is also used to as structure
The Service Instance built up is associated with other services that its operation is relied on.
In the present embodiment, other services that service relies on can be defined when access service, between decoupling service and service
Dependence, i.e., service rely on can by other rely on service associate, such as access kafka cluster need to access simultaneously
At this moment zookeeper cluster can first access zookeeper cluster, need to only select to rely on when accessing kafka cluster
Zookeeper cluster.
Optionally, before kubernetes container cloud platform issuing service example, definition module 200 is also used to as clothes
Business example definition services essential information accordingly, services in the title, version, icon, description information that essential information includes: service
At least one of.
In the present embodiment, service essential information may include the information such as title, version, icon, the description of service, these
Information can show service list interface, and such user can have rough understanding to service.Selection connects accordingly when creation service
Entering service, defines name of product, catalogue, icon, the remark information of service, icon default can take the icon of service access,
It can also modify herein.
The embodiment of the present invention utilizes kubernetes container orchestration technology, and the service for access cloud management platform provides just
Prompt cut-in method, can satisfy the increasing service access demand of cloud management platform, accesses new service and do not need again
Exploitation, it is only necessary to make service mirror image and define kubernetes yaml resource file.Support User Defined Resource rule
Lattice, customized service access module, can effectively improve service access efficiency, so as to possess release quickly new for cloud management platform
Service ability.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
It should be understood that the service access management system under container cloud environment provided by the above embodiment is realizing container
When service access management method under cloud environment, only the example of the division of the above functional modules, in practical application,
It can according to need and be completed by different functional modules above-mentioned function distribution, i.e., the internal structure of equipment is divided into difference
Functional module, to complete all or part of the functions described above.In addition, under container cloud environment provided by the above embodiment
Service access management system and container cloud environment under service access management method embodiment belong to same design, it is specific real
Existing process is detailed in embodiment of the method, and which is not described herein again.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware
It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and
Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.