Start Kong Gateway

In this section, you’ll learn how to install and manage your Kong Gateway instance. First, you’ll start Kong Gateway to gain access to its Admin API, where you’ll manage entities including Services, Routes, and Consumers.

Start Kong Gateway using Docker with a database

One quick way to get Kong Gateway up and running is by using Docker with a PostgreSQL database. We recommend this method to test out basic Kong Gateway functionality.

For a comprehensive list of installation options, see our Install page.

  1. Create a Docker network:

    1. docker network create kong-net
  2. Run a PostGreSQL container:

    1. docker run -d --name kong-database \
    2. --network=kong-net \
    3. -p 5432:5432 \
    4. -e "POSTGRES_USER=kong" \
    5. -e "POSTGRES_DB=kong" \
    6. -e "POSTGRES_PASSWORD=kong" \
    7. postgres:9.6

Deprecation warning: Cassandra as a backend database for Kong Gateway is deprecated. This means the feature will eventually be removed.
Our target for Cassandra removal is the Kong Gateway 4.0 release. Starting with the Kong Gateway 3.0 release, some new features might not be supported with Cassandra.

Data sent through the Admin API is stored in Kong’s datastore (Kong supports PostgreSQL and Cassandra).

  1. Prep your database:

    1. docker run --rm \
    2. --network=kong-net \
    3. -e "KONG_DATABASE=postgres" \
    4. -e "KONG_PG_HOST=kong-database" \
    5. -e "KONG_PG_USER=kong" \
    6. -e "KONG_PG_PASSWORD=kong" \
    7. -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
    8. kong:latest kong migrations bootstrap
  2. Start Kong:

    1. docker run -d --name kong \
    2. --network=kong-net \
    3. -e "KONG_DATABASE=postgres" \
    4. -e "KONG_PG_HOST=kong-database" \
    5. -e "KONG_PG_USER=kong" \
    6. -e "KONG_PG_PASSWORD=kong" \
    7. -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
    8. -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
    9. -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
    10. -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
    11. -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
    12. -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
    13. -p 8000:8000 \
    14. -p 8443:8443 \
    15. -p 127.0.0.1:8001:8001 \
    16. -p 127.0.0.1:8444:8444 \
    17. kong:latest
  3. Navigate to http://localhost:8001/.

Kong default ports

By default, Kong listens on the following ports:

  • 8000: listens for incoming HTTP traffic from your clients, and forwards it to your upstream services.
  • 8001: Admin API listens for calls from the command line over HTTP.
  • 8443: listens for incoming HTTPS traffic. This port has a similar behavior to 8000, except that it expects HTTPS traffic only. This port can be disabled via the configuration file.
  • 8444: Admin API listens for HTTPS traffic.

Lifecycle commands

Note: If you are using Docker, exec into the Docker container to use these commands.

Stop Kong Gateway using the stop command:

  1. kong stop

Reload Kong Gateway using the reload command:

  1. kong reload

Start Kong Gateway using the start command:

  1. kong start

Next Steps

Now that you have Kong Gateway running, you can interact with the Admin API.

To begin, go to Configuring a Service ›