External-dns test DNS server rechability

I am looking for a way to add liveness test to external-dns pods to test DNS reachability. We use RFC2136 provider for local Active Directory DNS server using TSIG key.

We usually see this error on pod logs when DNS is not reachable “failed to fetch records via AXFR: dial tcp x.x.x.x : i/o timeout”

I am thinking in two ways :

  • Be able to grep pod STDOUT on the fly for this error pattern. Not sure how to do it ?
  • Run command like “host ntp.companydomain.com x.x.x.x > /dev/null 2>&1 | echo $?” and restart on non-zero output .

Appreciate any feedback


Cluster information:

Kubernetes version: 1.19.9
Cloud being used: Rancher running on bare-metal
Host OS: Ubuntu 18