From 055e393e12c326ec9fdd99dce0340fb2c3993e44 Mon Sep 17 00:00:00 2001 From: surajnarwade Date: Tue, 22 Aug 2023 15:15:33 +0100 Subject: [PATCH] fix upstream dns url fix --- Dockerfile | 2 +- config/local-dns-resolver-config.json | 2 +- config/plugin/upstream_dns_resolver.sh | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1ae850d..f7969fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.k8s.io/node-problem-detector/node-problem-detector:v0.8.12 +FROM registry.k8s.io/node-problem-detector/node-problem-detector:v0.8.13 RUN set -eux; \ apt-get update; \ diff --git a/config/local-dns-resolver-config.json b/config/local-dns-resolver-config.json index 9dfdbff..468c378 100644 --- a/config/local-dns-resolver-config.json +++ b/config/local-dns-resolver-config.json @@ -21,7 +21,7 @@ "reason": "NodeLocalDnsResolutionFailing", "path": "./config/plugin/local_dns_resolver.sh", "args": [ - "169.254.20.10" + "kube-dns-upstream.kube-system.svc.cluster.local." ] } ] diff --git a/config/plugin/upstream_dns_resolver.sh b/config/plugin/upstream_dns_resolver.sh index 301df32..1cd1fdd 100755 --- a/config/plugin/upstream_dns_resolver.sh +++ b/config/plugin/upstream_dns_resolver.sh @@ -6,9 +6,11 @@ UNKNOWN=2 readonly fqdn_a_record="$1" + + # We send a single attempt only, without retries and with 1s timeout. # We expect to receive an IPv4 address for a given A record. -dig_cmd_out="$(dig -t A @169.254.20.10 +tries=1 +retry=0 +time=1 +short "${fqdn_a_record}" 2>&1 | head -n1)" +dig_cmd_out="$(dig -t A @${LOCAL_DNS_RESOLVER_IP} +tries=1 +retry=0 +time=1 +short "${fqdn_a_record}" 2>&1 | head -n1)" dig_cmd_return_code="$?" dig_cmd_out_ipv4ish="$(echo "${dig_cmd_out}" | grep -E -o "^([0-9]{1,3}[\.]){3}[0-9]{1,3}$")"