# DBless and Kong Ingress Controller

**URL:** <https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [December 18, 2019, 5:34pm UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173 "2019-12-18T17:34:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fgsalomon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fgsalomon/32/2153_2.png) [@fgsalomon](https://discuss.konghq.com/u/fgsalomon)\
**Post date:** [December 18, 2019, 5:34pm UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173/1 "2019-12-18T17:34:47Z")

</div>

Hi all,

We’ve been using Kong 1.2 with a PostgreSQL database and the Kong Ingress Controller for a while now and it’s working great.  
However we want to upgrade it now (so we can get route metrics with Prometheus plugin) and looking at the docs it seems that DBless mode it’s the way to go.

Until now we’ve been creating the routes and services on Kubernetes through Kong CRDs and annotations while plugins, consumers, credentials were applied/created through Kong API.

I’d like to know which is the recommended way to configure Kong in DBless mode with Kong Ingress Controller:

- Using only declarative configuration with kong.yml
- Using only k8s CRDs
- Mixing declarative configuration with k8s CRDs (if possible)

I tried option 3 but it looks like the yaml config gets overridden with the k8s CRDs.

Then I tried option 1 but I don’t know how to reference my k8s services.  
Could you provide an example hello world of declarative configuration when using Kong Ingress Controller?

Thank you.

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 18, 2019, 10:08pm UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173/2 "2019-12-18T22:08:23Z")

</div>

Currently, with DB-less mode, you will need to declare all of your configuration as CRDs. It is not possible to mix declarative configuration with CRDs. This might change in future.

---

<div class="post-metadata">

**Author:** ![fgsalomon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fgsalomon/32/2153_2.png) [@fgsalomon](https://discuss.konghq.com/u/fgsalomon)\
**Post date:** [December 20, 2019, 1:56pm UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173/3 "2019-12-20T13:56:50Z")

</div>

Thank you hbagdi!  
We’ll try using just the declarative configuration. However, after exporting our current database to a yaml file I have to say that I find a bit intimidating having to work with a ~5k lines conf file.

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 20, 2019, 5:23pm UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173/4 "2019-12-20T17:23:15Z")

</div>

Totally understand the problem. You should move to the CRD based configuration iteratively.

---

<div class="post-metadata">

**Author:** ![IvanLi](https://avatars.discourse-cdn.com/v4/letter/i/c2a13f/32.png) [@IvanLi](https://discuss.konghq.com/u/IvanLi)\
**Post date:** [December 31, 2019, 4:03am UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173/5 "2019-12-31T04:03:09Z")

</div>

Hi, @fgsalomon, how do you export your current database to a yaml file? I’m having similar issues, our route/ services are created by yaml files, but consumers/credentials are created via admin api and stored in a postgreSQL , we want also want to evaluate if we could move to dbless mode as well.

---

<div class="post-metadata">

**Author:** ![fgsalomon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fgsalomon/32/2153_2.png) [@fgsalomon](https://discuss.konghq.com/u/fgsalomon)\
**Post date:** [January 4, 2020, 5:28pm UTC](https://discuss.konghq.com/t/dbless-and-kong-ingress-controller/5173/6 "2020-01-04T17:28:34Z")

</div>

@IvanLi you can use the `kong config db_export ` CLI command (available since [Kong 1.3](https://github.com/Kong/kong/blob/master/CHANGELOG.md#cli-1))  
In my case I’m using Kong 1.2 so I had to do it in a convoluted way (using the CLI command on a Docker image with a newer version of Kong connected to a backup database) because I didn’t want to mess with my production environment.
