Kong Gateway Licensing

Kong Gateway can be used with or without a license. For Enterprise functionality, Kong Gateway enforces the presence and validity of a Kong Konnect license file.

FeatureFree ModeEnterprise Subscription
Manager
Admin API
Vitals
Dev Portal
Enterprise plugins

Deploying the license file

License file checking is done independently by each node as the Kong process starts. No network connectivity is necessary to execute the license validation process.

There are multiple ways to configure a license file on a Kong Gateway node. The method you use may depend on your deployment type.

  • Hybrid mode deployment: The license file must be deployed to control plane nodes. The control planes then distribute the license to the data planes in their clusters. Use the /licenses endpoint to apply the license to the control plane.

  • Traditional deployment with no separate control plane: License files must be deployed to each node running Kong Gateway. Use any of the provided configuration methods to apply the license.

Here are the possible license configuration methods, in the order that Kong Gateway checks for them:

  1. If present, the contents of the environment variable KONG_LICENSE_DATA are used.
  2. Kong will search in the default location /etc/kong/license.json.
  3. If present, the contents of the file defined by the environment variable KONG_LICENSE_PATH is used.
  4. Directly deploy a license using the /licenses Admin API endpoint.

In this manner, the license file can be deployed either as a file on the node filesystem, as an environment variable, or through the /licenses Admin API endpoint. The simplest method is using the Admin API.

Note that unlike most other KONG_* environment variables, the KONG_LICENSE_DATA and KONG_LICENSE_PATH cannot be defined in-line as part of any kong CLI commands. License file environment variables must be exported to the shell in which the Nginx process will run, ahead of the kong CLI tool.

For more information, see Deploy Your License.

Examining the license data on a Kong Gateway node

Retrieve license data using the Admin API’s /licenses endpoint, or through the Admin GUI in Kong Manager.

License expiration

When a license expires, you will still have access to your Kong Gateway and its configuration. Any Enterprise-specific features will be locked, and the Admin API will not be accessible until the license is either renewed or the subscription is downgraded to the free mode.

In the event of a downgrade, the Admin API will be unlocked, but Enterprise features such Dev Portal, Enterprise plugins, and others will no longer be accessible.

License expiration logs

Kong Gateway logs the license expiration date on the following schedule:

  • 90 days before: WARN log entry once a day
  • 30 days before: ERR log entry once a day
  • At and after expiration: CRIT log entry once a day

Troubleshooting

When a valid license file is properly deployed, license file validation is a transparent operation; no additional output or logging data is written or provided. If an error occurs when attempting to validate the license, or the license data is not valid, an error message will be written to the console and logged to the Kong error log, followed by the process quitting. Below are possible error messages and troubleshooting steps to take:

license path environment variable not set

Neither the KONG_LICENSE_DATA nor the KONG_LICENSE_PATH environment variables were defined, and no license file could be opened at the default license location (/etc/kong/license.json)

internal error

An internal error has occurred while attempting to validate the license. Such cases are extremely unlikely; contact Kong support to further troubleshoot.

error opening license file

The license file defined either in the default location, or using the KONG_LICENSE_PATH env variable, could not be opened. Check that the user executing the Nginx process (e.g., the user executing the Kong CLI utility) has permissions to read this file.

error reading license file

The license file defined either in the default location, or using the KONG_LICENSE_PATH env variable, could be opened, but an error occurred while reading. Confirm that the file is not corrupt, that there are no kernel error messages reported (e.g., out of memory conditions, etc). This is a generic error and is extremely unlikely to occur if the file could be opened.

could not decode license json

The license file data could not be decoded as valid JSON. Confirm that the file is not corrupt and has not been altered since you received it from Kong Inc. Try re-downloading and installing your license file from Kong Inc.

If you still receive this error after reinstallation, contact Kong support.

invalid license format

The license file data is missing one or more key/value pairs. Confirm that the file is not corrupt and has not been altered since you received it from Kong Inc. Try re-downloading and installing your license file from Kong Inc.

If you still receive this error after reinstallation, contact Kong support.

validation failed

The attempt to verify the payload of the license with the license’s signature failed. Confirm that the file is not corrupt and has not been altered since you received it from Kong Inc. Try re-downloading and installing your license file from Kong Inc.

If you still receive this error after reinstallation, contact Kong support.

license expired

The system time is past the license’s license_expiration_date.

invalid license expiration date

The data in the license_expiration_date field is incorrectly formatted. Try re-downloading and installing your license file from Kong Inc.

If you still receive this error after reinstallation, contact Kong support.