Declarative config with a database

Is it possible to use declarative config with a database?

The use case is to preserve the advantages of database mode but be able to use declarative config rather than scripting imperative calls to admin api.

If it is possible, how to generate the initial kong.yml? It’s possible to generate a template declarative configuration yml file with kong config init but if you already have your config in a database, is there a way to generate the yml file from your database?


Hi @benjaminmwilson,

Welcome to Kong Nation!

This is currently not supported natively in Kong but is something on our radar.

Meanwhile, you can use decK (disclaimer: I’m the author) to export, import and sync your Kong’s configuration using a YAML file.


Hi @hbagdi,

Very interested in trying out decK, at the same time a bit apprehensive.
I did adopt Kongfig (I loved it) only to realise that its not supported in the latest versions.

Any information about your commitment to support decK long term would be great.

Would have been ideal for Kong declarative config to be supported in DB mode.
At least that way we know it will be supported for sure.

I am planning to integrate decK with my devops scripts (each Service/Consumer will be one YAML definition)
Does decK understand that a certain service or route already exists and so it should PATCH and not PUT?


FWIW, decK and Kongfig are nearly completely compatible so the migrations should be simple.
decK is used in the core of Kong Ingress Controller, which might give you some more confidence in the product.

This is supported already with Kong with kong config db_import CLI command.
You can configure Kong’s DB from a YAML file using the above command.

How do we generate yaml file in the first place?

You use decK, point it to your existing Kong cluster and do an export to generate the YAML file.

so file created from deck can be used by kong config db_import CLI command.

how do we use deck to import a new configuration into kong. I didnt see any import command. I want to preserve the existing configuration that has been done in kong and only import new configuration coming via kong…yaml file. please let me know how to do that

Answered here: How to import configuration into kong cluster using deck