Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 2.68 KB

how-it-works.md

File metadata and controls

43 lines (28 loc) · 2.68 KB

How It Works

This article explains how apisix-mesh-agent extends Apache APISIX as the Service Mesh sidecar.

Run Mode

apisix-mesh-agent can be run alone or bundled with Apache APISIX. It depends on how you pass the running options to it.

If you want to run it alone, for instance, you want to run the apisix-mesh-agent and APISIX in different Pods/VMs so that the apisix-mesh-agent can be shared by multiple APISIX instances, then just pass --run-mode standalone for it. In such a case, the etcd.host configuration in APISIX should be configured to the gRPC listen address of apisix-mesh-agent.

/path/to/apisix-mesh-agent sidecar --provisioner xds-v3-file --xds-watch-files /path/to/xds-assets --run-mode standalone

As a common pattern, sidecar and apps are always deployed together, if you run apisix-mesh-agent under the "bundle" mode, it will launch the Apache APISIX and close it when you shut apisix-mesh-agent down.

/path/to/apisix-mesh-agent sidecar --apisix-bin-path /path/to/bin/apisix --apisix-home-path /path/to/apisix/ --provisioner xds-v3-file --xds-watch-files /path/to/xds-assets --run-mode bundle

You should pass the correct Apache APISIX binary path and home path, apisix-mesh-agent render a configuration file for it, each time you start apisix-mesh-agent, configuration file will be written to /path/to/apisix/conf/config-default.yaml.

Traffic Interception

Before run apisix-mesh-agent and Apache APISIX, the iptables rules should be set up in advance, please see traffic-interception for details.

Configuration Provisioning

Currently, apisix-mesh-agent supports to fetch configurations from xDS management servers, it converts the data structures from xDS to the Routes, Upstreams and others in Apache APISIX. Now only the SToW part was supported, apisix-mesh-agent compares the last two states and get the differences from them, then generating ADD, DELETE and UPDATE events so data in memory can be changed incrementally.

ETCD V3 APIs

In order to let APISIX fetches configuration from apisix-mesh-agent, the apisix-mesh-agent implments the ETCD V3 APIs, not all APIs were supported but at least the part that used by Apache APISIX was covered.

From the perspective of Apache APISIX, apisix-mesh-agent is an ETCD cluster.