Kong in dbless mode + Kong Ingress controller

Hi,
We are planning to use Kong in DB-less mode along with the Kong ingress controller. In this case, do you still need to run “Kong migrations up” and “Kong migrations finished” command. I didn’t find any specific documentation on DB-less mode but since there is no data store associated, I am assuming we don’t need to run these commands. Please let me know if that’s not true!

Thanks,
Srinivas

You don’t need to run any migrations with DB-less.

@hbagdi, thank you so much for the quick confirmation!

@hbagdi, in dbless mode, can you let me know where the kong runtime objects like consumers, enabled plugins info is stored? I am following up with a new question so that anyone looking for kong dbless mode and ingress controller information can see all this information at one place. Hope it’s ok!

The configuration is all stored in k8s data-store i.e. etcd.
In Kong, it is stored in-memory (not persisted to disk anywhere).

@hbagdi, Thank you so much for the quick response. If it is stored in memory, what is the best way to handle kong reload? Earlier, we had been using kong with Cassandra db (without ingress controller) and now we are moving to Kong ingress controller + db less mode. We also use custom nginx templates.

So our kong reload has been using the following command:

kong reload --conf /etc/kong/kong.conf --nginx-conf /etc/kong/kong_nginx.conf --vv

When I run reload on dbless, the routes are being lost as it complains with error

{
“message”: “no Route matched with those values”
}

This issue is not seen when I restart kong though!

Also, we had been writing custom plugins and also extended admin api (implemented api.lua), will this still work with this dbless config + kong ingress controller deployment?

Any pointers to how this can be resolved will be very helpful.

Thanks,
Srinivas

You cannot do reloads with this deployment model. Update your deployment to roll your kong pods and gracefully restart kong in this case.

The controller can support some custom entities if you would like that.
Please read: https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/guides/configuring-custom-entities.md

@hbagdi, Thank you once again for the quick response. I really appreciate your turn around time!

@hbagdi, When my custom plugins are invoked, I am getting an uninitialized exception unless I add the following lines to the kong’s code:

File: /usr/local/share/lua/5.1/kong/init.lua

function Kong.access()

local ctx = ngx.ctx
– Srini Added
if not ctx.KONG_PROCESSING_START then
ctx.KONG_PROCESSING_START = ngx.req.start_time() * 1000
end
– End here

function Kong.balancer()
– This may be called multiple times, and no yielding here!
local now_ms = get_now_ms()

local ctx = ngx.ctx
– Srini Added
if not ctx.KONG_PROCESSING_START then
ctx.KONG_PROCESSING_START = ngx.req.start_time() * 1000
end
– End here

Am I missing something here?

Please let me know.

Thanks,
Srinivas

@hbagdi, I went over the link provided for using custom entities. This seems to be specific to custom plugins but how can I handle the ssl certs reload that are configured in kong.conf and nginx.conf files?

Also, would you always need to create a consumer, if the access management to a route/service is being handled by our proprietary module? In other words, when would you use a kong consumer? The kong documentation just mentions the following about consumer object:

Consumers are associated to individuals using your API, and can be used for tracking, access management, and more.

Please let me know.

Thanks,
Srinivas


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