You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/04 03:04:59 UTC

[GitHub] [apisix-website] SylviaBABY commented on a change in pull request #935: docs: add CoreDNS blog

SylviaBABY commented on a change in pull request #935:
URL: https://github.com/apache/apisix-website/pull/935#discussion_r819230452



##########
File path: 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, a mechanism is needed that can automatically detect the service status, and dynamically bind a new address when the service address changes. The service discovery mechanism came into being.
+
+## 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 running efficiency is also very high. CoreDNS is the first cloud native open source project to join CNCF (Cloud Native Computing Foundation) and has graduated, and it is also the default DNS service in Kubernetes.
+
+Compared with common service discovery frameworks (Zookeeper and Consul), what are the advantages of CoreDNS implementing service discovery?

Review comment:
       ```suggestion
   Compared with common service discovery frameworks (Apache ZooKeeper and Consul), what are the advantages of CoreDNS implementing service discovery?
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org