I'm running PowerDNS recursor inside my k8s cluster. My python script is on a different pod that is doing rdns to my powerdns rescursor app. I have my hpa Max replica set to 8. However, I do not think the load is the problem here. I'm unsure what to do to resolve this timeout error that I'm getting below. I can increase the replicas to solve the problem temporarily, and then it would happen again.
[ipmetadata][MainThread][source.py][144][WARNING]: dns_error code=12, message=Timeout while contacting DNS servers
It seems like my pods are rejecting incoming traffic therefore it's outputting the dns_error code=12.
Here is part of my script that's running the rdns
return_value = {
'rdns': None
}
try:
async for attempt in AsyncRetrying(stop=stop_after_attempt(3)):
with attempt:
try:
if ip:
result = await self._resolver.query(ip_address(ip).reverse_pointer, 'PTR')
return_value['rdns'] = result.name
return return_value
except DNSError as dns_error:
# 1 = DNS server returned answer with no data
# 4 = Domain name not found
# (seems to just be a failure of rdns lookup no sense in retrying)
# 11 = Could not contact DNS servers
if int(dns_error.args[0]) in [1, 4, 11]:
return return_value
LOG.warning('dns_error code=%d, message=%s, ip=%s', dns_error.args[0], dns_error.args[1], ip)
raise
except RetryError as retry_ex:
inner_exception = retry_ex.last_attempt.exception()
if isinstance(inner_exception, DNSError):
# 12 = Timeout while contacting DNS servers
LOG.error('dns_error code=%d, message=%s, ip=%s', inner_exception.args[0], inner_exception.args[1], ip)
else:
LOG.exception('rnds lookup failed')
return return_value
The error code 12 indicates that the PowerDNS recursor did not receive a response from any of the authoritative servers for the queried domain within the configured timeout. This could be due to network issues, firewall rules, rate limiting, or misconfiguration of the recursor or the authoritative servers.
Possible solutions
There are a few things you can try to resolve this timeout error:
ping,traceroute, ordigto diagnose network problems.iptables,nftables, orufwto manage firewall rules.pdnsutilorpdns_controlto configure rate limiting on PowerDNS recursor and authoritative servers.pdnsutilorpdns_controlto manage PowerDNS configuration files and settings.Examples
Here are some examples of how to use the tools mentioned above to troubleshoot the timeout error:
This will send four ICMP packets to the recursor pod and print the output. You should see something like this:
This indicates that the network connectivity and latency between the python pod and the recursor pod are good.
This will trace the route taken by packets from the recursor pod to the authoritative server at 8.8.8.8 (Google DNS). You should see something like this:
This indicates that the route to the authoritative server is clear and there are no firewall blocks or network issues.
This will send a DNS query for the domain name example.com to the recursor pod and print the response. You should see something like this:
This indicates that the recursor pod received a valid response from the authoritative server for the domain name example.com.
This will print all the configuration settings of the recursor pod. You should look for the following settings:
These settings control the maximum number of cache entries, TCP clients, UDP queries, and recursion depth that the recursor pod can handle. You can adjust them according to your needs and resources. You can use the following command to set a new value for a setting:
This will set the maximum number of UDP queries per second to 20000.
This will send a DNS query for the version of the authoritative server at 8.8.8.8. You should see something like this:
This indicates that the authoritative server is running Google Public DNS, which is a well-known and reliable DNS service. You can check the documentation of Google Public DNS for more information on its configuration and features. You can also use the following command to check the DNSSEC status of the authoritative server:
This will send a DNS query for the identity of the authoritative server at 8.8.8.8. You should see something like this:
This indicates that the authoritative server supports EDNS0, which is an extension of the DNS protocol that enables DNSSEC and other features. You can check the documentation of EDNS0 for more information on its functionality and benefits.