Control Plane Service Discovery
This document describes how to implement service discovery with Nacos and Zookeeper on the APISIX Control Plane.
APISIX-Seed Architecture#
Apache APISIX has supported Data Plane service discovery in the early days, and now APISIX also supports Control Plane service discovery through the APISIX-Seed project. The following figure shows the APISIX-Seed architecture diagram.
The specific information represented by the figures in the figure is as follows:
- Register an upstream with APISIX and specify the service discovery type. APISIX-Seed will watch APISIX resource changes in etcd, filter discovery types, and obtain service names.
- APISIX-Seed subscribes the specified service name to the service registry to obtain changes to the corresponding service.
- After the client registers the service with the service registry, APISIX-Seed will obtain the new service information and write the updated service node into etcd;
- When the corresponding resources in etcd change, APISIX worker will refresh the latest service node information to memory.
note
It should be noted that after the introduction of APISIX-Seed, if the service of the registry changes frequently, the data in etcd will also change frequently. So, it is best to set the --auto-compaction option when starting etcd to compress the history periodically to avoid etcd eventually exhaust its storage space. Please refer to revisions.
Why APISIX-Seed#
- Network topology becomes simpler - APISIX does not need to maintain a network connection with each registry, and only needs to pay attention to the configuration information in etcd. This will greatly simplify the network topology. 
- Total data volume about upstream service becomes smaller - Due to the characteristics of the registry, APISIX may store the full amount of registry service data in the worker, such as consul_kv. By introducing APISIX-Seed, each process of APISIX will not need to additionally cache upstream service-related information. 
- Easier to manage - Service discovery configuration needs to be configured once per APISIX instance. By introducing APISIX-Seed, Apache APISIX will be in different to the configuration changes of the service registry. 
Supported service registry#
ZooKeeper and Nacos are currently supported, and more service registries will be supported in the future. For more information, please refer to: APISIX Seed.
- If you want to enable control plane ZooKeeper service discovery, please refer to: ZooKeeper Deployment Tutorial. 
- If you want to enable control plane Nacos service discovery, please refer to: Nacos Deployment Tutorial.