Kong is a scalable, open source API Platform (also known as an API Gateway or API Middleware). Kong was originally built by Kong Inc. (formerly known as Mashape) to secure, manage, and extend over 15,000 Microservices for its API Marketplace, which generates billions of requests per month.
4. Introduction
• Open-source cloud-native, fast, scalable, and distributed Micro
services Abstraction Layer
• Backed by the battle-tested NGINX with a focus on high performance,
Kong was made available as open-source platform in 2015 by
Mashape.
• Under active development, Kong is used in production at thousand of
organization startup, from global 5000 and government organization
• Licensing Model :
• Enterprise Edition (EE)
• Community Edition (CE)
5. Introduction – What Is Kong
• Kong is API Gateway : it’s a form of middleware between clients and
your API-based applications
• Kong easily and consistently extends the features of your api’s. Some
of the popular feature deployed through Kong include :
• Authentication
• Security
• Traffic control
• Server-less
• Analytic & monitoring
• Request/response transformations
• And Logging
6. Why Use Kong ?
• Radically Extensible
• Blazingly Fast
• Open Source (https://github.com/Kong)
• Cloud Native
• Support Docker
• Restful
7. Gartner 2022, API Management
For the third consecutive year, we're
happy to announce that Kong has
been recognized as a Leader in the
Gartner Magic Quadrant for Full Life
Cycle API Management and is
positioned furthest to the right for
Completeness of Vision.
Link :
https://konghq.com/blog/news/gartn
er-magic-quadrant-api-management-
2022
8. Kong Architecture
• Kong Server: This component acts as a proxy for all requests.
It consists of a public layer through which all requests for
accessing the APIs it exposes are funneled, and a private
layer for managing and configuring those APIs. Also, it allows
us to enable, disable and configure the installed plugins.
• Kong Datastore: an external database where all Kong
configurations are stored, along with their plugins or APIs.
The datastores supported by default are Cassandra and
PostgreSQL. Important: Kong uses its own cache memory to
run. However, in certain cases, some plugins such as rate-
limiting, require additional components such as Redis.
Link : https://www.bbva.com/en/innovation/api-gateways-
kong-vs-tyk/
9. Kong Ports
• 8000 – for proxying. This is where Kong Listens for http traffic
• 8443 - for proxying https traffic
• 8001 – provides Kong’s admin API that you can use to operate Kong
• 7946 – Which Kong uses for inter-nodes communication with other
Kong Nodes both UDP dan TCP traffic must be allowed
• 7373 – used by Kong to communicate with the local clustering agent
10. Kong Enterprise Edition - Features
• Admin GUI
• Dev Portal
• API Analytics
• More scalability
• More security
• Support 24/7
11. Kong Community Edition - Features
• Available on Github
• No UI & Analytic on CE
• OS community UI :
• Konga
• Kongdash
• Kong Dashboard (desktop)
• Analytic :
• ELK
• Runscope, Datadog
12. Kong Community Edition
A lot of open source plugins
• Authentication (Basic, key, OAUTh 2,LDAP, JWT, HMAC)
• Security (ACL, CORS, Dynamics SSL, IP Restriction, Bot Detection)
• Traffic Control (Rate Limiting, Response Rate Limiting, Request Size
Limiting, Request termination)
• ServerLess (AWS Lamda, OpenWhisk)
• Analytic & Monitoring (Galileo, Datadog, Runscope)
• Transformations (Request Transformer, Response Transformer,
Correlation ID)
• Logging (TCP, UDP, HTTP, File, SysLog, StatsD, Loggly)
13. A. Install KONG in Docker
1. Install Network for KONG
docker network create kong-net
2. Install Database for Kong (Postgres Version)
docker run -d --name kong-database --network=kong-net -p 5432:5432 -e
"POSTGRES_USER=kong" -e “POSTGRES_DB=kong” -e
"POSTGRES_PASSWORD=kong" postgres:9.6
3. Setting Kong Database :
docker run --rm --network=kong-net -e "KONG_DATABASE=postgres" -e
"KONG_PG_HOST=kong-database" -e "KONG_PG_PASSWORD=kong" -e
"KONG_CASSANDRA_CONTACT_POINTS=kong-database" kong:latest kong
migrations bootstrap
14. A. Install KONG in Docker
4. Then create a kong container and customize the network and db
docker run -d --name kong --network=kong-net -e
"KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e
"KONG_PG_PASSWORD=kong" -e
"KONG_CASSANDRA_CONTACT_POINTS=kong-database" -e
"KONG_PROXY_ACCESS_LOG=/dev/stdout" -e
"KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e
"KONG_PROXY_ERROR_LOG=/dev/stderr" -e
"KONG_ADMIN_ERROR_LOG=/dev/stderr" -e
"KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl” -p 8000:8000 -p
8443:8443 -p 127.0.0.1:8001:8001 -p 127.0.0.1:8444:8444 kong:latest
15. A. Install KONG in Docker
• Test Kong , URL : http://localhost:8001/
16. B. Install Konga (Kong Dashboard) in Docker
1. Install Konga
docker run -d -p 1337:1337 --network=kong-net --name konga -v
/var/data/kongadata:/app/kongadata -e "NODE_ENV=production"
pantsel/konga
2. Set up a network for konga, namely the kong-net network and set up
the PostgreSQL db.
docker run --rm --network=kong-net pantsel/konga -c prepare -a
postgres -u postgresql://kong:kong@kong-database:5432/konga_db
17. B. Install Konga (Kong Dashboard) in Docker
3. If successful run the konga and type : http://localhost:1337/
4. Create username and password , then login
18. B. Install Konga (Kong Dashboard) in Docker
5. Add New Connection
6. Type the connection name : kong-net and URL : http://kong:8001
19. DEMO
• Create Service and Route to sample api :
https://api.sampleapis.com/countries/countries