This is a sidekick docker daemon used to automatically declare upstreams and targets into Kong.
2.1K
This is a sidekick docker daemon used to automatically declare upstreams and targets into Kong.
Start the sidekick container:
$ docker run -d \
--volume /var/run/docker.sock:/var/run/docker.sock \
ncarlier/kong-docker-target
Now if you start a container exposing a port and having the label
kong.upstream, this container IP and PORT will be declared in Kong as a target
for the labeled upstream.
Example:
$ docker run -d \
--label "kong.upstream:sample.foo" \
infrastructureascode/hello-world
You can try the demonstration by using the following command:
$ make deploy logs
This command will deploy the following Docker stack:
sample.foo as upstream nameThe sidekick daemon should create the upstream sample.foo into Kong and add
the container IP and port as an active target of this upstream.
If you play with the status of this sample service you should see impacts onto
the Kong configuration.
Example:
$ curl -XGET http://localhost:8001/upstreams/sample.foo/targets/active | jq .
$ docker-compose scale sample=2
$ curl -XGET http://localhost:8001/upstreams/sample.foo/targets/active | jq .
$ docker-compose scale sample=1
$ curl -XGET http://localhost:8001/upstreams/sample.foo/targets/active | jq .
$ docker-compose scale sample=0
$ curl -XGET http://localhost:8001/upstreams/sample.foo/targets/active | jq .
$ ...
Content type
Image
Digest
Size
4.2 MB
Last updated
about 9 years ago
docker pull ncarlier/kong-docker-daemon