Import and export Kong configuration tool written in Go
go get "github.com/romanovskyj/gongfig"
gongfig [global options] command [command options] [arguments...]
export - Dump kong resources write it to the config file
import - Create corresponding kong resources based on provided config file
flush - Delete all resources from kong
help, h - Shows a list of commands or help for one command
--help, -h show help
--version, -v print the version
gongfig export --url=http://localhost:8001 --file /tmp/config.json
gongfig import --url=http://localhost:8001 --file /tmp/config.json
gongfig flush --url=http://localhost:8001
docker run --rm eromanovskyj/gongfig:latest --version
docker run --rm eromanovskyj/gongfig:latest flush --url=http://localhost:8001
docker run --rm -v `pwd`/config.json:/tmp eromanovskyj/gongfig:latest import --url=http://localhost:8001 --file /tmp/config.json
As usually Kong admin api is not reachable externally, you can forward port to your local computer:
kubectl port-forward <kong_pod> 8001:8001
Another option is deploing docker container with gongfig and use it as sidecar application.
The image name is eromanovskyj/gongfig
. You can also deploy a corresponding pod inside your kubernetes cluster, use deployment.yml
for it.
As routes and services are requested simultaneously during config export, you need to use kong 0.14 or later in order to avoid this bug