By Marone: June 2020
Install and run Kong
with docker
Table of contents
- Goal
- What is Kong
- Installation
- List docker containers (snippet)
- Configuring a service
- Call the API directly
- Call the API behind kong
Goal
This is a qiuck article about how install and run Kong with docker.Used technologies
Kong Gateway v2.xDocker 19.x (Running on Windows)
cURL 7.x
What is Kong
Kong Gateway is a open source API Gateway. Kong Server is a lua application built on top of NGINX and acts like a API front-end.The server forwards the traffic between consumers and the API's, the flexible Kong's plugin architecture make easy to add more functionality such as a rate limiting, authentication,request/response transformation, and more.
Kong exposes two endpoints:
- a proxy endpoint for forwarding HTTP(port=8000) and HTTPS(port=8443) traffics
- a admin api endpoint to manage and configure the server. It uses port 8001 and 8444 for handling HTTPS requests
Installation
Step1: Create a Docker network
Step2: Start and prepare Postgres DB
Step3: Start kong
List docker containers (snippet)
Now Kong is up and running
Configuring a service
Step1: Add a service
The Request Body contains:name
: The Service name
url
: The upstream url
Response:
Step2: Add a route
The url specified the service name as attribute{/my-api}
, which we created at step 1. With paths we define a path that match this new route.
Response: