Specific implementation mode
In being described below, for illustration and not for limitation, it is proposed that such as tool of particular system structure, technology etcBody details, to understand thoroughly the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specificThe present invention can also be realized in the other embodiments of details.In other situations, it omits to well-known system, device, electricityThe detailed description of road and method, in case unnecessary details interferes description of the invention.
The embodiment of the present invention completes building for Kubernetes host nodes by executing preset deployment script, including will useFamily input is filled with the relevant establishment parameter of Kubernetes host nodes to preset configuration template, to generate configuration textPart determines node to be disposed corresponding with configuration file, wherein enabled node represents available physics from multiple enabled nodesNode or virtual machine node, last automatic calling Ansible tools, are built based on configuration file in node to be disposedKubernetes host nodes, the automation that Kubernetes host nodes are realized by executing deployment script build, improve and takeBuild efficiency.
In order to illustrate technical solutions according to the invention, illustrated below by specific embodiment.
Fig. 1 is shown provided in an embodiment of the present invention builds Kubernetes host nodes automatically based on Ansible toolsThe implementation process of method, details are as follows:
In S101, preset configuration is added to the relevant establishment parameter of Kubernetes host nodes by input by userTemplate generates configuration file.
In embodiments of the present invention, for convenience of description, first to Kubernetes the relevant technologies and Kubernetes masterNode is introduced.Kubernetes is the container programming facility of a automation container operation, can realize the portion to containerThe functions such as extension, will be equipped with the physical server or virtual machine of Kubernetes tools between administration and scheduling and node clusterReferred to as Kubernetes nodes.Usually, multiple Kubernetes nodes is needed to be constructed as Kubernetes clusters(Kubernetes Cluster) is to realize deployment and management to container.In a Kubernetes cluster, has and only haveA set of control unit, i.e. Kubernetes host nodes (Kubernetes Master) are mainly responsible for reception request, scheduling of resourceAnd be managed, the component part of Kubernetes host nodes is specifically addressed later.In addition to the main sections of KubernetesFurther include multiple subordinate's objects of Kubernetes host nodes in usual Kubernetes clusters except point, i.e., it is multipleKubernetes is from node (Kubernetes Node), the container for the distribution of actual motion Kubernetes host nodes.
In generation, is write by user manually compared to traditional each link in the configuration process of Kubernetes host nodesCode is configured, and in embodiments of the present invention, the automatic of Kubernetes host nodes is completed by executing preset deployment scriptIt builds, step S101 to S103 is automatically performed especially by deployment script is executed.It is noted that deployment script is script textPart, and a series of control computers that script file is to determine carry out the combination of arithmetic operation action, can realize logic whereinBranch.Preferably, deployment script is write using Shell language, and certainly, according to application scenarios difference, deployment script can also be usedOther language for being suitable for writing script file are write.
Optionally, deployment script corresponding with main body is built is determined from the multiple deployment scripts to prestore, and executes the portionAffix one's name to script.Building for Kubernetes host nodes is carried out, other than there is node to be disposed, should also exist and initiate to build actionBuild main body, that is, initiate the terminal device for building the user of action.And the environment of terminal device such as operating system there may beDifference, such as terminal device can be run under Windows operating system, can also be run under a linux operating system, and rightIn the varying environment of terminal device, the code for building Kubernetes host nodes also will appear difference, and then can write in advance moreA deployment script, each deployment script correspond to a kind of terminal device of environment.In embodiments of the present invention, by multiple deployment feetThis is prestored, for example is storable in Cloud Server, and builds Kubernetes host nodes building main body and sending outAfter instruction, corresponding deployment script is determined from Cloud Server according to the environment for building main body, and execute the deployment script automatically,Deployment script is improved to building the applicability of main body.
Optionally, provide a user build Kubernetes host nodes build option, building option can be with graphicalThe form of interface or order line is presented, and is taken getting user and building the confirmation of option about this as a result, getting userAfter building the instruction of Kubernetes host nodes, executes and determine deployment corresponding with main body is built from the multiple deployment scripts to prestoreThe operation of script.Option is built by providing a user, improves acquisition about the instruction for building Kubernetes host nodesValidity and convenience.
In deployment script implementation procedure, first by the input by user and relevant establishment parameter of Kubernetes host nodesIt is added to preset configuration template, automatically generates configuration file.Wherein, with the relevant establishment parameter packet of Kubernetes host nodesInclude the property parameters of Kubernetes host nodes, such as the address of installation version, Kubernetes host nodes, operationThe node identification (title) of Kubernetes host nodes and area identification etc., it further includes constituting Kubernetes master to create parameterThe property parameters etc. of each node component of node.In embodiments of the present invention, since the content format for creating parameter can be advanceIt determines, therefore configuration template can be pre-set according to the content format for creating parameter, it is each interior comprising parameter is created in configuration templateThe title for holding format inputs content corresponding with each title convenient for user, to improve the normalization for creating parameter input,Reduce the possibility for creating parameter input error.After establishment parameter input by user is added to configuration template, configuration is producedFile carries out building for Kubernetes host nodes in subsequent step according to configuration file.
In S102, node to be disposed corresponding with the configuration file is determined in multiple enabled nodes, wherein describedEnabled node is available physical node or virtual machine node.
In embodiments of the present invention, the resource area that multiple enabled nodes are stored is known as common service area, public serviceFor disposing the program for providing specific service to the user or service, i.e., multiple enabled nodes in common service area all have portion in areaAffix one's name to the condition of Kubernetes host nodes, wherein enabled node is available physical node or virtual machine node.Due to configuration textInclude the node identification (title) and area identification of operation Kubernetes host nodes in part, therefore can be true from multiple enabled nodesNode corresponding with configuration file is made, and using the node as node to be disposed.
In S103, call Ansible tools, built in node dispose based on the configuration file described inKubernetes host nodes.
Although such as kops tools of conventional tool can carry out building Kubernetes host nodes, specificBuild in link, it is still necessary to user's manual compiling code, carry out as Kubernetes host nodes address configuration.In this hairIn bright embodiment, Ansible tools, Ansible tools is called to be built in node to be disposed automatically based on configuration fileKubernetes host nodes.It should be noted that Ansible tools are the automation operation managements realized based on PythonTool, compared to other such as the tool of server/customer end constitution, Ansible tools need not be on node top to be disposedAffix one's name to Client Agent.After installing Ansible tools on building main body, Ansible tools can be by sending to node to be disposedSafety shell protocol (Secure Shell, SSH) orders to realize node to be disposed and build intersubjective communication.In deployment footIt is automatic to call Ansible tools when configuration file and after disposing node determination in this implementation procedure, according to configuration fileIn establishment parameter the relevant node component of Kubernetes host nodes is configured in node to be disposed, configuration completeAfterwards, it is that Kubernetes host nodes are successfully built in node to be disposed.It is noted that in step S102, it can be in portionUnder the execution for affixing one's name to script, builds main body and sends the inquiry instruction based on configuration file from the management program of trend common service area,So that it is determined that node to be disposed;Also main body can be built directly by Ansible tools under the execution of deployment script, based on matchingIt sets file and determines node to be disposed from multiple enabled nodes.
Optionally, it treats deployment node configuration SSH and exempts from close login.After Ansible tools are installed on building main body, it can incite somebody to actionIt builds main body and regards SSH servers as, regarding node to be disposed as ssh client, (SSH servers and ssh client here is simultaneouslyDo not represent Ansible tools and use server/customer end constitution, be intended merely to facilitate and carry out SSH communications, build process it is simpleProperty it is high), build communicated between main body and node dispose for convenience, efficiency is built in further promotion, can be obtained and takenThe key pair (comprising private key and public key) generated by SSH cipher key commands in main body is built, and public key is distributed to node to be disposed,It is stored in the memory space of node to be disposed, so that node to be disposed, which can be realized, exempts from close login.
By embodiment illustrated in fig. 1 it is found that in embodiments of the present invention, being completed by executing preset deployment scriptKubernetes host nodes are built, specifically in the implementation procedure of deployment script, by input by user and Kubernetes masterThe relevant establishment parameter of node is added to preset configuration template, configuration file is generated, in multiple available physical nodes or voidNode to be disposed corresponding with configuration file is determined in quasi- machine node, is finally called Ansible tools, is being waited for based on configuration fileKubernetes host nodes are built in deployment node, the automatic of Kubernetes host nodes is realized and builds, reduce tradition and matchThe possibility artificially to malfunction during setting, improve Kubernetes host nodes builds efficiency.
Shown in Fig. 2, be on the basis of the embodiment of the present invention one, increased before determining node to be disposed to it is multiple canA kind of method being detected with node.An embodiment of the present invention provides built automatically based on Ansible toolsThe implementation flow chart of the method for Kubernetes host nodes, as shown in Fig. 2, this method may comprise steps of:
In S201, detect in the multiple enabled node with the presence or absence of building the Kubernetes host nodes orThe node of the Kubernetes host nodes is built.
Before determining node to be disposed in multiple enabled nodes from common service area, multiple enabled nodes are detected firstIn with the presence or absence of building Kubernetes host nodes or building the node of Kubernetes host nodes, and according to detectionAs a result different operations is executed, wherein the Kubernetes host nodes in this step refer to and the property parameters in configuration fileThe node being consistent.Specifically, corresponding sense command is sent to multiple enabled nodes, and receives multiple enabled nodes about detectionThe feedback of order, to carry out the detection of Kubernetes host nodes.
In S202, if there is no building the Kubernetes host nodes or taking in the multiple enabled nodeThe node of the Kubernetes host nodes is built, then it is corresponding with the configuration file to execute the determination in multiple enabled nodesNode to be disposed operation.
It is building Kubernetes host nodes if existing in multiple enabled nodes or is building Kubernetes host nodesNode stop executing being determined in multiple enabled nodes and configuration text then in order to avoid repeating to build the wasting of resources broughtThe corresponding node to be disposed of part and its subsequent operation stop the execution of deployment script;If being not present in multiple enabled nodesIt is building Kubernetes host nodes or is building the node of Kubernetes host nodes, then proving Kubernetes host nodesIt is not created, it is normal to execute the operation that node to be disposed corresponding with configuration file is determined in multiple enabled nodes.
By embodiment illustrated in fig. 2 it is found that in embodiments of the present invention, being determined from multiple enabled nodes and configuration textBefore the corresponding node to be disposed of part, detect in multiple enabled nodes with the presence or absence of building Kubernetes host nodes orBuild the node of Kubernetes host nodes, if in multiple enabled nodes there is no building Kubernetes host nodes orThe node of Kubernetes host nodes has been built, then has been executed and is determined in multiple enabled nodes and corresponding with configuration file wait disposingThe operation of node is prevented from repeating to build in the case where having built Kubernetes host nodes, be resulted in waste of resources.
Shown in Fig. 3, to calling Ansible tools, waited for based on configuration file on the basis of the embodiment of the present invention oneA kind of method that Kubernetes host nodes are refined is built in deployment node.An embodiment of the present invention provides based onAnsible tools build the implementation flow chart of the method for Kubernetes host nodes automatically, as shown in figure 3, this method can wrapInclude following steps:
In S301, obtains from binary file server and match with the associated binary system of Kubernetes host nodesSet file.
In embodiments of the present invention, building for Kubernetes host nodes, binary system are carried out according to binary profile fileConfiguration file can be understood as the installation file of Kubernetes host nodes, therefore being obtained first from binary file server shouldBinary profile file.Wherein, binary file server is independently of Kubernetes host nodes and KubernetesThe download server of cluster, for storing all kinds of binary files and all kinds of scripts.In addition, deployment script can be pre-stored withinIn binary file server, and when needing to build Kubernetes host nodes, the portion is obtained from binary file serverAffix one's name to script.
In S302, start preset drama component in the Ansible tools so that the Ansible tools according toThe drama component installs the binary profile file in the node to be disposed, and configures the main sections of the KubernetesThe running environment of point.
After getting binary profile file, preset drama component in startup Ansible tools, i.e. Playbooks, withMake Ansible tools that binary profile file be installed in node to be disposed according to drama component, and configures Kubernetes masterThe running environment of node.Drama component is the component for configured to long-range node in Ansible tools, inThe step of can describing to operate long-range node.Drama component may include that multiple element lists, each element list are directed toOne host, therefore drama component can make Ansible tools carry out ordered operation to multiple main frames.The element list of drama componentUnder, there are task list (tasks), each task (task) under task list is once to the calling of Ansible tools.In embodiments of the present invention, it is only that one situation is illustrated with node to be disposed, then in preset drama component, only setsAn element list is set, and there are multiple node components for Kubernetes host nodes, therefore in drama component individual element listIn task list, multiple configuration tasks corresponding with multiple node components are set.
It is illustrated with one of node component, the corresponding configuration task of the node component can be:
(1) binary file corresponding with the node component in binary profile file is copied under binary directory,Generally/usr/bin catalogues, it will be appreciated that install binary file corresponding with the node component;
(2) the corresponding startup service document of the node component is created, wherein start service document for starting the node groupThe corresponding service of part;
(3) Parameter File started in service document is created, wherein Parameter File is used to describe the address of the node componentEtc. parameters, which is configured according to configuration file;
(4) service document will be started and is configured to starting up, specifically usable systemctl orders are configured.When upperAfter the completion of (1), (2), (3) and (4) stated, that is, complete the configuration to the node component.
From the foregoing, it will be observed that in Ansible tools in preset drama component, can only preset configuration node component the step of andMode, in specific implementation, it is also necessary to the configuration of multiple node components of Kubernetes host nodes is carried out according to configuration file.After multiple node components all configure, the configuration to the running environment of Kubernetes host nodes is completed, i.e.,Kubernetes host nodes build completion.
By embodiment illustrated in fig. 3 it is found that in embodiments of the present invention, obtained first from binary file server withThe associated binary profile file of Kubernetes host nodes starts the drama component in Ansible tools, so that AnsibleTool according to preset task in drama component complete binary profile file installation and Kubernetes host nodes it is multipleThe configuration of node component completes the configuration to Kubernetes host node running environment after the completion of the configuration of multiple node components,The convenience for building Kubernetes host nodes is improved by acquisition binary profile file, and is passed through and run preset playThis component further improves the degree of automation for building Kubernetes host nodes.
It is multiple nodes for the including on the basis of embodiment of the present invention three for Kubernetes host nodes shown in Fig. 4The case where component is database component, interface service component, control assembly and scheduling component, to installing binary profile fileAnd a kind of method that the running environment of configuration Kubernetes host nodes is refined.An embodiment of the present invention provides basesThe implementation flow chart of the method for Kubernetes host nodes is built automatically in Ansible tools, as shown in figure 4, this method can be withInclude the following steps:
In S401, the database component is disposed by the Ansible tools, wherein from the configuration fileNetwork configuration data is obtained, and the network configuration data is loaded onto the database component.
In embodiments of the present invention, Kubernetes host nodes include database (Etcd) component, interface service (KubeApiServer) component, control (Kube Controller Manager) component and scheduling (Kube Scheduler) component.For the ease of the content of the explanation embodiment of the present invention, the schematic diagram of a Kubernetes cluster as shown in Figure 7 is provided,In Fig. 7, Master represents Kubernetes host nodes, and Controller Manager represent control assembly, and Scheduler is representedComponent is dispatched, ApiServer represents interface service component, and Etcd represents database component, and the Node of bottom is representedKubernetes is from node.It is noted that building Kubernetes host nodes, that is, configure under Kubernetes host nodesVarious components before, fire wall need to be closed, realize that the network minimized is got through based on firewall policy, i.e., where building main bodyRegion and node to be disposed where common service area between network get through.
Database component is distributed key assignments storage service, ensures data consistency by distributed Raft algorithms, andAnd it provides and is based on hypertext transfer protocol (HyperText Transfer Protocol, HTTP) and JavaScript object markRemember the application programming interface (Application of language (JavaScript Object Notation, JSON)Programming Interface, API).In embodiments of the present invention, database component for configuration management, data storage andAs distributed lock, the deployment of database component is carried out by Ansible tools.Specifically, Ansible tools are according to drama groupTask in part obtains binary file corresponding with database component, by the binary file from binary profile fileIt is copied under binary directory, creates the startup service document of database component, and create the parameter in the startup service documentNetwork configuration data in configuration file is added in Parameter File by file, will finally be started service document and is configured to be switched onStart, wherein network configuration data refer in configuration file with the relevant monitoring uniform resource locator of database component(Uniform Resource Locator, URL) and inform URL etc., monitor URL for database component and Kubernetes fromNode is communicated, and informs that URL is communicated for database component with interface service component.
In S402, the interface service component, the control assembly and the scheduling component are disposed successively, whereinThe address of the Kubernetes host nodes is configured according to the configuration file.
After the completion of database component deployment, continue deployment interface serviced component.As shown in fig. 7, in the main sections of KubernetesIn point, interface service component is responsible for carrying out data interaction with database component, it is worth mentioning at this point that, in addition to interface service componentOutside, other node components of Kubernetes host nodes will not immediate operand according to library component.Interface service component isThe data center of Kubernetes host nodes manages the application programming interface of Kubernetes clusters.Configure interface serviceThe process of component is similar with configuration data library component, only when configuring the corresponding Parameter File of interface service component, mainly fromExtracted in configuration file interface service component address of service and it is above-mentioned inform URL, and be added in Parameter File.It is logicalIt crosses the configuration in the Parameter File of interface service component and informs that URL, Convenient interface serviced component can be by informing that URL accesses numberAccording to library component, and address of service be other node components for convenience in addition to interface service component and database component canData interaction is carried out with interface service component.
Control assembly is the management control center of Kubernetes clusters, ensures various resources in Kubernetes clustersState is in normal condition, and when monitoring that some resource status is abnormal in Kubernetes clusters, control assembly can triggerScheduling operation, control assembly include Node Controller (Node Controller) and copy controller (ReplicationController) etc..It dispatches component to be responsible for carrying out layout to the container in Kubernetes clusters, is specifically responsible for dispatching in containerTo specific Kubernetes from node.Scheduling component is monitored by the application programming interface that interface service component provides to be heldDevice, acquisition waits for scheduling container, and is ranked up from node to each Kubernetes according to preset ordering mechanism, by container tuneDegree is to the first Kubernetes that sorts from node.To control assembly and dispatch component configuration process with it is above-mentioned to database groupThe configuration process of part is similar, only in the corresponding Parameter File of configuration control assembly and in the corresponding parameter of configuration schedules componentWhen file, the address of Kubernetes host nodes is obtained from configuration file, and is added in Parameter File.It is worth mentioningIt is the address for the control assembly that control assembly and scheduling component are normally at the same node, therefore configure itself and scheduling componentThe address of itself is usually identical.After database component, interface service component, control assembly and scheduling deployment of components,Indicate that Kubernetes host nodes build completion.
Optionally, after all node components that configuration completes under Kubernetes host nodes, system domain name system is created(Domain Name System, DNS) is serviced, and after Kubernetes cluster internals create DNS service, can be passed through between containerDomain name lookup service, convenient for building service between container.
Optionally, dashboard is created, dashboard is the user interface of Kubernetes clusters, is passed through convenient for userDashboard checked and operated to the resource of Kubernetes clusters, and the user experience is improved.
By embodiment illustrated in fig. 4 it is found that in embodiments of the present invention, Ansible tools are according to appointing in drama componentDatabase component, interface service component, control assembly and scheduling component are disposed in business successively, wherein in deployment database componentWhen, network configuration data is obtained from configuration file, and network configuration data is loaded onto the corresponding parameter text of database componentIn part, when disposing control assembly and scheduling component, the address of Kubernetes host nodes is obtained from configuration file, by the groundLocation is loaded onto in the corresponding Parameter File of control assembly Parameter File corresponding with scheduling component, is carried out according to orderThe deployment of each node component of Kubernetes host nodes reduces error possibility, improves and build Kubernetes host nodesOrder.
It is on the basis of the embodiment of the present invention four, when disposing the node component of Kubernetes host nodes shown in Fig. 5Generate a kind of method that safety certificate obtains.An embodiment of the present invention provides built automatically based on Ansible toolsThe implementation flow chart of the method for Kubernetes host nodes, as shown in figure 5, this method may comprise steps of:
In S501, the first safety certificate and the second safety certificate are generated based on the configuration file, wherein the first safetyCertificate is used to control the access rights of the database component, and the second safety certificate is used to control the visit of the interface service componentAsk permission.
In embodiments of the present invention, since database component and interface service component often carry out data interaction, therefore in order toThe safety for promoting above-mentioned two node component automatically generates the first safety when disposing database component according to configuration fileCertificate and the second safety certificate, the first safety certificate and the second safety certificate are all security socket layer (Secure SocketLayer, SSL) certificate.Wherein, access rights of first safety certificate for component of controlling database, the second safety certificate are used forThe access rights of control interface serviced component.
In S502, first safety certificate is configured to the database component and the interface service component, andSecond safety certificate is configured to the interface service component.
First safety certificate is configured into database component and interface service component, configuration is completed and by database componentAfter corresponding startup service document is configured to starting up, Kubernetes from node and interface service component with database groupBefore part carries out data interaction, it is required for the verification by the first safety certificate.Similarly, the second safety certificate is configured to interfaceIn serviced component, after configuration is completed and configures the corresponding startup service document of interface service component to starting up,Kubernetes before carrying out data interaction with interface service component, is required for testing by the second safety certificate from nodeCard.It is noted that step S501 and step S502 can be previously written in the task of Ansible tool drama components,It is automatically configured with realizing.
By embodiment illustrated in fig. 5 it is found that in embodiments of the present invention, based on configuration file generate the first safety certificate andSecond safety certificate, and the first safety certificate is configured into database component and interface service component, with group of controlling databaseThe access rights of part configure the second safety certificate into interface service component, with the access rights of control interface serviced component,Improve the safety of Kubernetes host nodes and Kubernetes clusters.
In an alternative embodiment of the invention, proprietary network can be based on and realizes Kubernetes host nodes and Kubernetes collectionGroup's builds, as shown in figure 8, providing the regional structure figure based on Kubernetes clusters.First to each structure in Fig. 8It illustrates, user's proprietary network (Virtual Private Cloud, VPC) is the self-defined private network that user creates, noLogic isolation between same proprietary network, user can create and manage cloud host in the proprietary network of oneself, realize that load is equalThe functions such as weighing apparatus, safe access control, VPC1 and VPC2 are the proprietary networks that different user creates.Available area is for cloud platform serviceThe region of specific service, including common service area and the regions specific user VPC are provided, the ECA and SCA in Fig. 8 are available areaTwo examples, respectively represent East China A and south China area A.Common service area is for disposing the journey for providing specific service to the userSequence or service, can be with user's VPC intercommunications, and interior common service area includes resource pool, and resource pool is the set of enabled node,Package Server represent binary file server, and master1 and master2 in resource pool etc. represent enabled node,And the node in VPC1 and VPC2 is for building Kubernetes from isolated by default between node, the user VPC of different user.PipeReason area is general designation relative to available area higher level, can be managed to common service area by Ansible tools, can be withIt is interpreted as above-mentioned and builds main body.Manager in Fig. 8 in directorial area represents Kubernetes Manager, is that can manageThe management program of Kubernetes clusters.
In addition, the DB being connect with Manager in the directorial area of Fig. 8 represents database, the etcd clusters being connect with ManagerRepresenting database component cluster, wherein database for storing data, in fig. 8, put up in advance by database component, andIt is used as database component cluster in directorial area, Kubernetes host nodes, portion are subsequently built in the enabled node of resource poolWhen affixing one's name to multiple node components of Kubernetes host nodes, if being related to database component, it is only necessary to by the ground of database componentIt is directed toward database component cluster in location.As shown in figure 8, Kubernetes Manager are by calling Ansible tools to public clothesMultiple enabled nodes in business area are managed, and when needing to dispose Kubernetes host nodes, Kubernetes Manager are logicalCalling Ansible tools are crossed, node to be disposed corresponding with configuration file is chosen from multiple enabled nodes in resource pool, andKubernetes host nodes are disposed in the node to be disposed.After the completion of deployment, the node under user VPC can be configured toKubernetes forms Kubernetes clusters from node, with Kubernetes host nodes.The embodiment of the present invention passes through in userProprietary network under build Kubernetes host nodes and Kubernetes clusters, ensure that between different Kubernetes clustersIsolation.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each processExecution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limitIt is fixed.
Fig. 6 shows the structure diagram of terminal device provided in an embodiment of the present invention, each unit which includesFor executing each step in the corresponding embodiments of Fig. 1.It is retouched referring specifically to Fig. 1 is related in the embodiment corresponding to Fig. 1It states.For convenience of description, only the parts related to this embodiment are shown.
Referring to Fig. 6, the terminal device includes:
Adding device 61, for by it is input by user be added to the relevant establishment parameter of Kubernetes host nodes it is defaultConfiguration template, generate configuration file;
Determination unit 62, for determining node to be disposed corresponding with the configuration file in multiple enabled nodes,In, the enabled node is available physical node or virtual machine node;
Call unit 63 is built based on the configuration file in the node to be disposed for calling Ansible toolsThe Kubernetes host nodes.
Optionally, the determination unit 62 further includes:
Detection unit is building the main sections of the Kubernetes for detecting to whether there is in the multiple enabled nodePoint or the node for having built the Kubernetes host nodes;
Execution unit, if in the multiple enabled node there is no building the Kubernetes host nodes orThe node of the Kubernetes host nodes has been built, then has executed the determining and configuration file in multiple enabled nodesThe operation of corresponding node to be disposed.
Optionally, the call unit 63, including:
Acquiring unit, for from binary file server obtain with the Kubernetes host nodes associated two intoConfiguration file processed;
Start unit, for starting preset drama component in the Ansible tools, so that the Ansible toolsThe binary profile file is installed in the node to be disposed according to the drama component, and configures the KubernetesThe running environment of host node.
Optionally, Kubernetes host nodes include database component, interface service component, control assembly and scheduling groupPart, the start unit, including:
Deployment unit, for disposing the database component by the Ansible tools, wherein from configuration textNetwork configuration data is obtained in part, and the network configuration data is loaded onto the database component;
Deployment unit successively, for disposing the interface service component, the control assembly and the scheduling group successivelyPart, wherein the address of the Kubernetes host nodes is configured according to the configuration file.
Optionally, the terminal device further includes:
Certificates constructing unit, for generating the first safety certificate and the second safety certificate based on the configuration file, whereinFirst safety certificate is used to control the access rights of the database component, and the second safety certificate is for controlling the interface serviceThe access rights of component;
Dispensing unit, for configuring first safety certificate to the database component and the interface service groupPart, and second safety certificate is configured to the interface service component.
Therefore, terminal device provided in an embodiment of the present invention realizes Kubernetes host nodes by Ansible toolsIt is automatic build, reduce manual operation, improve the efficiency that Kubernetes host nodes are built.
Fig. 9 is the schematic diagram of terminal device provided in an embodiment of the present invention.As shown in figure 9, the terminal device 9 of the embodimentIncluding:Processor 90, memory 91 and it is stored in the calculating that can be run in the memory 91 and on the processor 90Machine program 92.The processor 9 realizes above-mentioned each built automatically based on Ansible tools when executing the computer program 9Step in the embodiment of the method for Kubernetes host nodes, such as step S101 to S103 shown in FIG. 1.Alternatively, the placeReason device 90 realizes the function of each unit in above-mentioned each terminal device embodiment, such as Fig. 6 institutes when executing the computer program 92Show the function of unit 61 to 63.
Illustratively, the computer program 92 can be divided into one or more units, one or more ofUnit is stored in the memory 91, and is executed by the processor 90, to complete the present invention.One or more of listsMember can complete the series of computation machine program instruction section of specific function, and the instruction segment is for describing the computer journeyImplementation procedure of the sequence 92 in the terminal device 9.For example, the computer program 92 can be divided into adding device, reallyOrder member and call unit, each unit concrete function are as follows:
Adding device, for by it is input by user be added to the relevant establishment parameter of Kubernetes host nodes it is presetConfiguration template generates configuration file;
Determination unit, for determining node to be disposed corresponding with the configuration file in multiple enabled nodes, whereinThe enabled node is available physical node or virtual machine node;
Call unit builds institute based on the configuration file for calling Ansible tools in the node to be disposedState Kubernetes host nodes.
The terminal device 9 can be that the calculating such as desktop PC, notebook, palm PC and cloud server are setIt is standby.The terminal device 9 may include, but be not limited only to, processor 90, memory 91.It will be understood by those skilled in the art that figure9 be only the example of terminal device 9, does not constitute the restriction to terminal device 9, may include than illustrating more or fewer portionsPart either combines certain components or different components, such as the terminal device 9 can also include input-output equipment, netNetwork access device, bus etc..
Alleged processor 90 can be central processing unit (Central Processing Unit, CPU), can also beOther general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processorDeng.
The memory 91 can be the internal storage unit of the terminal device 9, such as the hard disk of terminal device 9 or interiorIt deposits.The memory 91 can also be to be equipped on the External memory equipment of the terminal device 9, such as the terminal device 9Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodgeDeposit card (Flash Card) etc..Further, the memory 91 can also both include the storage inside list of the terminal device 9Member also includes External memory equipment.The memory 91 is for storing needed for the computer program and the terminal device 9Other programs and data.The memory 91 can be also used for temporarily storing the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work(Can unit division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different functionsUnit is completed, i.e., the internal structure of described device is divided into different functional units, with complete it is described above whole orPartial function.Each functional unit in embodiment can be integrated in a processing unit, can also be the independent object of each unitReason exists, can also be during two or more units are integrated in one unit, and hardware both may be used in above-mentioned integrated unitForm realize, can also be realized in the form of SFU software functional unit.In addition, the specific name of each functional unit is also onlyConvenient for mutually distinguishing, the protection domain that is not intended to limit this application.The specific work process of unit in above system, can be withWith reference to the corresponding process in preceding method embodiment, details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodimentThe part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may realize that lists described in conjunction with the examples disclosed in the embodiments of the present disclosureMember and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actuallyIt is implemented in hardware or software, depends on the specific application and design constraint of technical solution.Professional technicianEach specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceedThe scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed terminal device and method can pass through itIts mode is realized.For example, terminal device embodiment described above is only schematical, for example, the unit is drawnPoint, only a kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or component canTo combine or be desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or beg forThe mutual coupling or direct-coupling or communication connection of opinion can be the INDIRECT COUPLING by some interfaces, device or unitOr communication connection, can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unitThe component shown may or may not be physical unit, you can be located at a place, or may be distributed over multipleIn network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can alsoIt is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.Above-mentioned integrated listThe form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent productWhen, it can be stored in a computer read/write memory medium.Based on this understanding, the present invention realizes above-described embodiment sideAll or part of flow in method can also instruct relevant hardware to complete, the computer by computer programProgram can be stored in a computer readable storage medium, and the computer program is when being executed by processor, it can be achieved that above-mentioned eachThe step of a embodiment of the method.Wherein, the computer program includes computer program code, and the computer program code canThink source code form, object identification code form, executable file or certain intermediate forms etc..The computer-readable medium can be withIncluding:Any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic disc, light of the computer program code can be carriedDisk, computer storage, read-only memory (Read-Only Memory, ROM), random access memory (Random AccessMemory, RAM), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that described computer-readableThe content that medium includes can carry out increase and decrease appropriate according to legislation in jurisdiction and the requirement of patent practice, such as at certainA little jurisdictions, according to legislation and patent practice, computer-readable medium does not include electric carrier signal and telecommunication signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned realityApplying example, invention is explained in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned eachTechnical solution recorded in embodiment is modified or equivalent replacement of some of the technical features;And these are changedOr replace, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution should allIt is included within protection scope of the present invention.