API Manager Stack

Run Kong Server + Konga + Prometheus + Grafana + API & DDBB + Splunk

Clone the proyect and run docker-compose up

https://github.com/safernandez666/Kong-API-Manager.git && cd Kong-API-Manager

chmod +x kong-start.sh

sh kong-start.sh

Running the stack

kongscript

Containers

Check the name of the containers for future configurations.

dockerps

Architecture

Architecture

Create Service on Kong

curl -i -X POST
--url http://localhost:8001/services/
--data 'name=MyAPI'
--data 'url=http://api:5000'

Test

curl -i http://localhost:8001/services/MyAPI

Create Route on the Service

curl -i -X POST http://localhost:8001/services/MyAPI/routes
--data 'paths[]=/'
--data name=main

Test

curl -i -X GET http://localhost:8000/request

Konga GUI

Enter on http://localhost:1337

I create the Username and Password on kus.js. It's important change the Password.

Create the connection

Kong_Config

Kong_1

Add plug-in and send logs to Splunk

Kong_2

Kong_3

Let's add some security. For this, a Customer is necessary, add an Authentication method and then associate it with the route.

Create mi Customer: santiago

CreateCustomer

Generate my API KEY

GenerateAPIKEY

My API KEY

APIKEY

On the route, add the use of the API Key.

AddAPIKEYRoute

AddAPIKEYRoute_2

Try with Postman or Command Line.

curl -X GET
'http://localhost:8000'
-H 'apikey: fwASbEngZ4zB609S7WASDt0X64R5sdkV'

Postman

Splunk

Enter on http://localhost:8888 with Username: admin and Password: password

Create the Data Input on port 1514 to receive the Kong's logs. I create a panel, to visualize some data. You can create yours.

In the proyecto you have the dashboard to import.

SplunkDashboard

You can post the Plugin on Kong with:

curl -X POST http://localhost:8001/services/MyAPI/plugins --data "name=tcp-log" --data "config.host=NAMECONTAINERSPLUNK" --data "config.port=1514"

Prometheus + Grafana

Prometheus to store the data and Grafana to visualize it. Add the plugin.

Plugin

Ingress on Grafana on http://localhost:3000 with Username: admin and Password: admin. Import data from prometheus. The docker is prometheus on port 9090.

Prometheus_1

Import the Dashboard.

Prometheus_2

Load the JSON.

Prometheus_3

Enjoy the metrics.

PrometheusDashboard

GitHub