CN113835846A - Method and device for creating k8s cluster and computer-readable storage medium - Google Patents

Method and device for creating k8s cluster and computer-readable storage medium Download PDF

Info

Publication number
CN113835846A
CN113835846A CN202111417207.5A CN202111417207A CN113835846A CN 113835846 A CN113835846 A CN 113835846A CN 202111417207 A CN202111417207 A CN 202111417207A CN 113835846 A CN113835846 A CN 113835846A
Authority
CN
China
Prior art keywords
cluster
creating
low
creation
virtual
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.)
Granted
Application number
CN202111417207.5A
Other languages
Chinese (zh)
Other versions
CN113835846B (en
Inventor
熊巍迤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Mingyuan Cloud Technology Co Ltd
Original Assignee
Shenzhen Mingyuan Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Mingyuan Cloud Technology Co Ltd filed Critical Shenzhen Mingyuan Cloud Technology Co Ltd
Priority to CN202111417207.5A priority Critical patent/CN113835846B/en
Publication of CN113835846A publication Critical patent/CN113835846A/en
Application granted granted Critical
Publication of CN113835846B publication Critical patent/CN113835846B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/301Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is a virtual computing platform, e.g. logically partitioned systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Abstract

The invention discloses a method, a device and a computer-readable storage medium for creating a k8s cluster, wherein the method comprises the following steps: creating a virtual cluster based on the virtual machine; mapping, by a synchronizer, low-level resources in a first data store of a virtual cluster into a second data store of a host cluster; and the creation of the k8s cluster is completed based on the host cluster scheduler listening to the low-level resources. The method has the advantages that the effect of reducing the creating overhead of the k8s cluster is realized on the premise of not losing the computing power, the network performance and the storage performance of the k8s cluster, and the difficulty of maintaining and managing the k8s cluster by later-period maintenance personnel is reduced, so that a user can realize the creation of a plurality of k8s clusters on the basis of one terminal device, and the later-period maintenance personnel can realize the maintenance and management of the plurality of k8s clusters on the basis of one terminal device.

Description

Method and device for creating k8s cluster and computer-readable storage medium
Technical Field
The present invention relates to the field of k8s clusters, and in particular, to a method and an apparatus for creating a k8s cluster, and a computer-readable storage medium.
Background
In some computer-based operations, such as persistent integration, running tests, etc., it is often necessary to deploy multiple independent k8s (kubernets, container cluster management system) clusters. The standard k8s cluster is complex to create, occupies a lot of resources, and is difficult to maintain, and in any case, a plurality of independent k8s clusters are deployed, whereas the method for creating the k8s cluster in the prior art causes a problem of high cost for creating the k8s cluster in order to maintain the computing power, the network performance and the storage performance of the k8s cluster, and the cost of the k8s cluster created according to the prior art for terminal devices is very high, and often, one or more terminal devices are needed for creation, maintenance and management of one k8s cluster, which indirectly causes very dispersion and difficulty in later maintenance and management of the k8s cluster.
Disclosure of Invention
The invention mainly aims to provide a method and a device for creating a k8s cluster and a computer readable storage medium, and aims to solve the technical problem of reducing the creation overhead of the k8s cluster on the premise of not losing the computing capacity, the network performance and the storage performance of the k8s cluster.
In order to achieve the above object, the present invention provides a method for creating a k8s cluster, where the method for creating a k8s cluster includes the following steps:
creating a virtual cluster based on the virtual machine;
mapping, by a synchronizer, low-level resources in a first data store of a virtual cluster into a second data store of a host cluster;
and the creation of the k8s cluster is completed based on the host cluster scheduler listening to the low-level resources.
Optionally, the step of creating a virtual cluster based on a virtual machine includes:
and building a running environment which is the same as the host machine cluster based on the virtual machine, and replacing a scheduler in the running environment with a synchronizer to create a virtual cluster.
Optionally, before the step of mapping the low-level resources in the virtual cluster data storage library to the data storage library of the host cluster through the synchronizer, the method further includes:
creating, by an api-server component, a high-level resource in the first data store;
the automatic generation of the low-level resource in the first data storage library is accomplished by a controller listening for the high-level resource.
Optionally, after the step of listening, by the controller, for the high-level resource and completing the automatic generation of the low-level resource in the first data storage library, the method further includes:
deploying a pod resolving the DNS domain name based on the generated low-level resource.
Optionally, before the step of listening to the low-level resource by the host cluster-based scheduler and completing the creation of the k8s cluster, the method further includes:
and resolving the DNS domain name of the low-level resource through the pod, and mapping the resolved DNS domain name to a corresponding host cluster through the synchronizer.
Optionally, the step of completing the creation of the k8s cluster if the low-level resource is monitored by the scheduler based on the host cluster includes:
monitoring the low-level resources based on a scheduler of the host cluster to complete the creation of container resources;
receiving the container resource and completing the creation of the k8s cluster based on the container resource.
Optionally, after the step of creating a k8s cluster by listening to the low-level resource by the host cluster-based scheduler, the method further includes:
and maintaining and managing the k8s cluster based on the virtual cluster.
Optionally, after the step of maintaining and managing the k8s cluster based on the virtual cluster, the method further includes:
if the low-level resources in the first data storage library are detected to be changed, the synchronizer automatically maps the changed low-level resources into the second data storage library, and the updating of the k8s cluster is completed.
In addition, in order to achieve the above object, the present invention further provides a device for creating a k8s cluster, including a memory, a processor, and a creation processing program of a k8s cluster stored in the memory and operable on the processor, where the creation processing program of the k8s cluster is executed by the processor to implement the steps of the method for creating the k8s cluster.
Further, to achieve the above object, the present invention also provides a computer-readable storage medium, on which a creation program of a k8s cluster is stored, the creation program of the k8s cluster, when being executed by a processor, implementing the steps of the above-described creation method of the k8s cluster.
The invention makes the low-level resources on the virtual cluster mapped to the host cluster by installing the synchronizer on the virtual cluster end of the terminal equipment, avoids the problem of high expense of k8s cluster creation caused by directly obtaining the low-level resources on the server of the terminal equipment, monitors the low-level resources by the scheduler based on the host cluster to obtain the container resources, the server of the terminal equipment can directly complete the creation of a k8s cluster based on the container resources, avoids the problem of difficult maintenance of a k8s cluster caused by the dispersion of the k8s cluster caused by only deploying single-point nodes for reducing the expense, achieves the effect of directly using the network and the storage of one terminal equipment without other extra expenses by completing the creation of the head of the low-level resources and the k8s cluster on the virtual cluster and the host cluster of the terminal equipment, and can realize the creation and the maintenance of the k8s cluster without other extra expenses, the method reduces the creation cost in the early stage and simultaneously reduces the problem of difficult maintenance of later-stage maintenance personnel.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an embodiment of a method for creating a k8s cluster according to the present invention;
FIG. 3 is a detailed flowchart of step S20 in FIG. 2;
FIG. 4 is a detailed flowchart of step S30 in FIG. 2;
fig. 5 is a schematic diagram of an interaction flow between a virtual cluster and a host cluster.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows: by building the virtual cluster and the host cluster on the terminal device, the creation of the k8s cluster of the terminal device does not depend on the server of the terminal device any more, the burden and the expense of the server of the terminal device are reduced, and the computing capacity, the network performance and the storage performance of the k8s cluster are not influenced because the operating environments of the virtual cluster and the host cluster are basically the same.
In the prior art, the overhead caused by a large amount of occupied resources exists when a standard k8s cluster is created, and if the overhead is reduced, the computing capacity, the network performance and the storage performance of the k8s cluster are reduced, so that a scheme for reducing the creation overhead of the k8s cluster on the premise of not losing the computing capacity, the network performance and the storage performance of the k8s cluster is urgently needed.
According to the solution provided by the invention, a user can realize corresponding function response of the smart television without a television remote controller by only starting a multi-mode interaction mode at the television end, and the corresponding television function response is automatically realized according to the biological characteristic information and the interaction characteristic information of the user, so that the use feeling of the user is improved, the watching experience degree of the user is further improved, and the intellectualization and the convenience of the smart television are reflected.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention.
The creating device of the k8s cluster in the embodiment of the present invention may be a mobile terminal device with a display function, such as a PC, a tablet computer, or a portable computer.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Optionally, the creation device may further include a camera, RF (Radio Frequency) circuitry, sensors, audio circuitry, a WiFi module, and so on. Such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display screen according to the brightness of ambient light, and a proximity sensor that may turn off the display screen and/or the backlight when the mobile terminal is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when the mobile terminal is stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer and tapping) and the like for recognizing the attitude of the mobile terminal; of course, the smart television may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which are not described herein again.
Those skilled in the art will appreciate that the creator configuration shown in fig. 1 does not constitute a limitation of the creator configuration, and may include more or less components than those shown, or combine certain components, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a creation processing program of a k8s cluster.
In the creating apparatus shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call the creation handler for the k8s cluster stored in the memory 1005 and perform the following operations:
creating a virtual cluster based on the virtual machine;
mapping, by a synchronizer, low-level resources in a first data store of a virtual cluster into a second data store of a host cluster;
and the creation of the k8s cluster is completed based on the host cluster scheduler listening to the low-level resources.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
the step of creating a virtual cluster based on the virtual machine includes: and building a running environment which is the same as the host machine cluster based on the virtual machine, and replacing a scheduler in the running environment with a synchronizer to create a virtual cluster.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
creating, by an api-server component, a high-level resource in the first data repository prior to the step of mapping, by a synchronizer, a low-level resource in a virtual cluster data repository into a data repository of a host cluster;
the automatic generation of the low-level resource in the first data storage library is accomplished by a controller listening for the high-level resource.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
and monitoring the high-level resource through a controller, and deploying a pod for resolving the DNS domain name based on the generated low-level resource after the step of automatically generating the low-level resource in the first data storage library is completed.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
and monitoring the low-level resources by a dispatcher based on the host cluster, resolving the DNS domain name of the low-level resources through the pod before completing the step of creating the k8s cluster, and mapping the resolved DNS domain name into the corresponding host cluster through the synchronizer.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
the step of completing the creation of the k8s cluster based on the host cluster's scheduler listening to the low level resources comprises: monitoring the low-level resources based on a scheduler of the host cluster to complete the creation of container resources;
receiving the container resource and completing the creation of the k8s cluster based on the container resource.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
and after the step of creating the k8s cluster is completed based on the monitoring of the low-level resources by the scheduler of the host cluster, maintaining and managing the k8s cluster based on the virtual cluster.
Further, the processor 1001 may call the create handler of the k8s cluster stored in the memory 1005, and also perform the following operations:
after the step of maintaining and managing the k8s cluster based on the virtual cluster, if a low-level resource in the first data repository is detected to be changed, the synchronizer automatically maps the changed low-level resource to the second data repository, and completes the update of the k8s cluster.
Referring to fig. 2, an embodiment of the present invention provides a method for creating a k8s cluster, where the method for creating a k8s cluster includes:
step S10, referring to fig. 5, creating a virtual cluster based on the virtual machine;
it should be noted that the execution subject of the present application is a terminal device, and the virtual machine is application software running on the terminal device.
The virtual machine technology used in the application is to virtualize a memory in an operating system of the terminal device, and because a memory space required by the actual operation of the creation of the k8s cluster is far larger than the size of the memory of the terminal device, in order to implement the creation of the k8s cluster on one terminal device, a user can virtualize a part of hard disks into the memory by using the memory virtualization technology, and divide the terminal device into a plurality of virtual terminal devices, so that one terminal device can simultaneously operate a plurality of operating systems, thereby implementing the creation and management of the k8s cluster on one terminal device, and reducing the overhead of additional terminal devices.
As shown in fig. 5, the virtual cluster created on the virtual machine is substantially the same as the control plane of the k8s cluster, except that the scheduler on the control plane of the k8s cluster is replaced with a synchronizer, wherein the synchronizer corresponds to a communication channel for connecting the host clusters of end devices. Wherein, the data storage is a data storage library.
The virtual cluster replaces the functions of resource creation and low-level resource automatic generation in a data storage library in a control plane of a k8s cluster, and can reduce the burden and the overhead of creating a k8s cluster by terminal equipment, because one virtual cluster can create one k8s cluster and one virtual machine can create a plurality of virtual clusters, thereby indirectly realizing the effect of creating and managing a plurality of k8s clusters on one terminal equipment.
Optionally, the step of creating a virtual cluster based on the virtual machine in step S10 includes:
step A, building a running environment which is the same as the host cluster based on the virtual machine, and replacing a scheduler in the running environment with a synchronizer to create a virtual cluster.
The host cluster, the control plane of the k8s cluster that actually exists in the operating system, can actually run in the terminal device.
The control plane of the k8s cluster can provide a channel for a user to create high-level resources in a data storage library and transmit low-level resources automatically generated based on the high-level resources to the host cluster, so that the end device can complete the creation of the k8s cluster.
And replacing the scheduler in the operating environment with a synchronizer in order to be able to transfer the low-level resources generated in the virtual cluster to the host cluster, wherein the synchronizer can be regarded as a communication channel, which is used for establishing a connection between the virtual cluster of the virtual machine and the host cluster of the terminal device, so that the low-level resources in the virtual cluster can be transferred to the host cluster, thereby playing a role of resource mapping.
Step S20, mapping the low-level resources in the first data storage library of the virtual cluster to the second data storage library of the host cluster through the synchronizer;
the first data repository refers to a data repository located in a virtual cluster for storing high-level resources created by users and low-level resources generated based on the high-level resources.
The second data repository is a data repository located in the host cluster, and is configured to store the received low-level resource, and start an api-server (Application Programming Interface-server), a second data repository, and a controller in the host cluster based on the low-level resource.
And step S30, monitoring the low-level resources based on the scheduler of the host cluster, and completing the creation of the k8S cluster.
The scheduler mainly has the function of enabling each node of the k8s cluster to be allocated with low-level resources by monitoring the low-level resources, enabling all the resources in the cluster to be used to the maximum, and further completing the creation of the k8s cluster, wherein the process of scheduling the low-level resources by the scheduler is divided into three parts, the first part is used for filtering cluster nodes which do not meet the cluster conditions, the second part is used for sorting the cluster nodes which meet the cluster conditions according to priority, and the third part is used for selecting the stage with the highest priority from the sorted cluster nodes.
The low-level resources are automatically generated based on the controller listening to the high-level resources, which are the basis for generating the k8s cluster.
The k8s cluster is a container cluster management system, can provide functions such as application deployment, maintenance, extension mechanism and the like, and can conveniently manage the cross-cluster operation of containerized applications.
Optionally, in step S30, the step of completing the creation of the k8S cluster based on the host cluster scheduler listening to the low-level resources includes:
step B1, based on the host cluster scheduler to monitor the low-level resource, completing the creation of container resource;
step B2, receiving the container resource, and completing the creation of k8s cluster based on the container resource.
The scheduler listens to the received low level resources for the purpose of container scheduling, i.e. container creation.
The container refers to a unit capable of running business services or applications, one or more containers can be run in a pod (place Old Documentation), and the pod is a basis for executing the container on the k8s cluster, so that the container, the pod and the k8s cluster have a symbiotic relationship.
The host cluster is also present in the terminal device, and is used for completing the creation of the k8s cluster, unlike the virtual cluster, which is present in a virtual machine, and is simulated by a user, and is virtual, and the code present between an operating system and the terminal device, and the host cluster is present in the operating system, and the role of the host cluster is really acting on the terminal device, so the host cluster in the application is equivalent to an agent for completing the creation of the k8s cluster. For example, the virtual cluster is a shopping website, the terminal device is a purchaser, the host cluster is equivalent to an agent for helping the purchaser to shop on the shopping website, and plays a role of helping the purchaser to shop, i.e., generating a container, and the container generated in the host cluster directly acts on the terminal device, so that the terminal device can create a plurality of k8s clusters without additional overhead.
In this embodiment, by building a virtual cluster on a virtual machine of a terminal device, the terminal device can expand a hard disk memory of the terminal device without depending on an additional terminal device, and thus, the cost required for creating a k8s cluster is reduced, by building a virtual cluster in the same operating environment on the virtual machine, the computing power, network performance and storage performance of the generated k8s cluster can be kept consistent with those of a k8s cluster generated by a large overhead in the prior art, and the effect of reducing the creation cost of the k8s cluster can still be achieved on the premise of not losing the computing power, network performance and storage performance of the k8s cluster, and by using a synchronizer to directly map low-level resources into a host cluster, that is, a situation that the cost is large when the terminal device generates low-level resources can be avoided, and a situation that resources are lost when the low-level resources are transmitted to the host cluster can be avoided, by doing the creation of the container on the host cluster, the overhead required to create the k8s cluster can still be reduced.
Further, referring to fig. 3, an embodiment of the present invention provides a method for creating a k8S cluster, where based on the embodiment shown in step S20, before the step of mapping low-level resources in a virtual cluster data storage library to a data storage library of a host cluster through a synchronizer, the method further includes:
step S21, referring to fig. 5, creating a high-level resource in the first data repository through the api-server component;
a user can provide various resource objects required by the k8s, such as pod, RC, Service and the like, based on the api-server component, the original high-level resources in the virtual cluster are empty, and after the creation of the resources such as pod, RC, Service and the like is detected, the high-level resources are deployed so as to have the functions of online deployment, copy setting, rolling upgrade, rollback and the like, so that the creation of the high-level resources in the first data storage library is realized, and the effect of reducing the creation overhead of the k8s cluster is achieved on the premise of not changing the original creation process of the k8s cluster.
Step S22, referring to fig. 5, the controller listens to the high-level resource to complete the automatic generation of the low-level resource in the first data storage library.
As shown in fig. 5, listening for the created deployment, i.e., high level resource, by the controller in the virtual cluster automatically generates a pod, i.e., low level resource.
In the prior art, the creation of high-level resources and the generation of low-level resources are both performed directly on a server of a terminal device, and because the memory size of the terminal device is far smaller than the memory size required for the actual operation of the creation of the k8s cluster, only one terminal device is far from being used to meet the creation of the k8s cluster, and the creation of the k8s cluster can be realized with the assistance of additional terminal devices, and such a creation scheme directly causes the creation overhead of the k8s cluster to be large, and a later-maintenance person can also face the problem of decentralized maintenance and management caused by the decentralized k8s cluster. In the application, by creating the high-level resources and generating the low-level resources on the virtual machine of the terminal device, because the virtual machine can set the memory size of the virtual hard disk, the memory size of the virtual machine required by the creation of the k8s cluster can be satisfied, and because the virtual machine exists on the terminal device, the resources created and generated on the virtual machine can be directly mapped onto the host cluster based on the synchronizer, so that the indirect creation of the container is realized, that is, the creation overhead of the k8s cluster is reduced, the problems of the loss of the computing power, the network performance and the storage performance of the k8s cluster caused by the reduction of the creation overhead of the cluster can be avoided, and the later-period maintenance personnel can intensively maintain and manage the k8s cluster.
Optionally, the listening, by the controller, of the high-level resource in step S22, and after the step of automatically generating the low-level resource in the first data storage library is completed, the method further includes:
and step C, deploying a pod for resolving the DNS domain name based on the generated low-level resource.
The function of the pod herein is added in the present application, because a Domain Name System (DNS) Domain Name for network access in a virtual cluster is not available, a pod running a special resolution DNS Domain Name needs to be deployed, so that the DNS Name of a low-level resource on the virtual cluster can be correctly resolved to a corresponding host cluster.
Wherein the DNS domain name corresponds to an address, and the correct DNS domain name can make the user more convenient to access and manage the k8s cluster.
In this embodiment, by creating high-level resources and generating low-level resources on the virtual cluster, the burden and overhead of the terminal device are reduced, the integrity of the creation process of the k8s cluster can be ensured, and by using the generated low-level resources, a pod for resolving a DNS domain name is deployed, thereby avoiding the situation that later-stage maintenance personnel cannot access and manage the k8s cluster quickly and conveniently due to incorrect DNS mapping to the host cluster.
Further, referring to fig. 4, an embodiment of the present invention provides a method for creating a k8S cluster, where based on the embodiment shown in step S30, after the step of listening to the low-level resource by the scheduler based on the host cluster and completing the creation of the k8S cluster, the method further includes:
and step S31, maintaining and managing the k8S cluster based on the virtual cluster.
After the k8s cluster is created, a user can maintain and manage the created k8s cluster through a virtual cluster on one terminal device, and maintenance of the k8s cluster corresponding to a later-period maintenance person is facilitated.
Optionally, after the step of maintaining and managing the k8S cluster based on the virtual cluster in step S31, the method further includes:
and step D, if the low-level resources in the first data storage library are detected to be changed, the synchronizer automatically maps the changed low-level resources into the second data storage library, and the updating of the k8s cluster is completed.
In order to complete the update of the k8s cluster and avoid the business service or system suspension caused by untimely update, the synchronizer still maps the changed low-level resources into the second data storage library, so that the scheduler in the host cluster can complete the update of the container resources, and then the update of the k8s cluster is completed.
In this embodiment, the k8s cluster is directly maintained and managed in the virtual cluster on the virtual machine, so that the operation of the user on the maintenance and management of the k8s cluster is simpler and faster, the problem that the maintenance and management of the k8s cluster are complex and difficult due to the independent characteristic of the created k8s cluster in the prior art is solved, the user can maintain and manage a plurality of k8s clusters only on one virtual machine of the terminal device, the inconvenience of distributed maintenance and management caused by a plurality of distributed k8s clusters is avoided, and the time and effort of the user on the maintenance and management of the k8s cluster in the later period are reduced.
In addition, an embodiment of the present invention further provides a device for creating a k8s cluster, where the device for creating a k8s cluster includes a memory, a processor, and a creating processing program of a k8s cluster that is stored in the memory and is executable on the processor, and the processor implements the steps of the method for creating a k8s cluster when executing the creating processing program of the k8s cluster.
Furthermore, the present invention also provides a computer-readable storage medium, on which a creating program of the k8s cluster is stored, and when being executed by a processor, the creating program based on the k8s cluster realizes the steps of the creating method of the k8s cluster.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for creating a k8s cluster, wherein the method for creating a k8s cluster is applied to a terminal device, and the method comprises the following steps:
creating a virtual cluster based on the virtual machine;
mapping, by a synchronizer, low-level resources in a first data store of a virtual cluster into a second data store of a host cluster;
and the creation of the k8s cluster is completed based on the host cluster scheduler listening to the low-level resources.
2. The method of claim 1, wherein the step of creating a virtual cluster based on a virtual machine comprises:
and building a running environment which is the same as the host machine cluster based on the virtual machine, and replacing a scheduler in the running environment with a synchronizer to create a virtual cluster.
3. The method of creating a k8s cluster of claim 1 wherein prior to the step of mapping the low level resources in the virtual cluster data store into the data store of the host cluster through the synchronizer, further comprising:
creating, by an api-server component, a high-level resource in the first data store;
the automatic generation of the low-level resource in the first data storage library is accomplished by a controller listening for the high-level resource.
4. The method of creating a k8s cluster of claim 3, wherein the step of automatically generating the low level resource in the first data store by the controller listening to the high level resource is followed by further comprising:
deploying a pod resolving the DNS domain name based on the generated low-level resource.
5. The method for creating a k8s cluster as claimed in claim 4, wherein before the step of completing the creation of the k8s cluster by the host cluster based scheduler listening to the low level resources, the method further comprises:
and resolving the DNS domain name of the low-level resource through the pod, and mapping the resolved DNS domain name to a corresponding host cluster through the synchronizer.
6. The method for creating a k8s cluster as claimed in claim 1, wherein the step of completing the creation of the k8s cluster by the host cluster based scheduler listening to the low level resources comprises:
monitoring the low-level resources based on a scheduler of the host cluster to complete the creation of container resources;
receiving the container resource and completing the creation of the k8s cluster based on the container resource.
7. The method for creating a k8s cluster according to claim 1, wherein the host cluster based scheduler listens to the low level resources and after the step of creating a k8s cluster is completed, the method further comprises:
and maintaining and managing the k8s cluster based on the virtual cluster.
8. The method for creating a k8s cluster as claimed in claim 7, wherein the step of maintaining and managing the k8s cluster based on the virtual cluster is followed by the steps of:
if the low-level resources in the first data storage library are detected to be changed, the synchronizer automatically maps the changed low-level resources into the second data storage library, and the updating of the k8s cluster is completed.
9. A k8s cluster creating apparatus, comprising a memory, a processor and a k8s cluster creating program stored in the memory and operable on the processor, wherein the processor executes the k8s cluster creating program to implement the steps of the k8s cluster creating method as claimed in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a creation program of a k8s cluster, the creation program of the k8s cluster, when executed by a processor, implementing the steps of the method of creation of a k8s cluster according to any one of claims 1 to 8.
CN202111417207.5A 2021-11-26 2021-11-26 Method and device for creating k8s cluster and computer-readable storage medium Active CN113835846B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111417207.5A CN113835846B (en) 2021-11-26 2021-11-26 Method and device for creating k8s cluster and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111417207.5A CN113835846B (en) 2021-11-26 2021-11-26 Method and device for creating k8s cluster and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN113835846A true CN113835846A (en) 2021-12-24
CN113835846B CN113835846B (en) 2022-04-08

