In order to give you better service we use cookies. By continuing to use our website, you agree to the use of cookies as described in our Cookie Policy

Kong Logo
  • Request Demo
  • Install
  • Products
    • Kong Gateway
      Install Kong Open Source
      • Overview
      • Control API

        Own your Kong experience to customize your API and microservices workflows.

      • Kong Proxy

        Deliver performance needed for microservices, service mesh, and cloud native deployments.

        • Overview
        • Multi-protocol
      • Kong Plugins

        Unleash the full power of Kong with a robust ecosystem of plugins.

    • Kong Enterprise
      DemoFree Trial
      • Overview
      • Kong Manager

        Monitor and manage all your services with a consumer-grade interface.

        • Overview
      • Teams

        Organize developers and assign permissions to improve efficiency and compliance.

        • Overview
        • RBAC
        • Workspaces
      • Kong Studio

        Empower your developers with the Kong Studio Integrated Development Environment.

      • Dev Portal

        Accelerate innovation across your organization with the Kong Developer Portal.

      • Brain

        Automatically standardize documentation and create a visual map of your services.

      • Immunity

        Autonomously identify service issues with machine learning-powered anomaly detection.

      • Kong for Kubernetes

        The only fully native Kubernetes Ingress Controller for enhanced API management.

      • Enterprise Plugins

        Instantly implement policies built for global scale with Kong Enterprise Plugins.

      • Vitals

        Monitor your Kong Enterprise health and microservice API transactions traversing Kong.

  • Solutions
    • API Gateway

      Take control of your microservices traffic with the world’s most popular API gateway.

    • Kubernetes

      Own your Kubernetes cluster by extending Kong functionality as an ingress controller.

    • Service Mesh

      Inject Kong as a sidecar for your services to go from mess to mesh.

  • Plugins
  • Open Source
    • Install Kong Gateway
    • Kong Community
    • Kubernetes Ingress
    • Kuma
    • Insomnia
  • Docs
    • Get Started
      • Install Kong Gateway
      • Install Kong Enterprise
    • Learn
      • Kong Gateway
      • Kong Enterprise
      • Kong Studio
      • Plugins Hub
  • Resources
    • Learning
      • eBooks
      • Webinars
      • Briefs
      • Blog
      • API Gateway
      • Microservices
    • Community
      • Community
      • Kong Nation
      • Kong Summit
      • GitHub
    • Support
      • Enterprise Support Portal
      • FAQS
  • Company
    • About
    • Customers
    • Investors
    • Careers
    • Partners
    • Press
    • Contact
  • Request Demo
Edit this Page
Kong Kong Enterprise Kong Studio Open Sidebar
Documentation

CLI Reference

  • 1.4.x (latest)
  • 1.3.x
  • 1.2.x
  • 1.1.x
  • 1.0.x
  • 0.14.x
  • 0.13.x
  • 0.12.x
  • 0.11.x
  • 0.10.x
  • 0.9.x
  • 0.8.x
  • 0.7.x
  • 0.6.x
  • 0.5.x
  • 0.4.x
  • 0.3.x
  • 0.2.x
Getting Started
  • Introduction
  • Five-minute quickstart
  • Configuring a Service
  • Enabling Plugins
  • Adding Consumers
Guides & References
  • Configuration reference
  • CLI reference
  • Proxy reference
  • Authentication reference
  • Load balancing reference
  • Health checks and circuit breakers reference
  • Clustering reference
  • Network & Firewall
  • Public Lua API reference
  • Securing the Admin API
  • Plugin Development Guide
    • Introduction
    • File structure
    • Implement custom logic
    • Plugin configuration
    • Access the datastore
    • Store custom entities
    • Caching custom entities
    • Extending the Admin API
    • Writing tests
    • (un)Install your plugin
Admin API
  • Supported Content Types
  • Information routes
    • Retrieve node information
    • Retrieve node status
  • Service Object
    • Add Service
    • Retrieve Service
    • List Services
    • Update Service
    • Delete Service
  • Route Object
    • Add Route
    • Retrieve Route
    • List Routes
    • List Routes associated to a Service
    • Update Route
    • Delete Route
  • API Object routes
    • Add API
    • Retrieve API
    • List APIs
    • Update API
    • Update or create API
    • Delete API
  • Consumer Object routes
    • Create Consumer
    • Retrieve Consumer
    • List Consumers
    • Update Consumer
    • Update or create Consumer
    • Delete Consumer
  • Plugin Object routes
    • Add Plugin
    • Retrieve Plugin
    • List all Plugins
    • Update Plugin
    • Update or Add Plugin
    • Delete Plugin
    • Retrieve Enabled Plugins
    • Retrieve Plugin Schema
  • Certificate Object routes
    • Add Certificate
    • Retrieve Certificate
    • List Certificates
    • Update Certificate
    • Update or Create Certificate
    • Delete Certificate
  • SNI Object routes
    • Add SNI
    • Retrieve SNI
    • List SNIs
    • Update SNI
    • Update or Create SNI
    • Delete SNI
  • Upstream Object routes
    • Add Upstream
    • Retrieve Upstream
    • List all Upstreams
    • Update Upstream
    • Update or create Upstream
    • Delete Upstream
    • Show Upstream health for node
  • Target Object routes
    • Add Target
    • List Targets
    • List All Targets
    • Delete Target
    • Set Target as Healthy
    • Set Target as Unhealthy
