This repo demonstrate how to config Kong to ship logs, metrics and traces to different backend and use grafana as the dashboard to visulise the data.
The solution
Backend
- Logs -> Loki
- Metrics -> Prometheus
- Traces -> Jaeger
App
Inside the docker/
folder, run docker compose up -d
to start all containers.
- Kong is running in dbless mode and kong config is kong.yaml.
- Use Kong Gateway image and apply the license from environment variable
KONG_LICENSE_DATA
on host machine. If this is not set, Kong gateway image will run in free mode. - I disabled Grafana password. To enable password login, simply remove below environment variables from compose.yaml file.
environment: - GF_AUTH_ANONYMOUS_ENABLED=true - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin - GF_AUTH_DISABLE_LOGIN_FORM=true
- All three datasources and two dashboard are pre-configured. If you change the service name on the compose file, please update the the files in
grafana/
folder.
Inside the kubernetes/
folder, run ./install.sh
to deploy everything for you.
- Kong is also running in dbless mode with Kong ingress controller with Gateway API enabled.
- The script detects environment variable
KONG_LICENSE_DATA
and reates aKongLicence
object accordingly. - I have to create
clusterrole
andclusterrolebinding
for opentelemetry collector to scrape the Kong pod. If you have a better solution, please submit your PR. - Grafana dashboard password is also disabled. Please remove the
env
section of values.yaml if you need the log in page.
Detail explaination of the solution can be found on this blog post.