Apache APISIX is a production-ready open source seven-layer full traffic processing platform that serves as an API gateway for business entry traffic with high performance, low latency, official dashboard support, and over fifty plugins. If you are using Kong and are interested in APISIX but struggle to get started, try our just open source migration tool Kong-To-APISIX to help you migrate smoothly with one click.
Apache APISIX is a production-ready open source seven-layer full traffic processing platform that serves as an API gateway for business entry traffic with high performance, low latency, official dashboard support, and over fifty plugins. If you are using Kong and are interested in APISIX but struggle to get started, try our just open source migration tool Kong-To-APISIX to help you migrate smoothly with one click.
What is Kong-To-APISIX
Kong-To-APISIX leverages the declarative configuration files of Kong and APISIX to migrate configuration data, and adapts to the architecture and functionality of both sides. Currently, we support the migration of configuration data for Route, Service, Upstream, Target, Consumer and three plugins Rate Limiting, Proxy Caching and Key Authentication on one side of Kong, and we have completed a minimal demo using Kong’s Getting Started Guide as an example . We have completed a minimal demo.
How to migrate configuration
To export a Kong declarative configuration file using Deck, refer to the following steps: Kong Official Document: Backup and Restore of Kong’s Configuration
Download the repository and run the migration tool, which will generate the declarative configuration file
apisix.yaml
to be used.git clone https://github.com/api7/kong-to-apisix
cd kong-to-apisix
make build
./bin/kong-to-apisix migrate --input kong.yaml --output apisix.yaml
# migrate succeedUse
apisix.yaml
to configure APISIX, refer to Apache APISIX Official Document: Stand-alone mode.
Demo Test
Make sure docker is up and running, deploy the test environment, and use docker-compose to run APISIX and Kong.
git clone https://github.com/apache/apisix-docker
cd kong-to-apisix
./tools/setup.shAdd configuration to Kong and test it according to Kong's Getting Started Guide.
- Expose services via Service and Route for routing and forwarding
- Set up Rate Limiting and Proxy Caching plugins for flow limiting caching
- Set up Key Authentication plugin for authentication
- Set up load balancing via Upstream and Target
Export Kong's declarative configuration file to
kong.yaml
.go run ./cmd/dumpkong/main.go
Run the migration tool, import
kong.yaml
and generate the APISIX configuration fileapisix.yaml
to docker volumes.export EXPORT_PATH=./repos/apisix-docker/example/apisix_conf
go run ./cmd/kong-to-apisix/main.goTest whether the migrated routes, load balancing, plugins, etc. are working properly on Apache APISIX side.
Test key auth plugin.
curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/mock
# output: 401Test proxy cache plugin.
# access for the first time
curl -k -I -s -o /dev/null http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"
# see if got cached
curl -I -s -X GET http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"
# output:
# HTTP/1.1 200 OK
# ...
# Apisix-Cache-Status: HITTest limit count plugin.
for i in {1..5}; do
curl -s -o /dev/null -X GET http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"
done
curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"
# output: 429Test load balance.
httpbin_num=0
mockbin_num=0for i in {1..8}; do
body=$(curl -k -i -s http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org")
if [[ $body == *"httpbin"* ]]; then
httpbin_num=$((httpbin_num+1))
elif [[ $body == *"mockbin"* ]]; then
mockbin_num=$((mockbin_num+1))
fi
sleep 1.5done
echo "httpbin number: "${httpbin_num}", mockbin number: "${mockbin_num}
# output:
# httpbin number: 6, mockbin number: 2
Conclusion
Subsequent development plans for the migration tool are presented in the Roadmap on Kong-To-APISIX's GitHub repository. Feel free to test and use Kong-To-APISIX, and discuss any questions you may have in the Issues section of the repository. Anyone who is interested in this project is welcome to contribute to it!