Migrate from Kong Gateway DB-less format to decK state file format

Uses: deck
Related Documentation
Related Resources

decK uses its own state file format, which differs from the declarative configuration format built into Kong Gateway for DB-less mode. Both formats use YAML and share some metadata fields, but they represent certain entities differently and aren’t directly compatible. This page explains the differences between the two formats and what to consider when migrating from DB-less config to decK.

When to use each format

The following table summarizes when to use each format:

Format

Use case

DB-less Backup and restore, or configuring Kong Gateway in DB-less mode. Export with kong config db_export and import with kong config db_import.

If you’re using Kong Gateway in DB-less mode, you can’t use decK for sync, dump, or similar operations because they require write access to the Admin API.
decK Human-authored, version-controlled Kong Gateway configuration for a database-backed deployment. Designed for manual editing and GitOps workflows.

If you’re running Kong Gateway with a database in traditional or in hybrid mode, decK is the better choice for managing entity configuration.

Why use decK?

decK has several advantages over the kong config db_import and db_export commands:

  • decK applies changes through the Admin API, so all nodes receive updates automatically.
  • In addition to creating and updating entities, decK can also delete entities that exist in the database but are absent from your config file.
  • decK uses the Admin API, so it works in production networking environments where a direct database connection isn’t available.
  • decK can compare the configuration in Kong Gateway’s database against your config file and report differences. This is useful for CI pipelines or scheduled drift checks.
  • deck gateway dump produces a more human-readable file than db_export.

Note: Before migrating to decK, consider the following limitations:

  • For very large installations, decK sync can be slow. Mitigate this with distributed configuration and the --parallelism flag. db_import is typically faster by orders of magnitude.
  • decK can’t correctly export and re-import fields that are hashed in the database. For example, the password of a basic-auth credential will be rehashed during sync, corrupting the value.

Metadata fields

Both formats use metadata fields prefixed with an underscore (_). Support for each field varies by format and target environment:

Field decK (on-prem) decK (Konnect) DB-less Description
_format_version Supported Supported Supported The format version of the file.
_transform Supported Supported Supported Whether field transforms should be applied when loading the file.
_comment Not supported Not supported Supported A string field for storing opaque data. Kong ignores this field. Can appear on any entity, including the root object.
_ignore Not supported Not supported Supported An array field for storing opaque data. Kong ignores this field. Can appear on any entity, including the root object.
_workspace Supported Not supported Not supported Specifies the target workspace in a decK file.
_info Supported Supported Not supported An object containing file-level metadata.
_info.select_tags Supported Supported Not supported An array of tags used to filter which entities decK syncs or diffs.
_info.defaults Supported Supported Not supported Default values applied to entities during sync.
_konnect Not supported Supported Not supported An object containing Konnect-specific file-level metadata.
_konnect.control_plane_name Not supported Supported Not supported The name of the control plane to target.

Note: Neither format includes a field to identify itself as a decK or DB-less file. You can’t reliably detect the file type from its contents alone.

Entity representation differences

The formats represent some entities differently, making them explicitly incompatible in certain areas. Use deck file format to convert between the two.

For example, to convert a DB-less file to decK format:

deck file format deck dbless.yaml

Or, convert a decK file to DB-less format:

deck file format dbless deck.yaml

Consumer Group plugins

In decK format, Consumer Group plugins are nested under each Consumer Group entry. In DB-less format, they are stored in a top-level consumer_group_plugins array where each entry references its Consumer Group by name.

decK requires the Consumer Group to be defined in the same file, because the plugin is nested inside the group entry. In DB-less format, consumer_group_plugins entries can exist independently.

decK

DB-less

consumer_groups[*].plugins consumer_group_plugins

To convert Consumer Groups from DB-less format to decK:

  1. Rename consumer_groups[*].consumer_group_plugins to consumer_groups[*].plugins (merge if the key already exists).
  2. Iterate over consumer_group_plugins.
  3. For each entry, find the matching Consumer Group entry.
  4. Append the plugin entry to the plugins array in that Consumer Group (create the array if it doesn’t exist).

Consumer Group membership

In decK format, Consumer Group membership is nested under each Consumer entry as an array of objects with a single name key. In DB-less format, memberships are stored in a top-level consumer_group_consumers array where each entry references both a Consumer and a Consumer Group.

decK requires the Consumer to be defined in the same file, because membership is nested inside the Consumer entry.

decK

DB-less

consumers[*].groups consumer_group_consumers

To convert Consumers and their Consumer Groups from DB-less to decK:

  1. Iterate over consumer_group_consumers.
  2. For each entry, find the matching Consumer entry.
  3. Create a groups array in the Consumer object if it doesn’t exist.
  4. Insert a new object with a single key name and the value set to consumer_group_consumer.consumer_group.
  5. Add appropriate tags as needed.

Plugin partials

In decK format, plugin Partial links are nested under each plugin entry as an array of objects with name, id, and optional path keys. In DB-less format, they are stored in a top-level plugins_partials array where each entry references both a plugin and a Partial.

decK

DB-less

plugins[*].partials plugins_partials

To convert Partials from DB-less to decK:

  1. Iterate over plugins_partials.
  2. For each entry, find the matching plugin entry.
  3. Create a partials array in the plugin object if it doesn’t exist.
  4. Insert a new object with name or id set to the Partial reference, and include path if specified. If no path is provided, Kong Gateway uses the default path from the Partial’s schema.

Sample config comparison

The following examples show the same Kong Gateway entity configuration expressed in each format.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!