Family

ID=78971596

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111417207.5A Active CN113835846B (en) 2021-11-26 2021-11-26 Method and device for creating k8s cluster and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN113835846B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180285164A1 (en) * 2017-03-28 2018-10-04 International Business Machines Corporation Managing system resources in containers and virtual machines in a coexisting environment
CN111124604A (en) * 2019-12-05 2020-05-08 北京金山云网络技术有限公司 Method, device, equipment and storage medium for allocating Pod (POD) IP addresses
CN111885123A (en) * 2020-07-06 2020-11-03 苏州浪潮智能科技有限公司 Construction method and device of cross-K8 s target service access channel
CN111901203A (en) * 2020-08-03 2020-11-06 北京启明星辰信息安全技术有限公司 Method for capturing network flow and Kubernetes cluster
CN112003961A (en) * 2020-08-14 2020-11-27 苏州浪潮智能科技有限公司 Resource exposure method, system, equipment and medium in kubernets
CN112671860A (en) * 2020-12-15 2021-04-16 杭州溪塔科技有限公司 Service access method, system, electronic device and medium for kubernets cluster
US20210141655A1 (en) * 2019-11-13 2021-05-13 Vmware, Inc. Unified resource management for containers and virtual machines
CN113452806A (en) * 2021-06-24 2021-09-28 上海道客网络科技有限公司 Container adaptation SDN network management method and system based on Kubernetes system
CN113687912A (en) * 2021-07-30 2021-11-23 济南浪潮数据技术有限公司 Container cluster management method, device and system, electronic equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180285164A1 (en) * 2017-03-28 2018-10-04 International Business Machines Corporation Managing system resources in containers and virtual machines in a coexisting environment
US20210141655A1 (en) * 2019-11-13 2021-05-13 Vmware, Inc. Unified resource management for containers and virtual machines
CN111124604A (en) * 2019-12-05 2020-05-08 北京金山云网络技术有限公司 Method, device, equipment and storage medium for allocating Pod (POD) IP addresses
CN111885123A (en) * 2020-07-06 2020-11-03 苏州浪潮智能科技有限公司 Construction method and device of cross-K8 s target service access channel
CN111901203A (en) * 2020-08-03 2020-11-06 北京启明星辰信息安全技术有限公司 Method for capturing network flow and Kubernetes cluster
CN112003961A (en) * 2020-08-14 2020-11-27 苏州浪潮智能科技有限公司 Resource exposure method, system, equipment and medium in kubernets
CN112671860A (en) * 2020-12-15 2021-04-16 杭州溪塔科技有限公司 Service access method, system, electronic device and medium for kubernets cluster
CN113452806A (en) * 2021-06-24 2021-09-28 上海道客网络科技有限公司 Container adaptation SDN network management method and system based on Kubernetes system
CN113687912A (en) * 2021-07-30 2021-11-23 济南浪潮数据技术有限公司 Container cluster management method, device and system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113835846B (en) 2022-04-08