Maybe you were looking for the Enterprise Documentation instead?
Careful! You are browsing documentation for an outdated version of Kong. Go here to browse the documentation for the latest version.

Table of Contents

  • Introduction
  • Global flags
  • Available commands
    • kong check
    • kong prepare
    • kong health
    • kong migrations
    • kong quit
    • kong reload
    • kong restart
    • kong start
    • kong stop
    • kong version

Introduction

The provided CLI (Command Line Interface) allows you to start, stop, and manage your Kong instances. The CLI manages your local node (as in, on the current machine).

If you haven’t yet, we recommend you read the configuration reference.

Global flags

All commands take a set of special, optional flags as arguments:

  • --help: print the command’s help message
  • --v: enable verbose mode
  • --vv: enable debug mode (noisy)

Back to TOC

Available commands

kong check

Usage: kong check <conf>

Check the validity of a given Kong configuration file.

<conf> (default /etc/kong.conf or /etc/kong/kong.conf) configuration file

Back to TOC


kong prepare

This command prepares the Kong prefix folder, with its sub-folders and files.

Usage: kong prepare [OPTIONS]

Prepare the Kong prefix in the configured prefix directory. This command can
be used to start Kong from the nginx binary without using the 'kong start'
command.

Example usage:
  kong prepare -p /usr/local/kong -c kong.conf && kong migrations up &&
    nginx -p /usr/local/kong -c /usr/local/kong/nginx.conf

Options:
 -c,--conf    (optional string) configuration file
 -p,--prefix  (optional string) override prefix directory
 --nginx-conf (optional string) custom Nginx configuration template

Back to TOC


kong health

Usage: kong health [OPTIONS]

Check if the necessary services are running for this node.

Options:
  -p,--prefix (optional string) prefix at which Kong should be running

Back to TOC


kong migrations

Usage: kong migrations COMMAND [OPTIONS]

Manage Kong's database migrations.

The available commands are:
  list   List migrations currently executed.
  up     Execute all missing migrations up to the latest available.
  reset  Reset the configured database (irreversible).

Options:
  -c,--conf (optional string) configuration file

Back to TOC


kong quit

Usage: kong quit [OPTIONS]

Gracefully quit a running Kong node (Nginx and other
configured services) in given prefix directory.

This command sends a SIGQUIT signal to Nginx, meaning all
requests will finish processing before shutting down.
If the timeout delay is reached, the node will be forcefully
stopped (SIGTERM).

Options:
  -p,--prefix  (optional string) prefix Kong is running at
  -t,--timeout (default 10) timeout before forced shutdown

Back to TOC


kong reload

Usage: kong reload [OPTIONS]

Reload a Kong node (and start other configured services
if necessary) in given prefix directory.

This command sends a HUP signal to Nginx, which will spawn
new workers (taking configuration changes into account),
and stop the old ones when they have finished processing
current requests.

Options:
  -c,--conf    (optional string) configuration file
  -p,--prefix  (optional string) prefix Kong is running at
  --nginx-conf (optional string) custom Nginx configuration template

Back to TOC


kong restart

Usage: kong restart [OPTIONS]

Restart a Kong node in the given prefix directory.

This command is equivalent to doing both 'kong stop' and
'kong start'.

Options:
  -c,--conf        (optional string)   configuration file
  -p,--prefix      (optional string)   prefix at which Kong should be running
  --nginx-conf     (optional string)   custom Nginx configuration template
  --run-migrations (optional boolean)  optionally run migrations on the DB

Back to TOC


kong start

Usage: kong start [OPTIONS]

Start Kong (Nginx and other configured services) in the configured
prefix directory.

Options:
  -c,--conf        (optional string)   configuration file
  -p,--prefix      (optional string)   prefix at which Kong should be running
  --nginx-conf     (optional string)   custom Nginx configuration template
  --run-migrations (optional boolean)  optionally run migrations on the DB

Back to TOC


kong stop

Usage: kong stop [OPTIONS]

Stop a running Kong node (Nginx and other configured services) in given
prefix directory.

This command sends a SIGTERM signal to Nginx.

Options:
  -p,--prefix (optional string) prefix Kong is running at

Back to TOC


kong version

Usage: kong version [OPTIONS]

Print Kong's version. With the -a option, will print
the version of all underlying dependencies.

Options:
  -a,--all    get version of all dependencies

Back to TOC

  • Kong
    Star
  • Products
    • Kong
    • Kong Enterprise
    • Kong Studio
    • Subscriptions
  • Resources
    • Enterprise Support
    • Documentation
    • Partners
    • Webinars
    • Ebooks
  • Company
    • About
    • Customers
    • Investors
    • News
    • Careers Hiring!
    • Kong Summit
    • Contact
  • Open Source
    • Install
    • GitHub
    • Kong Nation
    • Community
  • © Kong Inc. 2019   Terms•Privacy