You are browsing documentation for an outdated version. See the latest documentation here.

Get Kong

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, plug-in 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:

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 remove jq 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.

  1. Run Kong Gateway with the quickstart script:

    1. 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, see the code repository documentation.

    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:

    1. Kong is ready!
  2. 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:

    1. curl --head localhost:8001

    If Kong Gateway is running properly, it will respond with a 200 HTTP code, similar to the following:

    1. HTTP/1.1 200 OK
    2. Date: Mon, 22 Aug 2022 19:25:49 GMT
    3. Content-Type: application/json; charset=utf-8
    4. Connection: keep-alive
    5. Access-Control-Allow-Origin: *
    6. Content-Length: 11063
    7. X-Kong-Admin-Latency: 6
    8. Server: kong/3.1.1
  3. 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.

    1. curl -s localhost:8001 | jq '.configuration'

    You should receive a large JSON response with Kong Gateway configuration information.

  4. 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

Every step in this tutorial requires a running Kong Gateway, so leave everything running and proceed to the next steps in this tutorial.


Next Services and Routes