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?
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.
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.
Totally understand the problem. You should move to the CRD based configuration iteratively.
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.
@IvanLi you can use the
kong config db_export CLI command (available since Kong 1.3)
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.