Get Kong
Note: This quickstart runs on your local machine to explore Kong Gateway’s capabilities. If you want to run Kong Gateway as a part of a production-ready API platform, start on the /install page.
Kong Gateway is a lightweight, fast, and flexible cloud-native API gateway. Kong Gateway sits in front of your service applications, dynamically controlling, analyzing, and routing requests and responses. Kong Gateway implements your API traffic policies by using a flexible, low-code, plugin-based approach.
This tutorial will help you get started with Kong Gateway by setting up a local installation and walking through some common API management tasks.
This page will walk you through running Kong Gateway and verifying it with the Admin API. Once complete, the following tasks can be performed to complete the tutorial:
- Understanding and configuring Services and Routes
- Configuring Rate Limiting to protect upstream Services
- Increase system performance with Proxy Caching
- Load Balancing for horizontal Service scaling
- Protecting Services with Key Authentication
Prerequisites
- Docker is used to run Kong Gateway and supporting database locally
-
curl is used to send requests to Kong Gateway.
curl
is pre-installed on most systems -
jq is used to process JSON responses on the command line. While useful, this tool is
not necessary to complete the tasks of this tutorial. If you wish to proceed without
jq
, modify the commands to removejq
processing.
Get Kong
For the purposes of this tutorial, a quickstart
script is provided to quickly run Kong Gateway and its supporting database.
This script uses Docker to run Kong Gateway and a PostgreSQL database as the backing database.
-
Run Kong Gateway with the
quickstart
script:curl -Ls https://get.konghq.com/quickstart | bash
Note: The quickstart script runs Kong Gateway Enterprise in Free mode. You may run Kong with a license by passing the license to the script via an environment variable. For instructions on this and other advanced usage, pass the
-h
flag to the script:curl -Ls https://get.konghq.com/quickstart | bash -s -- -h
This script runs Docker containers for Kong Gateway and the supporting PostgreSQL database. The script also creates a Docker network for those containers to communicate over. Finally, the database is initialized with the appropriate migration steps, and once the Kong Gateway is ready, you will see the following message:
Kong Gateway Ready
-
Verify that Kong Gateway is running:
Kong Gateway serves an Admin API on the default port
8001
. The Admin API can be used for both querying and controlling the state of Kong Gateway. The following command will query the Admin API, fetching the headers only:curl --head localhost:8001
If Kong Gateway is running properly, it will respond with a
200
HTTP code, similar to the following:HTTP/1.1 200 OK Date: Mon, 22 Aug 2022 19:25:49 GMT Content-Type: application/json Connection: keep-alive Access-Control-Allow-Origin: * Content-Length: 11063 X-Kong-Admin-Latency: 6 Server: kong/3.8.0
-
Evaluate the Kong Gateway configuration:
The root route of the Admin API provides important information about the running Kong Gateway including networking, security, and plugin information. The full configuration is provided in the
.configuration
key of the returned JSON document.curl -s localhost:8001 | jq '.configuration'
You should receive a large JSON response with Kong Gateway configuration information.
-
Access Kong Manager
While the rest of this guide demonstrates configuring Kong Gateway using the Admin API, you can also use Kong Manager to manage your Services, Routes, Plugins, and more. To access Kong Manager, go to the following URL: http://localhost:8002
Note: If you install Kong Gateway (OSS), you will use Kong Manager Open Source. All other Kong Gateway installations use Kong Manager Enterprise.
Every step in this tutorial requires a running Kong Gateway, so leave everything running and proceed to the next steps in this tutorial.