CN116846865A - Domain name configuration method, device, electronic equipment and computer program product - Google Patents
Domain name configuration method, device, electronic equipment and computer program product Download PDFInfo
- Publication number
- CN116846865A CN116846865A CN202210306112.4A CN202210306112A CN116846865A CN 116846865 A CN116846865 A CN 116846865A CN 202210306112 A CN202210306112 A CN 202210306112A CN 116846865 A CN116846865 A CN 116846865A
- Authority
- CN
- China
- Prior art keywords
- domain name
- name configuration
- custom
- service
- etcd
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 65
- 238000004590 computer program Methods 0.000 title claims abstract description 23
- 238000012544 monitoring process Methods 0.000 claims description 19
- 238000013507 mapping Methods 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 9
- 238000004891 communication Methods 0.000 abstract description 7
- 230000000875 corresponding effect Effects 0.000 description 31
- 238000004458 analytical method Methods 0.000 description 10
- 238000007726 management method Methods 0.000 description 10
- 230000000694 effects Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000004888 barrier function Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/2866—Architectures; Arrangements
- H04L67/30—Profiles
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application relates to the technical field of communication and provides a domain name configuration method, a domain name configuration device, electronic equipment and a computer program product. The method comprises the following steps: based on the Kubernetes environment, deploying a custom domain name configuration service; by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified; the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment. The user-defined domain name configuration service deployed in the domain name configuration method provided by the embodiment of the application can serve the POD in the whole Kubernetes environment; the DNS records in the ETCD are newly added or modified by calling the custom domain name configuration service, the configuration can be immediately effective, the CoreDNS does not need to be restarted, and the normal operation of the Kubernetes cluster service is ensured.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a domain name configuration method, a domain name configuration device, an electronic device, and a computer program product.
Background
Currently, in the distributed micro-service deployment environment, some services between the minimum management units (PODs) need to be accessed through custom domain names. Custom domain name access can be supported by modifying DNS service resolution configuration to resolve custom domain names to specific service IPs to support inter-POD domain name access. But every time a domain name configuration is added or updated, the CoreDNS service needs to be restarted to validate the configuration, resulting in DNS resolution being temporarily unavailable.
Disclosure of Invention
The embodiment of the application provides a domain name configuration method, a device, electronic equipment and a computer program product, which are used for solving the technical problem that DNS resolution is temporarily unavailable because the CoreDNS service needs to be restarted to take effect configuration when domain name configuration is newly added or updated.
In a first aspect, an embodiment of the present application provides a domain name configuration method, including:
based on the Kubernetes environment, deploying a custom domain name configuration service;
by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
In one embodiment, the deploying a custom domain name configuration service based on a Kubernetes environment includes:
invoking a service interface in the Kubernetes environment, and customizing a resource type;
based on the custom resource type, a controller corresponding to the custom resource type is newly added;
wherein the custom domain name configuration service comprises the custom resource type and the controller; the controller is configured to monitor a resource object event, where the resource is a resource of the custom resource type.
In one embodiment, the adding a controller corresponding to the custom resource type based on the custom resource type includes:
and configuring the operation logic of the controller based on the field and the variable structure of the custom resource type.
In one embodiment, the adding or modifying DNS records in the ETCD of the distributed key value storage system by calling the custom domain name configuration service includes:
monitoring the resource object event, and reading domain name configuration information in the resource object event;
resolving the domain name configuration information into a DNS record of the ETCD;
and storing the DNS record through the ETCD.
In one embodiment, the controller monitors the resource object event, reads domain name configuration information in the resource object event, and includes:
acquiring a configuration file;
monitoring the configuration file through the controller in the Kubernetes environment;
reading domain name configuration information in the configuration file;
wherein the configuration file is written and submitted to the Kubernetes environment by a user.
In one embodiment, said storing said DNS record by said ETCD comprises:
in the event that it is determined that the controller has established a connection with the ETCD, the DNS record is stored by the ETCD based on the connection.
In one embodiment, the custom resource type includes: the domain name, mapping IP, and operation identification fields that need to be configured.
In one embodiment, the method further comprises:
reading a DNS record in the ETCD through a central domain name system CoreDNS;
and resolving the IP address corresponding to the domain name in the DNS record.
In a second aspect, an embodiment of the present application provides a domain name configuration apparatus, including:
a configuration module for: based on the Kubernetes environment, deploying a custom domain name configuration service;
a processing module for: by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory storing a computer program, where the processor implements the steps of the domain name configuration method according to the first aspect when executing the program.
In a fourth aspect, an embodiment of the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the domain name configuration method of the first aspect.
According to the domain name configuration method, the device, the electronic equipment and the computer program product provided by the embodiment of the application, the user-defined domain name configuration service is deployed by calling the interface in the Kubernetes environment, so that the user-defined domain name configuration service can serve the POD in the whole Kubernetes environment; the DNS records in the ETCD are newly added or modified by calling the custom domain name configuration service, the configuration can be immediately effective, the CoreDNS is not required to be restarted, the problem that the DNS analysis is temporarily unavailable due to the CoreDNS restart is avoided, and the normal operation of the Kubernetes cluster service is ensured.
Drawings
In order to more clearly illustrate the application or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a domain name configuration method according to an embodiment of the present application;
fig. 2 is a schematic diagram of a domain name configuration method according to an embodiment of the present application;
FIG. 3 is a second flow chart of a domain name configuration method according to an embodiment of the present application;
FIG. 4 is a third flow chart of a domain name configuration method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a domain name configuration device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In order to facilitate a clearer understanding of various embodiments of the present application, some relevant background knowledge is first presented as follows.
With the popularization of Kubernetes (management containerized application, abbreviated as k8 s) and cloud native technologies, distributed micro services are deployed in the k8s environment, and since services running in each minimum management unit (POD) need to access services in other PODs in the distributed cluster, the service auto discovery function of Kubernetes can ensure that the started POD can be accessed from outside through a specific service name.
However, in practical applications, some services between PODs need to be accessed through custom domain names, and then the service resolution configuration of the domain name system (Domain name system, DNS) of Kubernetes needs to be modified to support resolving the custom domain name to a specific service IP, so as to support domain name access between PODs.
DNS is a system for associating various types of information (e.g., IP addresses) with names that are easy to remember, while CoreDNS is a generic DNS server that is introduced as a DNS service in kubernetes1.11 formal version, and as a default cluster DNS resolution service after kubernetes1.19 version, with a very flexible, extensible model for passing requests through various middleware components. CoreDNS builds on these features and can communicate with multiple backend (ETCD or Kubernetes, etc.) to provide good DNS query services for domain name access between PODs in a cluster.
In the related art, the CoreDNS service is installed in the Kubernetes by default, and the inter-POD domain name access can directly achieve the purpose of internal resolution by modifying the configuration of CoreDNS. CoreDNS configuration is written to CoreDNS configuration nodes under the k-system namespace of configmap. When the CoreDNS configuration is newly added or updated, such as adding a hosts configuration node, after modification is completed, the CoreDNS service needs to be restarted to take effect of the configuration, and in the restarting process, the DNS resolution service of the Kubernetes cluster is temporarily unavailable.
The existing inter-POD domain name access configuration scheme has the following defects:
1. every time a domain name configuration is added or updated, the CoreDNS service needs to be restarted to take effect of the configuration.
2. Restarting the service during configuration can temporarily cause unavailability of Kubernetes cluster DNS resolution, and affect that the running service of the cluster cannot resolve domain name access.
To overcome all or part of the above drawbacks, embodiments of the present application provide a domain name configuration method, apparatus, electronic device, and computer program product. Exemplary description will be made of a domain name configuration method, a device, an electronic device, and a computer program product provided in the embodiments of the present application.
Fig. 1 is a schematic flow chart of a domain name configuration method according to an embodiment of the present application. Referring to fig. 1, an embodiment of the present application provides a domain name configuration method, including the following steps:
step 110, deploying a custom domain name configuration service based on a Kubernetes environment;
step 120, by calling the custom domain name configuration service, adding or modifying DNS records in the ETCD of the distributed key value storage system;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
Specifically, in the related art, by modifying the configuration of CoreDNS to newly add or update DNS records, the embodiment of the present application deploys a custom domain name configuration service applicable to all PODs in a Kubernetes (managed containerized application) environment based on the Kubernetes environment.
Specifically, the global custom domain name configuration service deployed in the Kubernetes environment can be uniformly managed by the Kubernetes cluster, without configuring the custom domain name service for each POD separately.
Specifically, coreDNS service in Kubernetes cluster may enable ETCD plug-in mechanism, package custom domain name configuration service development completion into mirror image, and initialize Deployment in Kubernetes cluster in Deployment (Deployment) manner through configuration file.
The custom domain name configuration service may be Dnsconfig-CRD, and the configuration file may be YAML file, where YAML represents a data serialization format.
The DnsConfig-CRD is a Kubernetes custom resource service developed by an operator, and is used to monitor a YAML file of custom domain name configuration, and store the custom domain name configuration in the ETCD.
Specifically, ETCD is a distributed key-value pair storage system for reliably and quickly storing critical data and providing access, reliable distributed collaboration is achieved through distributed locks, leader elections and write barriers (writebarriers), while ETCD sets are prepared for high availability, persistent data storage and retrieval.
Specifically, after deploying the custom domain name configuration service, the custom domain name configuration service may be invoked to add or modify DNS records in the distributed key value store system ETCD.
Specifically, by invoking the custom domain name configuration service, the addition or modification of DNS records in ETCD is effected in real-time without the need to restart CoreDNS.
Specifically, after completing the custom domain name configuration, coreDNS may read DNS records in ETCD.
According to the domain name configuration method provided by the embodiment of the application, the user-defined domain name configuration service is deployed by calling the interface in the Kubernetes environment, so that the user-defined domain name configuration service can serve the POD in the whole Kubernetes environment; the DNS records in the ETCD are newly added or modified by calling the custom domain name configuration service, the configuration can be immediately effective, the CoreDNS is not required to be restarted, the problem that the DNS analysis is temporarily unavailable due to the CoreDNS restart is avoided, and the normal operation of the Kubernetes cluster service is ensured.
In one embodiment, the deploying a custom domain name configuration service based on a Kubernetes environment includes:
invoking a service interface in the Kubernetes environment, and customizing a resource type;
based on the custom resource type, a controller corresponding to the custom resource type is newly added;
wherein the custom domain name configuration service comprises the custom resource type and the controller; the controller is configured to monitor a resource object event, where the resource is a resource of the custom resource type.
Specifically, interfaces for providing various services exist in the Kubernetes environment, the corresponding interfaces can be called according to the services defined by the needs, and after the corresponding interfaces are called, the resource types (CustomResourceDefinitions, CRD) can be customized by using templates provided by the interfaces. The custom resource type is a custom Kubernetes resource type.
Specifically, after defining the resource type, a Controller (Controller) corresponding to the custom resource can be developed in a matching manner, and the Controller can be used for monitoring the resource object event of the corresponding type, for example: create, delete, update, etc., and then perform the corresponding actions.
For example, the definition of a CRD may be implemented using one scaffold project operator that develops the CRD.
According to the domain name configuration method provided by the embodiment of the application, the user-defined domain name configuration service is deployed by calling the interface in the Kubernetes environment, and the corresponding controller is configured to monitor the user-defined resource object event, so that when the user-defined resource object event occurs, the corresponding action can be executed, the user-defined service can be enabled to be effective, and the CoreDNS is not required to be restarted to be configured to be effective.
In one embodiment, the adding a controller corresponding to the custom resource type based on the custom resource type includes:
and configuring the operation logic of the controller based on the field and the variable structure of the custom resource type.
In the related art inter-POD domain name access configuration method, the CoreDNS service is installed in the Kubernetes by default, and the purpose of internal analysis is achieved by directly modifying the configuration of the CoreDNS. Wherein the CoreDNS configuration is written to the CoreDNS configuration node under the kube-system namespace of the configmap (mount file). Wherein the ConfigMap's application program interface (Application program interface, API) resource is used to save key-value pair (key-value pair) configuration data, which may be used in multiple PODs or to store configuration data for system components like controllers; configMaps may be used as a reference to multiple properties (properties) files, specifically to store a directory of configuration files.
For example, adding configuration nodes between hosts (hosts), configuration domain name is demo.cmit.com mapped to 127.0.0.1.
Aiming at the problem that the CoreDNS configuration is directly modified in the related technology to achieve the purpose of internal analysis, the embodiment of the application can define and register CRD resources in a Kubernetes cluster, and the CRD resources can comprise fields and variable structures of custom resource types.
Specifically, after defining and registering CRD resources, a process procedure of a CRD processor (CRD-Crotroller) may be defined.
For example, connect ETCD; monitoring domain name configuration; obtain domain name and map IP, etc.
For example, a domain name storage format and a corresponding IP of domain name information in a domain name profile are formatted, and the formatted domain name and the mapped IP are stored to ETCD.
Compared with the method for configuring the domain name, which directly modifies the configuration of the CoreDNS and restarts the CoreDNS to take effect, the method for configuring the domain name, which is provided by the embodiment of the application, has the advantages that the field and the variable structure of the self-defined resource type are adopted, and the corresponding controller is configured according to the field and the variable structure, so that the processing of the event of the object of the self-defined resource type in the cluster is realized, the self-defined resource is processed through the controller, the domain name configuration in the self-defined resource can take effect in real time, the CoreDNS is not required to be restarted, the problem that the analysis of the Kubernetes cluster DNS is unavailable due to the restart of the CoreDNS is avoided, and the normal operation of the Kubernetes cluster service is ensured.
In one embodiment, the adding or modifying DNS records in the ETCD of the distributed key value storage system by calling the custom domain name configuration service includes:
monitoring the resource object event, and reading domain name configuration information in the resource object event;
resolving the domain name configuration information into a DNS record of the ETCD;
and storing the DNS record through the ETCD.
Specifically, after customizing the field and variable structure of the resource type and configuring the operation logic of the controller, the controller may monitor the resource object event of the custom resource type, where the monitoring process of the controller may be cyclic or periodic.
For example, the resource object event of the custom resource type may be a domain name profile submitted by a user in the cluster.
Specifically, after the controller listens for the resource object event, the domain name configuration information in the resource object event may be read to determine whether valid domain name configuration information exists.
Specifically, in the case where it is determined that valid domain name configuration information exists in the resource object event, the controller may resolve the domain name configuration in the domain name configuration information into a format suitable for ETCD storage, i.e., into DNS records in ETCD.
Specifically, after the controller resolves the domain name configuration information into DNS records, the DNS records may be stored by ETCD.
According to the domain name configuration method provided by the embodiment of the application, the user-defined resource type event in the cluster is monitored automatically in real time through configuring the user-defined resource type and the corresponding controller; the automatic monitoring access domain name configuration is carried out in the cluster configuration, the domain name resolution service of the cluster is decoupled from the stored DNS configuration, the CoreDNS service, the domain name resolution initialization modification and the domain name configuration monitoring service deployment are completed at one time, repeated starting is not needed, the configuration is stable, the influence of configuration operation on application service is reduced, and the normal operation of the Kubernetes cluster service is ensured.
In one embodiment, the controller monitors the resource object event, reads domain name configuration information in the resource object event, and includes:
acquiring a configuration file;
monitoring the configuration file through the controller in the Kubernetes environment;
reading domain name configuration information in the configuration file;
wherein the configuration file is written and submitted to the Kubernetes environment by a user.
Specifically, based on the previous embodiment, the resource object event of the custom resource type may be a domain name configuration file submitted by a user in the cluster.
Specifically, when the CoreDNS reads the DNS record in the ETCD, and the ETCD is found to have no domain name required by the service, the corresponding DNS record may be fed back to the ETCD, and after receiving the feedback of the lack of the DNS record, the user may write a custom domain name configuration file, such as a YAML file, and submit the custom domain name configuration file to the cluster, so as to monitor and make corresponding processing through the controller.
For example, the content for writing the custom domain name configuration file includes a resource model, a resource identifier, a version number, a DNS resource identifier, and the like.
The custom domain name configuration supports operation modes such as put (new, modified), del (deleted), get (inquired) and the like; and supporting the custom access domain name and the corresponding IP address.
Wherein the configuration file supports batch operations, and multiple records can be configured at a time.
When the service needs to access through the domain name, the domain name configuration method provided by the embodiment of the application firstly compiles the custom domain name configuration file, and the compiled custom domain name configuration file can be timely monitored and processed by the corresponding controllers in the cluster; the custom domain name configuration file can be operated in batches, a plurality of records can be configured at a time, and the steps of manual operations such as logging in a container are reduced; the domain name inside the Kubernetes cluster is configured in a YAML mode, so that the east-west domain name access of the service inside the Kubernetes cluster is realized, and the method is more convenient, quick and efficient; the domain name configuration takes effect in real time, and the internal access efficiency of the cluster micro-service is improved.
In one embodiment, said storing said DNS record by said ETCD comprises:
in the event that it is determined that the controller has established a connection with the ETCD, the DNS record is stored by the ETCD based on the connection.
Specifically, a listening service DnsConfig-CRD running in a Kubernetes cluster is deployed in advance, and upon initializing the configuration, a connection is established with the ETCD.
Specifically, after the custom domain name configuration file is written, the custom domain name configuration file can be submitted (applied) and deployed to a Kubernetes cluster environment through a Kubernetes command in a YAML file; the Dnsconfig-CRD realizes the custom operation of domain name configuration based on an Operator mode, can store and acquire structured data in a customized mode, and monitors the state of resource configuration in real time.
Specifically, the controller may monitor a custom domain name profile resource, such as a YAML file, and read the custom domain name and the corresponding mapping IP, convert the custom domain name and the mapping IP into an ETCD storage format, and store the ETCD storage format in the ETCD.
Specifically, in order to successfully store the custom domain name and the corresponding mapping IP through the ETCD, it may be verified whether the connection between the controller and the ETCD is normal, if not, the ETCD is reconnected, so as to avoid the unavailability of the ETCD caused by an abnormal event, and ensure that the custom domain name and the corresponding mapping IP can be successfully stored in the ETCD.
According to the domain name configuration method provided by the embodiment of the application, after the controller monitors the custom domain name configuration file and analyzes domain name configuration information in the custom domain name configuration file into a format suitable for ETCD storage, the connection state of the controller and the ETCD is verified, so that the problem that DNS records cannot be stored in the ETCD due to the unavailability of the ETCD is avoided, and the storage process of the ETCD is ensured.
In one embodiment, the custom resource type includes: the domain name, mapping IP, and operation identification fields that need to be configured.
Specifically, interfaces for providing different services exist in the Kubernetes cluster, and after a certain interface is called, variables and field types in the custom resource template can be selected according to actual needs so as to realize the service which the custom resource type wants to provide.
Specifically, in the case where the custom domain name configuration service needs to be implemented, the content included in the custom domain name configuration file may be defined, for example, the custom domain name configuration file is a YAML file.
Specifically, the custom configuration file may include a domain name, a mapping IP, and an operation identification field, through which a corresponding controller may be configured, and through which an operation logic of the controller performs a corresponding process flow, and compared with a configuration in a direct operation container, the configuration is not limited by a location, and any directory may be validated.
According to the domain name configuration method provided by the embodiment of the application, the service interface in the Kubernetes cluster is called, the resource type is customized, the corresponding controller is configured, the domain name configuration is executed through the controller, the domain name in the Kubernetes cluster is configured in a configuration file mode, the east-west domain name access of the service in the Kubernetes cluster is realized, the steps of manual operation such as logging in a container are reduced, compared with the configuration in a direct operation container, the logging in container is not needed, the position limitation is avoided, and the method is more convenient, quick and efficient.
In one embodiment, the method further comprises:
reading a DNS record in the ETCD through a central domain name system CoreDNS;
and resolving the IP address corresponding to the domain name in the DNS record.
Specifically, when the service requests custom domain name within the Kubernetes cluster POD, the CoreDNS service of the cluster may be found from the nalmeserver in the container DNS service resolution file/etc/resolv.
Specifically, the CoreDNS service searches and reads the custom domain name configuration in the ETCD through the key value pair according to the requested custom domain name, returns the mapped IP address, and requests to access the domain name to access the service where the mapped IP is located.
According to the domain name configuration method provided by the embodiment of the application, the DNS configuration storage is decoupled and separated from the domain name mapping, so that the problem of temporary resolution failure in the configuration updating process is avoided, and the normal operation of the Kubernetes cluster is ensured.
In one embodiment, the domain name configuration method provided by the embodiment of the application may include a step a and a step b.
Step a, deploying a custom domain name configuration service;
and b, accessing a custom domain name configuration service.
Fig. 2 is a schematic diagram of a domain name configuration method according to an embodiment of the present application. Referring to fig. 2, in the domain name configuration architecture between kubernetes cluster PODs, an ETCD plugin is enabled in CoreDNS as a domain name configuration back end, dnsConfig-CRD updates the generated DNS record information into the ETCD, and CoreDNS obtains data from the ETCD to provide a DNS query service.
Specifically, a configurator may write a configuration to generate a domain name configuration file, e.g., a configurator may write a domain name configuration YAML file, which may include a domain name and a mapping IP.
Specifically, after the configurator can write the configuration, the configuration personnel can submit the configuration to the Kubernetes cluster, and the listening service DnsConfig-CRD running in the Kubernetes cluster is deployed in advance to read the domain name configuration.
Specifically, after the DnsConfig-CRD reads the domain name configuration, the DnsConfig-CRD parses the domain name configuration into an ETCD storage format and writes the domain name configuration into the DNS record via the ETCD.
Specifically, when a service within a Kubernetes cluster POD (k 8s POD) performs domain name access, a domain name is retrieved from the DNS resolution server CoreDNS of the cluster to perform domain name resolution.
Specifically, after the CoreDNS obtains the requirement of domain name resolution of the k8s POD, the ETCD is queried for the ETCD configuration record, and the query result is returned to read the DNS record.
Fig. 3 is a second flowchart of a domain name configuration method according to an embodiment of the present application. Referring to fig. 3, under the above-described Kubernetes cluster inter-POD domain name configuration architecture, step a may include steps 310 to 372.
Step 310, configuring a resource type by a custom domain name;
step 320, initializing a monitoring service;
step 330, connecting ETCD;
step 340, circularly monitoring the user-defined domain name configuration resource;
step 351, acquiring a user-defined domain name YAML file written by a user;
step 352, reading domain name configuration;
step 360, resolving the domain name to configure into an ETCD storage format;
step 370, checking ETCD connections;
step 371, storing a custom domain name DNS record under the condition of successful connection;
if the connection is unsuccessful, the ETCD is reconnected, and step 370 is performed.
Wherein, the execution subject of step 310 is CRD; the execution bodies of step 320, step 330, step 340, step 351, step 352, step 360, step 370 and step 372 are controllers; the main execution body of step 371 is ETCD.
The Controller can be a processor, automatically monitor the domain name configuration, and perform format verification and access operation on the configuration.
Fig. 4 is a third flowchart of a domain name configuration method according to an embodiment of the present application. Referring to fig. 4, after deploying the custom domain name configuration service, step b may include steps 410 through 490.
Step 410, compiling a custom domain name YAML file;
step 420, monitoring a configuration CRD;
step 430, reading domain name configuration;
step 440, configuring the resolved domain name into ETCD storage format;
step 450, connecting ETCD;
step 460, storing a custom domain name DNS record;
step 470, coreDNS reads ETCD configuration;
step 480, resolving the domain name to a corresponding address;
step 490, domain name resolution is completed.
Wherein, the execution subject of step 410 is a user; the execution subject of steps 420-440 is DnsConfig-CRD; the main execution body of step 450 and step 460 is ETCD; the main execution body of steps 470 to 490 is CoreDNS.
Wherein, dnsConfig-CRD can comprise custom domain name configuration resources and corresponding controllers.
According to the domain name configuration method provided by the embodiment of the application, the resource type is configured by calling the interface custom domain name under the Kubernetes environment, the corresponding controller is configured, the initialization and modification of the domain name resolution service of CoreDNS and the deployment of the domain name configuration monitoring service are completed once, repeated starting is not needed, and the configuration is stable; the domain name analysis service of the cluster is decoupled from the stored DNS configuration by automatically monitoring and accessing the domain name configuration to the cluster configuration by the controller, so that the influence of configuration operation on application service is reduced, and the normal operation of the Kubernetes cluster service is ensured; the automatic monitoring domain name configuration analysis is realized through Dnsconfig-CRD, the domain name configuration takes effect in real time, and the internal access efficiency of the cluster micro-service is improved; the internal domain name of the Kubernetes cluster is configured in a YAML mode, so that the east-west domain name access of services in the Kubernetes cluster is realized, the steps of manual operation such as logging in a container are reduced, and the method is more convenient, quick and efficient.
According to the domain name configuration method provided by the embodiment of the application, the user-defined domain name configuration service is deployed by calling the interface in the Kubernetes environment, so that the user-defined domain name configuration service can serve the POD in the whole Kubernetes environment; the DNS records in the ETCD are newly added or modified by calling the custom domain name configuration service, the configuration can be immediately effective, the CoreDNS is not required to be restarted, the problem that the DNS analysis is temporarily unavailable due to the CoreDNS restart is avoided, and the normal operation of the Kubernetes cluster service is ensured.
Fig. 5 is a schematic structural diagram of a domain name configuration device according to an embodiment of the present application. Referring to fig. 5, an embodiment of the present application provides a domain name configuration apparatus, including:
a configuration module 510 for: based on the Kubernetes environment, deploying a custom domain name configuration service;
a processing module 520 for: by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
According to the domain name configuration device provided by the embodiment of the application, the user-defined domain name configuration service is deployed by calling the interface in the Kubernetes environment, so that the user-defined domain name configuration service can serve the POD in the whole Kubernetes environment; the DNS records in the ETCD are newly added or modified by calling the custom domain name configuration service, the configuration can be immediately effective, the CoreDNS is not required to be restarted, the problem that the DNS analysis is temporarily unavailable due to the CoreDNS restart is avoided, and the normal operation of the Kubernetes cluster service is ensured.
Optionally, the configuration module 510 is further configured to:
invoking a service interface in the Kubernetes environment, and customizing a resource type;
based on the custom resource type, a controller corresponding to the custom resource type is newly added;
wherein the custom domain name configuration service comprises the custom resource type and the controller; the controller is configured to monitor a resource object event, where the resource is a resource of the custom resource type.
Optionally, the configuration module 510 is further configured to:
and configuring the operation logic of the controller based on the field and the variable structure of the custom resource type.
Optionally, the processing module 520 is further configured to:
monitoring the resource object event, and reading domain name configuration information in the resource object event;
resolving the domain name configuration information into a DNS record of the ETCD;
and storing the DNS record through the ETCD.
Optionally, the processing module 520 is further configured to:
acquiring a configuration file;
monitoring the configuration file through the controller in the Kubernetes environment;
reading domain name configuration information in the configuration file;
wherein the configuration file is written and submitted to the Kubernetes environment by a user.
Optionally, the processing module 520 is further configured to:
in the event that it is determined that the controller has established a connection with the ETCD, the DNS record is stored by the ETCD based on the connection.
Optionally, the custom resource type includes: the domain name, mapping IP, and operation identification fields that need to be configured.
Optionally, the processing module 520 is further configured to:
reading a DNS record in the ETCD through a central domain name system CoreDNS;
and resolving the IP address corresponding to the domain name in the DNS record.
According to the domain name configuration device provided by the embodiment of the application, the user-defined domain name configuration service is deployed by calling the interface in the Kubernetes environment, so that the user-defined domain name configuration service can serve the POD in the whole Kubernetes environment; the DNS records in the ETCD are newly added or modified by calling the custom domain name configuration service, the configuration can be immediately effective, the CoreDNS is not required to be restarted, the problem that the DNS analysis is temporarily unavailable due to the CoreDNS restart is avoided, and the normal operation of the Kubernetes cluster service is ensured.
It should be noted that, the domain name configuration device provided by the embodiment of the present application can implement all the method steps implemented by the embodiment of the domain name configuration method, and can achieve the same technical effects, and detailed descriptions of the same parts and beneficial effects as those of the embodiment of the method in the embodiment are omitted herein.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 6, the electronic device may include: processor 610, communication interface (Communication Interface) 620, memory 630, and communication bus 640, wherein processor 610, communication interface 620, and memory 630 communicate with each other via communication bus 640. The processor 610 may call a computer program in the memory 630 to perform the steps of a domain name configuration method, for example, including:
based on the Kubernetes environment, deploying a custom domain name configuration service;
by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
Further, the logic instructions in the memory 630 may be implemented in the form of software functional units and stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, embodiments of the present application further provide a computer program product, where the computer program product includes a computer program, where the computer program may be stored on a non-transitory computer readable storage medium, where the computer program when executed by a processor is capable of executing the steps of the domain name configuration method provided in the foregoing embodiments, for example, including:
based on the Kubernetes environment, deploying a custom domain name configuration service;
by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
In another aspect, embodiments of the present application further provide a processor-readable storage medium storing a computer program for causing a processor to execute the steps of the method provided in the above embodiments, for example, including:
based on the Kubernetes environment, deploying a custom domain name configuration service;
by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
The processor-readable storage medium may be any available medium or data storage device that can be accessed by a processor, including, but not limited to, magnetic storage (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical storage (e.g., CD, DVD, BD, HVD, etc.), semiconductor storage (e.g., ROM, EPROM, EEPROM, nonvolatile storage (NAND FLASH), solid State Disk (SSD)), and the like.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present application without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims (11)
1. A domain name configuration method, comprising:
based on the Kubernetes environment, deploying a custom domain name configuration service;
by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
2. The domain name configuration method according to claim 1, wherein the deploying a custom domain name configuration service based on a Kubernetes environment comprises:
invoking a service interface in the Kubernetes environment, and customizing a resource type;
based on the custom resource type, a controller corresponding to the custom resource type is newly added;
wherein the custom domain name configuration service comprises the custom resource type and the controller; the controller is configured to monitor a resource object event, where the resource is a resource of the custom resource type.
3. The domain name configuration method according to claim 2, wherein the adding a controller corresponding to the custom resource type based on the custom resource type includes:
and configuring the operation logic of the controller based on the field and the variable structure of the custom resource type.
4. A domain name configuration method according to claim 2 or 3, wherein said adding or modifying DNS records in the distributed key value storage system ETCD by invoking said custom domain name configuration service comprises:
monitoring the resource object event, and reading domain name configuration information in the resource object event;
resolving the domain name configuration information into a DNS record of the ETCD;
and storing the DNS record through the ETCD.
5. The domain name configuration method according to claim 4, wherein the controller listens for the resource object event, reads domain name configuration information in the resource object event, and comprises:
acquiring a configuration file;
monitoring the configuration file through the controller in the Kubernetes environment;
reading domain name configuration information in the configuration file;
wherein the configuration file is written and submitted to the Kubernetes environment by a user.
6. The domain name configuration method according to claim 4, wherein the storing the DNS record by the ETCD includes:
in the event that it is determined that the controller has established a connection with the ETCD, the DNS record is stored by the ETCD based on the connection.
7. The domain name configuration method according to claim 2, wherein the custom resource type includes: the domain name, mapping IP, and operation identification fields that need to be configured.
8. The domain name configuration method according to claim 1, characterized in that the method further comprises:
reading a DNS record in the ETCD through a central domain name system CoreDNS;
and resolving the IP address corresponding to the domain name in the DNS record.
9. A domain name configuration apparatus, comprising:
a configuration module for: based on the Kubernetes environment, deploying a custom domain name configuration service;
a processing module for: by calling the custom domain name configuration service, a DNS record in the ETCD of the distributed key value storage system is newly added or modified;
the custom domain name configuration service is a service shared by all the minimum management units PODs in the Kubernetes environment.
10. An electronic device comprising a processor and a memory storing a computer program, wherein the processor implements the domain name configuration method of any of claims 1 to 8 when executing the computer program.
11. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the domain name configuration method of any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210306112.4A CN116846865A (en) | 2022-03-25 | 2022-03-25 | Domain name configuration method, device, electronic equipment and computer program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210306112.4A CN116846865A (en) | 2022-03-25 | 2022-03-25 | Domain name configuration method, device, electronic equipment and computer program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116846865A true CN116846865A (en) | 2023-10-03 |
Family
ID=88160476
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210306112.4A Pending CN116846865A (en) | 2022-03-25 | 2022-03-25 | Domain name configuration method, device, electronic equipment and computer program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116846865A (en) |
-
2022
- 2022-03-25 CN CN202210306112.4A patent/CN116846865A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10635428B2 (en) | System and method for in-service update of software | |
US20240007347A1 (en) | Method and system for configuring bmc ip addresses of bare metal servers, medium and device | |
US20150067167A1 (en) | Hot pluggable extensions for access management system | |
CN110555041A (en) | Data processing method, data processing device, computer equipment and storage medium | |
US7293168B2 (en) | System and method for initially configuring and booting a device using a device identifier | |
CN113127133A (en) | Cross-platform virtual machine live migration method, device, equipment and medium | |
CN112214227A (en) | Edge server mirror image customization and deployment system and method | |
CN114860271B (en) | PXE starting method, system, device and readable storage medium | |
US11586536B1 (en) | Remote configuration of multi-mode DIMMs through a baseboard management controller | |
CN114328210A (en) | Test method, test device and computer readable storage medium | |
US11385905B2 (en) | Managing boot device orders for computing devices | |
WO2021232651A1 (en) | Method and apparatus for upgrading multi-level management system, and device and medium | |
CN104104701A (en) | Online service configuration updating method and system | |
TWI801730B (en) | Server with system setting data synchronization function | |
CN116991758A (en) | Spatial layout updating method, device, equipment and medium | |
CN116846865A (en) | Domain name configuration method, device, electronic equipment and computer program product | |
CN108595292B (en) | System optimization method, mobile terminal and computer storage medium | |
CN116225617A (en) | Management migration method and device for container instance, electronic equipment and storage medium | |
CN115309756A (en) | Cache data updating method and device and electronic equipment | |
CN112130900B (en) | User information management method, system, equipment and medium for BMC | |
US11204704B1 (en) | Updating multi-mode DIMM inventory data maintained by a baseboard management controller | |
US11169740B1 (en) | Simultaneous initiation of multiple commands for configuring multi-mode DIMMS using a BMC | |
CN109684134B (en) | Method and server for rapidly deploying firmware settings among multiple devices | |
CN114448788A (en) | Installation method, system, equipment and medium of switch system | |
CN111857744A (en) | Installation method, system, equipment and medium of super-fusion system |
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 |