Kong Gateway Licenses Explained: How to Deploy, Renew and Troubleshoot Enterprise Licenses
A practical guide with memory tricks and real-world examples for self-managed Kong Gateway Enterprise
If you run self-managed Kong Gateway Enterprise, the license is the one small file that decides whether your gateway is fully manageable or stuck in read-only mode. This guide explains how Kong licenses work, where Kong looks for them, how to deploy them in traditional, hybrid and DB-less setups, what happens when they expire, and how to fix common errors. Each section ends with an easy trick to help you remember it.
Quick answer (TL;DR)
- A License entity configures your Kong Gateway Enterprise license in a self-managed cluster (traditional and hybrid modes).
- Kong loads the license at startup, checking four places in a fixed order.
- Admin API is the only method that automatically sends the license to data planes. It is not supported in DB-less mode.
- license.json and environment variables must be set on every node before it starts.
- Licenses expire at midnight on the expiration date. After that, configuration becomes read-only but traffic keeps flowing.
- You can generate a license report on demand with
GET /license/report. Nothing is sent to Kong.
What is a Kong Gateway license?
A license is the proof that your organization has a Kong Gateway Enterprise subscription. You receive a license file when you sign up. If you bought a subscription but have not received a file, contact your sales representative.
The License entity lets you configure that license inside your cluster, in both traditional and hybrid mode deployments.
Real-world analogy: think of the license as a passport. The airline (your gateway) checks it when you board (startup). It does not phone the embassy (Kong) to verify it: each node checks the file itself, and no network connection is needed for validation.
Memory trick: License = passport, checked at the gate, not in flight. It is read at startup only.
How Kong finds your license: the load order
In hybrid and traditional modes, Kong Gateway checks these four places in order and loads the license at startup:
- The contents of the environment variable
KONG_LICENSE_DATA - The default file
/etc/kong/license.json - The file named by the
KONG_LICENSE_PATHenvironment variable - A license deployed through the
/licensesAdmin API endpoint
Each node checks independently when its Kong process starts.
Memory trick: Data, Default, Path, API. Remember the sentence Dogs Dig Pretty Amazing holes. Data variable, Default file, Path variable, API.
Real-world example: A DevOps engineer sets KONG_LICENSE_DATA in a Kubernetes secret, but an old license.json from last year is still baked into the image. Because the environment variable is checked first, the new license wins. If the variable were missing, Kong would fall back to the old file and the node could start with an expired license. Always know which source is first in line.
Special case: DB-less and Kong Ingress Controller
In DB-less deployments, for example when you apply declarative configuration with POST /config, a license in the declarative configuration overrides KONG_LICENSE_DATA, because the environment variable is only read at startup. When a KongLicense resource exists, Kong Ingress Controller sends it in the configuration payload and it takes precedence.
Memory trick: In DB-less, the config payload outranks the environment variable.
Deployment methods compared
| Method | Traditional (database-backed) | Hybrid mode | DB-less mode |
|---|---|---|---|
| Admin API | Supported | Supported | Not supported |
| license.json file | Supported | Supported | Supported |
| Environment variable | Supported | Supported | Supported |
Memory trick: Only the API has a gap. File and environment variable work everywhere. The Admin API needs a database, so it skips DB-less.
Which method should you pick?
| Your situation | Best method |
|---|---|
| Hybrid mode with many data planes, you want one place to update | Admin API |
| Containers and Kubernetes, secrets injected at deploy time | Environment variable |
| VMs or bare metal, configuration managed by Ansible or similar | license.json file |
| DB-less or Kong Ingress Controller | Environment variable, file, or KongLicense resource |
Method 1: Deploy a license with the Admin API
The control plane sends licenses configured through the /licenses endpoint to all data planes in the cluster. Data planes use the license with the most recent updated_at. This is the only method that applies the license to data planes automatically.
The payload below is a placeholder. Substitute your own license before running the command.
curl -i -X POST http://localhost:8001/licenses/ \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"payload": "<YOUR_LICENSE_JSON_AS_A_STRING>"}'
Real-world example: A company runs one control plane and 40 data planes across three regions. Renewal day arrives. With the Admin API, an engineer sends one request to the control plane and every data plane picks up the new license. With files or environment variables, the team would have to touch 40 nodes.
Memory trick: API = Airmail. It is the only method that delivers to every data plane by itself.
Method 2: Deploy a license with license.json
Kong looks for /etc/kong/license.json by default.
- Save your license to a file named
license.json. - Copy the file to
/etc/kong. - Restart the Kong Gateway nodes by running
kong restartfrom within the container.
Watch out for quotes. The file must be valid JSON with straight quotes (' and "), not curly quotes (’ or “). Copying a license from a chat tool, email or word processor can silently convert them and cause errors.
Important: in a self-managed deployment, the control plane does not propagate this license to data planes. You must add the file to each data plane node, and each node must start with the license. It cannot be added after the node has started.
Real-world example: You scale from 3 to 5 data plane nodes before a big sale. If your new node image does not include license.json, the new nodes will not come up properly. Bake the file or secret into your image or deployment template.
Memory trick: File = Foot delivery. You walk it to every node yourself.
Method 3: Deploy a license with an environment variable
You can supply the license as KONG_LICENSE_DATA (the license contents) or KONG_LICENSE_PATH (a path to a license file in a non-default location).
- Export the license in the shell that will run Kong:
export KONG_LICENSE_DATA='$YOUR_LICENSE_DATA'
- Reference the variable as part of your Kong Gateway deployment.
Three rules to remember:
- Unlike other
KONG_*variables, license variables cannot be defined inline withkongCLI commands. Export them to the shell where the Nginx process runs before using thekongCLI. - The control plane does not propagate them to data planes. Set them on each node.
- The license can’t be added after the node has started.
Real-world example: A platform team uses a Docker Compose file. They put KONG_LICENSE_DATA in the service environment section, sourced from a secrets manager. Running KONG_LICENSE_DATA=... kong start inline would not work, so they export it first.
Memory trick: Export, then Execute. Export the variable first, then run the kong command.
The golden rule: who delivers the license?
| Method | Reaches data planes automatically? |
|---|---|
| Admin API | Yes |
| license.json | No, copy to every node |
| KONG_LICENSE_DATA / KONG_LICENSE_PATH | No, set on every node |
Memory trick: Only API Airmails. Everything else is hand delivery.
License expiration: what happens and when
Licenses expire at midnight on the expiration date, in the time zone of your control plane.
Warnings you will see
- Kong Manager: a warning 15 days before expiry.
- Kong Gateway logs: alerts 90 days and 30 days before expiry, plus on and after the expiration date.
Memory trick: 90, 30, 15. Logs shout at 90 and 30. Kong Manager nudges at 15. Think of a monthly bill reminder: three months, one month, two weeks.
What happens after expiry
| Area | Behavior |
|---|---|
| Entity configuration | Becomes read-only |
| Kong Manager and Konnect | Still accessible |
| Proxy traffic | Keeps flowing with the existing configuration |
| Restart and scale (traditional mode) | Still possible |
| New nodes and restarts (DB-less and KIC) | Break: new nodes can’t come up |
Memory trick: Look, don’t touch, but traffic still flows. The gateway becomes a museum exhibit: you can view it, but you cannot change it. DB-less and KIC are the strictest: no new nodes, and restarts break.
Real-world example: A retail team’s license expires at midnight on a Saturday. Customer traffic continues, so the shop stays online. On Monday an engineer tries to add a new route for a promotion and it fails because configuration is read-only. A DB-less cluster that autoscales that night could not start new pods, which is much riskier. Renew early.
How to renew
Update your license with a PUT request to the /licenses/{license-id} Admin API endpoint. If you use files or environment variables, replace them on each node and restart.
Renewal checklist:
- Put the expiry date in your team calendar at least 90 days ahead.
- Request the new license from Kong before the 30-day mark.
- Deploy using the same method as before.
- Confirm in Kong Manager that the warning is gone.
License reports
A license report summarizes your license usage and deployment. Key facts:
- Generated manually, on demand with the Admin API. No automatic or scheduled generation.
- Does not send data to Kong servers.
- You can share it with Kong Support for a health-check of product usage and deployment performance, so your organization is on the best license and deployment plan.
curl http://localhost:8001/license/report
What is in the report?
| Field | What it tells you |
|---|---|
checksum | SHA-256 digest of the full report |
timestamp | Unix time the report was generated |
kong_version | Kong Gateway version on this node |
db_version | Database engine and version |
license | license_key and license_expiration_date |
deployment_info | Topology: traditional, hybrid or dbless |
system_info | hostname, cores and uname |
services_count | Number of Services |
routes_count | Number of Routes |
consumers_count | Number of Consumers |
workspaces_count | Number of Workspaces |
rbac_users | Number of RBAC users |
plugins_count | Plugins by tier: free, enterprise, custom |
counters | total_requests and a buckets array |
Memory trick: Who, What, How big.
- Who:
license,kong_version,db_version - What:
deployment_info,system_info - How big: services, routes, consumers, workspaces, RBAC users, plugins, counters
Package a report for Kong Support
curl http://localhost:8001/license/report -o response.json && tar -cf report-$(date +"%Y_%m_%d_%I_%M_%p").tar response.json
This saves response.json and creates a timestamped .tar archive ready to share.
Common license errors and how to fix them
| Error | Meaning | Fix |
|---|---|---|
license path environment variable not set | KONG_LICENSE_DATA or KONG_LICENSE_PATH is not defined, and no file exists at /etc/kong/license.json. | Set a variable or place the file in the default location. |
error opening license file | The file could not be opened. | Check that the user running Nginx (for example, the Kong CLI user) can read the file. |
error reading license file | The file opened but could not be read. | Check the file is not corrupt and there are no kernel errors such as out-of-memory. |
could not decode license json | The data is not valid JSON. | Confirm the file is unaltered. Re-download and reinstall. Contact Kong support if it persists. |
invalid license format | One or more key/value pairs are missing. | Re-download and reinstall. Contact support if it persists. |
validation failed | The payload does not match the signature. | Make sure the file is untouched. Re-download and reinstall. |
license expired | System time is past license_expiration_date. | Contact Kong support for a new license. |
invalid license expiration date | The date field is badly formatted. | Re-download and reinstall. |
Memory trick: Find, Open, Read, Decode, Format, Validate, Expire. Kong’s error names follow the journey of a license file: find it, open it, read it, decode it, check its format, validate its signature, check its date. The step that fails tells you where to look.
Quick troubleshooting flow:
- Cannot find or open? Check the path, variable and file permissions.
- Cannot decode, format or validate? The file was probably edited, truncated, or had its quotes changed. Re-download it from Kong.
- Expired? Check the date in the license and your system clock, then request a new one.
Frequently asked questions
How do I make sure the license reaches data plane nodes in hybrid mode?
Deploy it with the /licenses Admin API endpoint. The control plane then applies it to its data planes automatically. If you use a file or environment variable instead, each control plane and data plane node needs its own copy at startup.
What happens in traditional mode when there are no separate control planes?
You must manually deploy the license file to each node running Kong Gateway.
Can I add a license after a node has started?
Not with a file or environment variable. The node must start with the license. The Admin API method is the way to apply or update a license on a running cluster.
Does the license report send my data to Kong?
No. It is generated locally, on demand, and you decide whether to share it with Kong Support.
What happens to my traffic if the license expires?
Proxy traffic continues with the existing configuration. Configuration becomes read-only, and in DB-less mode and Kong Ingress Controller, new nodes cannot start.
One-page cheat sheet
| Topic | Remember |
|---|---|
| Load order | Data, Default, Path, API (Dogs Dig Pretty Amazing holes) |
| Startup only | Passport checked at the gate |
| Only API Airmails | The Admin API is the only method that reaches data planes automatically |
| DB-less gap | Admin API not supported |
| Env vars | Export first, then run kong |
| Quotes | Straight quotes only |
| Expiry warnings | 90, 30, 15 |
| After expiry | Look, don’t touch; traffic still flows |
| Report | Manual, on demand, nothing sent to Kong |
| Errors | Find, Open, Read, Decode, Format, Validate, Expire |
Best practices
- Pick one primary method and document it so everyone knows the source of truth. Mixed methods make the load order matter in surprising ways.
- Automate injection of the license into your images, secrets or deployment templates so new nodes never start without it.
- Renew early. Start the renewal process at least 30 days before expiry.
- Generate a license report before renewal or support calls to give Kong a clear view of your deployment.
- Avoid copy-paste problems: use a plain-text editor so quotes stay straight.
Related resources
- Kong Gateway deployment topologies
- Admin API: create licenses
- Admin API: update a license
- Admin API: license report
- Kong Ingress Controller license
- Reserved entity names