I have a feeling this has been asked before, maybe...
# k3s
q
I have a feeling this has been asked before, maybe even by me (😅), but I can't find any results when searching. I have a homelab with k3s, using an external postgres database as datastore. Since last evening (~14 hours or so), k3s has made ~35000 DNS queries to get the IP for the postgres server, which seems excessive. Is this some kind of misconfiguration on my system, or is this normal? (Or is it some kind of bug?).
c
There is no caching built in to the golang dns resolver. If you use a hostname in an address, it will look it up every time it needs to connect to it.
Use the ip instead, or use a local cache on your node (nscd, systemd-resolved, or the like).
q
Still, doesn't that imply that the server creates a new connection 35000 times over 14 hours? That means every connection has a lifetime of between 1 and 2 seconds, which seems awfully wasteful?
c
it is up to the postgres sql driver to pool connections. but yes that does suggest it is opening and closing connections frequently.
q
I see there is already an issue for it, open since 2020 🙁 : https://github.com/k3s-io/kine/issues/63