Similar Documents

Publication Publication Date Title
US10467025B2 (en) Managing delivery of code and dependent data using application containers
CN107276789B (en) Log uploading method and device and computer readable storage medium
US20150339117A1 (en) Computing Device Update Control
US20130227085A1 (en) Terminal and method for using cloud services
CN111984269A (en) Method for providing application construction service and application construction platform
CN107577472B (en) Software installation method and device and computer readable storage medium
CN106469071B (en) Application theme changing method and device
CN102053871A (en) Application program image display method and device
CN111984270A (en) Application deployment method and system
KR102631745B1 (en) Method for controlling the execution of different operating systems, electronic device and storage medium therefor
CN113641413A (en) Target model loading and updating method and device, readable medium and electronic equipment
CN110489158B (en) Method, device, medium and electronic equipment for optimizing code hosting platform
CN113448650A (en) Live broadcast function plug-in loading method, device, equipment and storage medium
CN113835846B (en) Method and device for creating k8s cluster and computer-readable storage medium
CN113760325B (en) Container environment updating method and device
US10303462B2 (en) Windows support of a pluggable ecosystem for universal windows application stores
US20230221941A1 (en) Partitioned deployment of updates to cloud service based on centerally updated configuration store
CN107301089B (en) APP deployment and calling method and terminal
KR100677141B1 (en) Apparatus and Method for performing an one to one name-based socket-communication
CN114489892A (en) Data processing method, data processing device, computer readable storage medium and computer equipment
CN110209409B (en) Customization method and system of application product and storage medium
US11455318B2 (en) Data replication using probabilistic replication filters
CN111597021A (en) Method, device and system for realizing application program operation and related equipment
EP4304154A1 (en) Information processing device, information processing method, program, and information processing system
CN113110941B (en) Managing delivery of code and dependency data using application containers

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