You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by bz...@apache.org on 2022/03/04 12:11:41 UTC

[apisix-website] branch master updated: docs: add CoreDNS blog (#935)

This is an automated email from the ASF dual-hosted git repository.

bzp2010 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 8182f22  docs: add CoreDNS blog (#935)
8182f22 is described below

commit 8182f2220a8fa0d4e5e56e2cb9b5f2cd74b6ec37
Author: homeward <97...@users.noreply.github.com>
AuthorDate: Fri Mar 4 20:11:35 2022 +0800

    docs: add CoreDNS blog (#935)
---
 ...apisix-uses-coredns-enable-service-discovery.md | 258 ++++++++++++++++++++
 ...apisix-uses-coredns-enable-service-discovery.md | 259 +++++++++++++++++++++
 2 files changed, 517 insertions(+)

diff --git a/website/blog/2022/03/04/apisix-uses-coredns-enable-service-discovery.md b/website/blog/2022/03/04/apisix-uses-coredns-enable-service-discovery.md
new file mode 100644
index 0000000..0fb4dff
--- /dev/null
+++ b/website/blog/2022/03/04/apisix-uses-coredns-enable-service-discovery.md
@@ -0,0 +1,258 @@
+---
+title: "Apache APISIX and CoreDNS open new doors for service discovery"
+authors:
+  - name: "Zijie Chen"
+    title: "Author"
+    url: "https://github.com/CP3cham"
+    image_url: "https://avatars.githubusercontent.com/u/87352162?v=4"
+  - name: "Fei Han"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- Apache APISIX
+- API Gateway
+- CoreDNS
+- Service Discovery
+- Service Register
+- Ecosystem
+description: Apache APISIX is a dynamic, real-time, high-performance cloud-native API gateway that provides rich traffic management functions such as load balancing, dynamic upstream, grayscale publishing, service interruption, identity authentication, and observability. As a cloud native API gateway, Apache APISIX also integrates multiple service discovery capabilities. This article will show you how to configure CoreDNS in Apache APISIX.
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> Apache APISIX is a dynamic, real-time, high-performance cloud-native API gateway that provides rich traffic management functions such as load balancing, dynamic upstream, grayscale publishing, service interruption, identity authentication, and observability. As a cloud native API gateway, Apache APISIX also integrates multiple service discovery capabilities. This article will show you how to configure CoreDNS in Apache APISIX.
+
+## Background information
+
+In traditional physical machine and virtual machine deployment, calls between various services can be made through fixed **IP + port**. With the advent of the cloud-native era, enterprise business deployment is more inclined to cloud-native containerization. However, in a containerized environment, the startup and destruction of service instances are very frequent. Manual maintenance by operation and maintenance personnel will not only be a heavy workload, but also ineffective. Therefore [...]
+
+## Service Discovery
+
+The service discovery mechanism can be split into two parts:
+
+- Service Registry: Store host and port information for services.
+
+If a container provides a service for calculating the average, we use the service name of average as the unique identifier, then it will be stored in the form of a key-value pair (average:192.168.1.21) in the service registry.
+
+- Service Discovery: Allows other users to discover the information stored during the service registration phase. It is divided into client discovery mode and server discovery mode.
+
+### Client Service Discovery Mode
+
+When using the client discovery mode, the client obtains the actual network address of the available service by querying the storage information of the service registry, selects an available service instance through a load balancing algorithm, and sends the request to the service.
+
+- Advantages: Simple architecture, flexible expansion, and easy implementation of load balancing functions.
+- Disadvantages: heavy client, strong coupling, there is a certain development cost.
+
+![error/client service discovery.png](https://static.apiseven.com/202108/1646299277491-53bd8cd0-a984-4fed-bcbd-d251c18f5b7f.png)
+
+The implementation logic of client discovery mode is as follows:
+
+1. When a new service is started, it will actively register with the registration center, and the service registration center will store the service name and address of the new service;
+2. When the client needs this service, it will use the service name to initiate a query to the service registry;
+3. The service registry returns the available addresses, and the client selects one of the addresses to initiate the call according to the specific algorithm.
+
+In this process, in addition to service registration, the work of service discovery is basically completed by the client independently, and the addresses of the registry and the server are also fully visible to the client.
+
+### Server Service Discovery Mode
+
+The client sends a request to the Load Balancer, and the Load Balancer queries the service registry according to the client's request, finds an available service, and forwards the request to the service. Like the client service discovery mode, the service needs to be registered and deregistered in the registry.
+
+- Advantages: The discovery logic of the service is transparent to the client.
+- Disadvantages: Requires additional deployment and maintenance of a Load Balancer.
+
+![error/server service discovery.png](https://static.apiseven.com/202108/1646299327406-0172de7f-94a8-4964-b109-562795941d0e.png)
+
+The implementation logic of server discovery mode is as follows:
+
+1. When a new service is started, it will actively register with the registry, and the service registry will store the service name and address of the new service;
+2. When the client needs a service, it will use the service name to initiate a query to the load balancer;
+3. According to the service name requested by the client, the Load Balancer proxies the client to initiate a request to the service registry;
+4. After the Load Balancer obtains the returned address, it selects one of the addresses to initiate the call according to the specific algorithm.
+
+## Advantages of using CoreDNS
+
+CoreDNS is an open source DNS server written in `Go`, which is commonly used for DNS services and service discovery in multi-container environments due to its flexibility and extensibility. CoreDNS is built on top of Caddy, the HTTP/2 web server, and implements a plug-in chain architecture, abstracting many DNS related logic into layer-by-layer plug-ins, which are more flexible and easy to expand, and user selected plugin It will be compiled into the final executable file, and the runnin [...]
+
+Compared with common service discovery frameworks (Apache ZooKeeper and Consul), what are the advantages of CoreDNS implementing service discovery?
+
+The principle of service discovery is similar to DNS domain name system, which is an important infrastructure in computer networks. The DNS domain name system binds domain names that rarely change with frequently changing server IP addresses, while the service discovery mechanism is to seldom change domain names. The service name is bound to the service address. In this way, we can use DNS to achieve a function similar to the service registry, and only need to convert the domain name sto [...]
+
+## Principle Architecture
+
+The overall structure is as follows:
+
+1. The client initiates a request to APISIX to call the service.
+2. APISIX accesses the upstream service node according to the set route (the specific configuration can be seen below). In APISIX, you can set the upstream information to obtain through DNS. As long as the IP address of the DNS server is set correctly, APISIX will automatically initiate a request to this address , to obtain the address of the corresponding service in DNS.
+3. CoreDNS returns a list of available addresses based on the requested service name.
+4. APISIX selects one of the available addresses and the configured algorithm to initiate the call.
+
+![error/architecture.png](https://static.apiseven.com/202108/1646299394984-76683b2c-03ae-45b0-b5a6-8b8f3b6d47cf.png)
+
+## How to Use
+
+### Prerequisites
+
+This article is based on the following environments.
+
+- OS: Centos 7.9.
+- Apache APISIX 2.12.1, please refer to: [How-to-Bulid Apache APISIX](https://apisix.apache.org/docs/apisix/how-to-build).
+- CoreDNS 1.9.0,please refer to:[CoreDNS Installation Guide](https://coredns.io/manual/toc/#installation).
+- Node.js, please refer to::[Node.js Installation](https://github.com/nodejs/help/wiki/Installation).
+
+### Procedure
+
+1. Use Node.js's `Koa` framework starts a simple test service on port `3005`.
+
+Accessing this service will return the string `Hello World`, and we will get the address of this service via CoreDNS later.
+
+```Shell
+  const Koa = require('koa');
+  const app = new Koa();
+
+  app.use(async ctx => {
+    ctx.body = 'Hello World';
+  });
+
+  app.listen(3005);
+```
+
+2. Configure CoreDNS.
+
+CoreDNS listens on port `53` by default, and will read the `Corefile` configuration file in the same directory. Under the initial conditions, there is no `Corefile` file in the same directory, so we need to create and complete the configuration.
+
+`Corefile` mainly implements functions by configuring plugins, so we need to configure three plugins:
+
+- `hosts`: You can use this parameter to bind the service name and IP address. fallthrough means that when the current plugin cannot return normal data, the request can be forwarded to the next plugin for processing (if it exists).
+- `forward`: Indicates to proxy the request to the specified address, usually the authoritative DNS server address.
+- `log`: Don't configure any parameters to print log information to the console interface for debugging.
+
+```Shell
+  .:1053 {                           # Listen on port 1053
+      hosts {
+          10.10.10.10 hello
+          # Bind the service name "coredns" to the IP address
+          fallthrough
+      }
+      forward . 114.114.114.114:53
+      log
+  }
+```
+
+3. Configuring Apache APISIX。
+
+Add the relevant configuration in the `conf/config.yaml` file and reload Apache APISIX.
+
+```Shell
+  # config.yml
+  # ...other config
+  discovery:
+     dns:
+       servers:
+          - "127.0.0.1:1053"          # Use the real address of the DNS server,
+                                      # here is the 1053 port of the local machine.
+```
+
+4. 4. Configure routing information in Apache APISIX.
+
+Next, we configure the relevant routing information by requesting the `Admin API`.
+
+```Shell
+  curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+  {
+      "uri": "/core/*",
+      "upstream": {
+          "service_name": "hello:3005",
+          # Name the service as coredns, consistent with
+          # the configuration of the hosts plugin in CoreDNS
+          "type": "roundrobin",
+          "discovery_type": "dns" # Set service discovery type to DNS
+      }
+  }'
+```
+
+5. verify.
+
+- Authenticate on the local machine
+
+```Shell
+  curl 127.0.0.1:9080/core/hello -i
+
+  HTTP/1.1 200 OK
+  Content-Type: text/plain; charset=utf-8
+  Content-Length: 11
+  Connection: keep-alive
+  Date: Wed, 16 Feb 2022 08:44:08 GMT
+  Server: APISIX/2.12.1
+
+  Hello World
+```
+
+- Verify on other hosts
+
+```Shell
+  curl 10.10.10.10:9080/core/hello -i
+
+  HTTP/1.1 200 OK
+  Content-Type: text/plain; charset=utf-8
+  Content-Length: 11
+  Connection: keep-alive
+  Date: Wed, 16 Feb 2022 08:43:32 GMT
+  Server: APISIX/2.12.0
+
+  Hello World
+```
+
+As you can see from the above results, the service is running normally.
+
+6. The IP address of the simulated container is changed because the container cannot provide services for various reasons.
+
+We need to set up the same service on another server, also running on port `3005`, but with the IP address changed, and the return string changed to `Hello, Apache APISIX`.
+
+```Shell
+const Koa = require('koa');
+const app = new Koa();
+
+app.use(async ctx => {
+  ctx.body = 'Hello, Apache APISIX';
+});
+
+app.listen(3005);
+````
+
+Modify the `Corefile` configuration and restart Core DNS. Leave other configurations unchanged. The configuration example is as follows:
+
+```Shell
+.:1053 {                         # Listen on port 1053
+    hosts {
+        10.10.10.11 hello        # Modify service IP address
+        # Bind the service name "coredns" to the IP address
+        fallthrough
+    }
+    forward . 114.114.114.114:53
+    log
+}
+```
+
+> DNS has a caching mechanism. When we use the `dig` command to request to resolve a new domain name, we will see a number field in the returned `DNS record`, that is, the `TTL` field, which is generally `3600`, which is one hour. Requests sent to the domain name within the `TTL` period will no longer request the DNS server to resolve the address, but will directly obtain the address corresponding to the domain name in the local cache.
+
+By verifying, we can find that the request has been redirected to the new address. Verify as follows:
+
+```Shell
+  curl 127.0.0.1:9080/core/hello -i
+
+  HTTP/1.1 200 OK
+  Content-Type: text/plain; charset=utf-8
+  Content-Length: 11
+  Connection: keep-alive
+  Date: Wed, 16 Feb 2022 08:44:08 GMT
+  Server: APISIX/2.12.0
+
+  Hello, Apache APISIX
+```
+
+## Summary
+
+This article mainly introduces the types of service discovery and how to use CoreDNS in Apache APISIX. You can use Apache APISIX and CoreDNS according to your business needs and past technical architecture.
+
+Apache APISIX is also currently working on additional plugins to support the integration of additional services, so if you are interested, feel free to start a discussion in [GitHub Discussions](https://github.com/apache/apisix/discussions), or via the [mailing list](https://apisix.apache.org/zh/docs/general/subscribe-guide) to communicate.
diff --git a/website/i18n/zh/docusaurus-plugin-content-blog/2022/03/04/apisix-uses-coredns-enable-service-discovery.md b/website/i18n/zh/docusaurus-plugin-content-blog/2022/03/04/apisix-uses-coredns-enable-service-discovery.md
new file mode 100644
index 0000000..2eef23e
--- /dev/null
+++ b/website/i18n/zh/docusaurus-plugin-content-blog/2022/03/04/apisix-uses-coredns-enable-service-discovery.md
@@ -0,0 +1,259 @@
+---
+title: "API 网关 Apache APISIX 携手 CoreDNS 打开服务发现新大门"
+authors:
+  - name: "陈梓杰"
+    title: "Author"
+    url: "https://github.com/CP3cham"
+    image_url: "https://avatars.githubusercontent.com/u/87352162?v=4"
+  - name: "韩飞"
+    title: "Technical Writer"
+    url: "https://github.com/hf400159"
+    image_url: "https://avatars.githubusercontent.com/u/97138894?v=4"
+keywords: 
+- Apache APISIX
+- API Gateway
+- CoreDNS
+- 服务发现
+- 服务注册
+- Ecosystem
+description: Apache APISIX 是一个动态、实时、高性能的云原生 API 网关,提供了负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。作为云原生 API 网关,Apache APISIX 也集成了多种服务发现的能力,本文将为您展示在 Apache APISIX 中如何配置 CoreDNS。
+tags: [Technology,Ecosystem,Service Discovery]
+---
+
+> Apache APISIX 是一个动态、实时、高性能的云原生 API 网关,提供了负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。作为云原生 API 网关,Apache APISIX 也集成了多种服务发现的能力,本文将为您展示在 Apache APISIX 中如何配置 CoreDNS。
+
+## 背景信息
+
+在传统的物理机和虚拟机部署中,各个服务之间的调用可以通过固定 **IP + 端口**的方式进行。随着云原生时代的到来,企业业务的部署更倾向于云原生容器化。但是在容器化环境中,服务实例的启动和销毁是非常频繁的,如果通过运维人员手动维护不仅工作量大,而且效果也欠佳。因此需要一种机制可以自动检测服务状态,当服务地址出现变更时,动态绑定新的地址。服务发现机制应运而生。
+
+## 服务发现简介
+
+服务发现机制可以分为两部分:
+
+- 服务注册中心:存储服务的主机和端口信息。
+
+假如某个容器对外提供计算平均值的服务,我们使用 `average` 的服务名作为唯一标识符,那么在服务注册中心就会以键值对(`average:192.168.1.21`)的方式存储。
+
+- 服务发现:允许其他用户发现服务注册阶段存储的信息。分为客户端发现模式和服务端发现模式。
+
+### 客户端服务发现模式
+
+在使用客户端发现模式时,客户端通过查询服务注册中心的存储信息,获取可用服务的实际网络地址后,通过负载均衡算法选择一个可用的服务实例,并将请求发送至该服务。
+
+- 优点:架构简单,扩展灵活,方便实现负载均衡功能。
+- 缺点:重客户端,强耦合,有一定开发成本。
+
+![error/client service discovery.png](https://static.apiseven.com/202108/1646299482001-9bba7b28-1780-44c8-869d-b75bc993c021.png)
+
+客户端发现模式实现逻辑如下:
+
+1. 新服务启动时,主动向注册中心注册,服务注册中心会存储新服务的服务名和地址;
+2. 当客户端需要这个服务时,会使用服务名向服务注册中心发起查询;
+3. 服务注册中心返回可用的地址,客户端再根据具体的算法选择其中一个发起调用。
+
+在这个过程中,除了服务注册,服务发现的工作基本由客户端独立完成,注册中心和服务端的地址对客户端也是完全可见的。
+
+### 服务端服务发现模式
+
+客户端向 Load Balancer 发送请求,Load Balancer 根据客户端的请求查询服务注册中心,找到可用的服务后转发请求到该服务上,和客户端服务发现模式一样,服务都需要在注册中心进行服务注册和注销。
+
+- 优点:服务的发现逻辑对客户端是透明的。
+- 缺点:需要额外部署和维护负载均衡器。
+
+![error/server service discovery.png](https://static.apiseven.com/202108/1646299531288-3ff99279-3ab6-49d7-8abf-68461f50c5c0.png)
+
+服务端发现模式实现逻辑如下:
+
+1. 新服务启动时,主动向注册中心注册,服务注册中心会存储新服务的服务名和地址;
+2. 当客户端需要某个服务时,会使用服务名向负载均衡器发起查询;
+3. 负载均衡器根据客户端请求的服务名,代理客户端向服务注册中心发起请求;
+4. 负载均衡器获得返回的地址后,根据具体的算法选择其中一个发起调用。
+
+## 使用 CoreDNS 的优势
+
+CoreDNS 是一个用 `Go` 语言编写的开源 DNS 服务器,由于它的灵活性和可扩展性,常用于多容器环境中的 DNS 服务和服务发现。CoreDNS 建立在 Caddy 这个 HTTP/2 Web 服务器之上,实现了一个插件链的架构,将很多 DNS 相关的逻辑都抽象成了一层一层的插件,实现起来更灵活和易扩展,用户选择的插件会被编译到最终的可执行文件中,运行效率也非常高。CoreDNS 是首批加入 CNCF(云原生计算基金会)并且是已经毕业的云原生开源项目,也是 Kuberneters 中默认的 DNS 服务。
+
+相比于常见的服务发现框架(Apache ZooKeeper 和 Consul),CoreDNS 实现服务发现有哪些优势呢?
+
+服务发现的原理和计算机网络中重要的基础设施—— DNS 域名系统比较相似,DNS 域名系统把很少变动的域名与经常变动的服务器 IP 地址进行绑定,而服务发现机制则是把很少变动的服务名与服务地址绑定。由此我们可以借由 DNS 实现类似服务注册中心的功能,只需要将 DNS 中存储的域名转换为服务名即可。由于许多计算机内置了 DNS 功能,所以我们只需要在原有 DNS 系统上修改配置就可以了,不需要做太多额外的事情。
+
+## 原理架构
+
+整体架构如下:
+
+1. 客户端向 APISIX 发起请求调用服务。
+2. APISIX 根据设置好的路由来访问上游服务节点(具体配置可见下文),在 APISIX 中可以设置上游信息通过 DNS 方式获取,只要正确设置了 DNS 服务器的 IP 地址,APISIX 会自动向该地址发起请求,获取 DNS 中对应服务的地址。
+3. CoreDNS 根据请求的服务名返回可用的地址列表。
+4. APISIX 根据可用地址和配置的算法,从其中选择一个发起调用。
+
+![error/architecture.png](https://static.apiseven.com/202108/1646299586044-3b44e6a8-b7a9-4ba6-a69c-8d08772b6065.png)
+
+## 如何使用
+
+### 前提条件
+
+本文操作基于以下环境进行。
+
+- 操作系统 Centos 7.9。
+- Apache APISIX 2.12.1,详情请参考:[如何构建 Apache APISIX](https://apisix.apache.org/zh/docs/apisix/how-to-build)。
+- CoreDNS 1.9.0,详情请参考:[CoreDNS 安装指南](https://coredns.io/manual/toc/#installation)。
+- Node.js 10.15.0,详情请参考:[Node.js 安装指南](https://github.com/nodejs/help/wiki/Installation)。
+
+### 操作步骤
+
+1. 使用 Node.js 的 `Koa` 框架在 `3005` 端口启动一个简单的测试服务。
+
+访问此服务会返回 `Hello World` 的字串,稍后我们将通过 CoreDNS 获取这个服务的地址。
+
+```Shell
+  // 使用 Koa 框架搭建服务
+  const Koa = require('koa');
+  const app = new Koa();
+
+  app.use(async ctx => {
+    ctx.body = 'Hello World';
+  });
+
+  app.listen(3005);
+```
+
+2. 配置 CoreDNS。
+
+CoreDNS 默认监听 `53` 端口,并且会读取在相同目录中的 `Corefile` 配置文件。初始条件下,同目录中并没有 `Corefile` 文件,因此我们需要创建并完成配置。
+
+`Corefile` 主要是通过配置插件来实现功能,因此我们需要配置三个插件:
+
+- `hosts`:可以通过此参数将服务名和 IP 地址绑定,`fallthrough` 表示在当前插件无法返回正常数据时可以把请求转发给下一个插件处理(如果存在)。
+- `forward`:表示将请求代理到指定的地址,一般是权威 DNS 服务器地址。
+- `log`:不配置任何参数代表将日志信息打印到控制台界面,以便进行调试。
+
+```Shell
+  .:1053 {              # 监听在1053端口
+      hosts {
+          10.10.10.10 hello
+          # 将服务名 “coredns” 和IP地址绑定
+          fallthrough
+      }
+      forward . 114.114.114.114:53
+      log
+  }
+```
+
+3. 配置 Apache APISIX。
+
+在 `conf/config.yaml` 文件中添加相关配置并重新加载 Apache APISIX。
+
+```Shell
+  # config.yml
+  # ...other config
+  discovery:
+     dns:
+       servers:
+          - "127.0.0.1:1053"  # 使用 DNS 服务器的真实地址
+                              # 此处为本机的1053端口
+```
+
+4. 配置 Apache APISIX 中的路由信息。
+
+接下来我们通过请求 `Admin API` 配置相关路由信息
+
+```Shell
+  curl http://127.0.0.1:9080/apisix/admin/routes/1 \
+  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+  {
+      "uri": "/core/*",
+      "upstream": {
+          "service_name": "hello:3005",
+          # 将服务名命名为coredns,与CoreDNS中hosts插件的配置保持一致
+          "type": "roundrobin",
+          "discovery_type": "dns" # 将服务发现类型设置为DNS
+      }
+  }'
+```
+
+5. 验证。
+
+- 在本机上验证
+
+```Shell
+  curl 127.0.0.1:9080/core/hello -i
+
+  HTTP/1.1 200 OK
+  Content-Type: text/plain; charset=utf-8
+  Content-Length: 11
+  Connection: keep-alive
+  Date: Wed, 16 Feb 2022 08:44:08 GMT
+  Server: APISIX/2.12.1
+
+  Hello World
+```
+
+- 在其他主机上验证
+
+```Shell
+  curl 10.10.10.10:9080/core/hello -i
+
+  HTTP/1.1 200 OK
+  Content-Type: text/plain; charset=utf-8
+  Content-Length: 11
+  Connection: keep-alive
+  Date: Wed, 16 Feb 2022 08:43:32 GMT
+  Server: APISIX/2.12.0
+
+  Hello World
+```
+
+通过上述返回结果可以看到,服务是可以正常运行的。
+
+6. 模拟容器因各种原因无法提供服务,导致 IP 地址发生变更。
+
+我们需要在另一台服务器上搭建相同的服务,同样运行在 `3005` 端口,但是 IP 地址发生变化,返回字符串改为 `Hello, Apache APISIX`。
+
+```Shell
+// 使用 Koa 框架搭建服务
+const Koa = require('koa');
+const app = new Koa();
+
+app.use(async ctx => {
+  ctx.body = 'Hello, Apache APISIX';
+});
+
+app.listen(3005);
+````
+
+修改 `Corefile` 配置并重启 CoreDNS,其他配置不作修改。配置示例如下:
+
+```Shell
+.:1053 {                           # 监听在1053端口
+    hosts {
+        10.10.10.11 hello        # 修改服务IP地址
+        # 将服务名 “coredns” 和IP地址绑定
+        fallthrough
+    }
+    forward . 114.114.114.114:53  
+    log
+}
+```
+
+> DNS 存在缓存机制,当我们用 `dig` 命令请求解析新的域名时,在返回的 `DNS record` 中会看到一个数字字段,即 `TTL` 字段,一般是 `3600`,即一个小时。在 `TTL` 时间段内发往该域名的请求不会再向 DNS 服务器请求解析地址,而是直接在本地缓存中获取该域名对应的地址。
+
+通过验证我们可以发现,请求已经重新指向新的地址。验证如下:
+
+```Shell
+  curl 127.0.0.1:9080/core/hello -i
+
+  HTTP/1.1 200 OK
+  Content-Type: text/plain; charset=utf-8
+  Content-Length: 11
+  Connection: keep-alive
+  Date: Wed, 16 Feb 2022 08:44:08 GMT
+  Server: APISIX/2.12.0
+
+  Hello, Apache APISIX
+```
+
+## 总结
+
+本文主要介绍了服务发现的类型以及在 Apache APISIX 中如何使用 CoreDNS。您可以根据自身的业务需求和过往技术架构使用 Apache APISIX 与 CoreDNS。
+
+Apache APISIX 项目目前正在开发其他插件以支持集成更多服务,如果您对此有兴趣,您可以通过 [GitHub Discussions](https://github.com/apache/apisix/discussions) 发起讨论,或通过[邮件列表](https://apisix.apache.org/docs/general/subscribe-guide)进行交流。