Hi, is there plan to add integration with Consul service discovery in terms of dynamically update upstream configs?
Consul has a DNS interface that you can use with Kong:
You would configure Kong’s Upstream to point to a service and then ensure that Kong uses Consul as it’s DNS server. With this, Kong can dynamically update the targets as the SRV records change in Consul.
Thanks for your reply!
Is Kong resolve the consul service IP address and port using SRV records or just A dns records?
Also, is Kong respect consul dns ttl 0?
However as I understood, if Kong respect the dns ttl which is 0 by default it means that Kong should perform dns query for each new session, which means a huge overhead and latency for a new session initializing.
dns_order, by default it will respect SRV record if one is present.
Correct. You should have a non-zero DNS TTL for performance reasons. This introduces a problem of a latency between an upstream node going down and Kong being informed that change (upon TTL expiration). To get around this problem, you should be using Active and Passive healthchecking in Kong, which can help Kong detect quickly that an upstream node died. New nodes will be added to Kong once the DNS TTL for that particular service expires.