Installing the Kong use docker compose
1git clone https://github.com/Kong/docker-kong
2cd docker-kong/compose/
3KONG_DATABASE=postgres docker-compose --profile database up
Running Kong admin use docker
1# refer to network name with kong docker compose resource same.
2# https://hub.docker.com/r/pantsel/konga/
3docker run --platform=linux/amd64 -it --rm -p 1337:1337 --network compose_kong-net --name konga -e "NODE_ENV=production" -e "TOKEN_SECRET=xxxxxxx" pantsel/konga
Setting Kong
1# add kong admin api to services
2curl --location --request POST 'http://localhost:8001/services/' \
3--header 'Content-Type: application/json' \
4--data-raw '{
5 "name": "admin-api",
6 "host": "localhost",
7 "port": 8001
8}'
9# add admin api route
10curl --location --request POST 'http://localhost:8001/services/admin-api/routes' \
11--header 'Content-Type: application/json' \
12--data-raw '{
13 "paths": ["/admin-api"]
14}'
15# testing admin api from kong gateway
16curl localhost:8000/admin-api/
17# enable key auth plugin for admin api
18curl -X POST http://localhost:8001/services/admin-api/plugins \
19 --data "name=key-auth"
20# add kong admin as consumer
21curl --location --request POST 'http://localhost:8001/consumers/' \
22--form 'username=konga' \
23--form 'custom_id=cebd360d-3de6-4f8f-81b2-31575fe9846a'
24# create api key form konga
25curl --location --request POST 'http://localhost:8001/consumers/e7b420e2-f200-40d0-9d1a-a0df359da56e/key-auth'