Troubleshoot DNS resolution errors
Diagnose and fix DNS failures in ACK clusters caused by CoreDNS, network, policy, or kernel issues.
Usage notes
DNS troubleshooting is complex in Kubernetes because the network architecture has multiple layers and is dynamic. In addition to errors of the CoreDNS and NodeLocal DNSCache add-ons, the following causes can lead to DNS resolution failures.
DNS best practices provides DNS configuration recommendations for different scenarios. These recommendations help you configure DNS more appropriately and reduce the chance of encountering DNS issues.
Multiple layers in the network architecture
The DNS resolution chain involves multiple modules, including CoreDNS/kube-dns, kube-proxy, and CNI plug-ins. A failure in any layer can cause the problem, so you must check the modules layer by layer to locate the source. For the complete troubleshooting chain, see Other modules in the DNS resolution chain.
Service discovery and namespace behaviour
FQDN dependency: cross-namespace access requires the fully qualified domain name, such as
service.namespace.svc.cluster.local. If the domain name does not specify the namespace, DNS searches only the current namespace, so cross-namespace access fails without an explicit error.Headless Services: a headless Service returns pod IPs directly. If it is misconfigured, DNS records become incomplete or missing.
Network policy restrictions
Silent blocking: if the pod NetworkPolicy does not allow the DNS port (53/UDP and TCP by default), the pod cannot communicate with CoreDNS.
VPC security group interference: host firewalls or security group rules may drop DNS traffic, especially VPC security group configurations.
Troubleshooting: check the network connectivity of the CoreDNS pod in the
kube-systemnamespace to verify that the policies allow the traffic.
Limited debugging tools and logs
Missing tools: container images do not include
digornslookupby default. Install the tools or use a temporary debug container.Distributed logs: CoreDNS query logs require the log plug-in to be enabled, and the logs are spread across multiple CoreDNS replicas.
Debugging technique: run a quick DNS test from a temporary pod:
kubectl run -it --rm debug --image=nicolaka/netshoot -- digOr use:
nslookup <target-domain-name>
How DNS resolution works
When an application pod sends a DNS query, it follows this path:
-
The pod sends a DNS query to the address in
/etc/resolv.conf, which is typically the kube-dns Service IP. -
kube-dns forwards the query to a CoreDNS pod in the
kube-systemnamespace. -
For internal domain names ending with
.cluster.local, CoreDNS resolves from its cache without contacting upstream servers. -
For external domain names, CoreDNS forwards the query to the upstream DNS servers specified in its configuration. The default upstream servers are
100.100.2.136and100.100.2.138, both deployed in the virtual private cloud (VPC).
With NodeLocal DNSCache, queries go to the local cache (169.254.20.10) first and fall back to kube-dns only if unresolved.
Key concepts
|
Term |
Description |
|
Internal domain name |
Domain ending with |
|
External domain name |
Domain not ending with |
|
Application pod |
Any non-system-component pod. |
|
kube-dns Service |
Kubernetes Service that routes DNS traffic to CoreDNS pods. Its IP is the default nameserver for application pods. |
|
NodeLocal DNSCache |
DaemonSet running a local DNS cache on each node. When enabled, pods query the local cache ( |
|
Upstream DNS server |
DNS server CoreDNS contacts for external domains. Defaults to |
Other modules in the DNS resolution chain
In addition to CoreDNS and NodeLocal DNSCache, the following modules in the DNS resolution chain can cause DNS resolution errors. Investigate them when the CoreDNS and NodeLocal DNSCache checks do not locate the problem.
DNS Resolver: DNS resolver implementations in languages such as Go and in libraries such as glibc and musl may contain defects that cause DNS resolution failures in rare cases.
/etc/resolv.conf: the DNS configuration file in the container. It contains the IP address of the DNS server and the DNS search domains. A misconfiguration of this file causes DNS resolution failures.kube-proxy: kube-proxy forwards requests by using IP Virtual Server (IPVS) or Iptables. If kube-proxy does not update its rules after a CoreDNS configuration change, CoreDNS cannot be reached and DNS resolution fails intermittently.
Upstream DNS servers: CoreDNS resolves only cluster domain names. For domain names that do not match
clusterDomain, CoreDNS queries a higher-level DNS server, such as VPC internal DNS. If the upstream DNS server is misconfigured, pods fail to resolve non-cluster domain names.
Troubleshooting approaches
Select a troubleshooting approach based on the type of domain name that fails to resolve and the frequency of the failures, then check the issues and solutions listed for that approach.
Troubleshooting approach | Troubleshooting basis | Issues and solutions |
By the type of domain name that fails to resolve | Both internal and external domain names fail | |
Only external domain names fail | ||
Only PrivateZone and vpc-proxy domain names fail | ||
Only headless Service domain names fail | ||
By the frequency of the failures | Resolution does not work at all | |
Failures occur only during peak hours | ||
Failures occur very frequently | ||
Failures occur very rarely | ||
Failures occur only during node scaling or CoreDNS scale-in |
Step 1: Identify your error message
Match your error message to determine the likely failure category.
|
Client |
Error message |
Likely cause |
|
ping |
|
Domain does not exist, or DNS server unreachable. Latency greater than 5 seconds usually indicates that the DNS server is unreachable. |
|
curl |
|
Same as above. |
|
PHP HTTP client |
|
Same as above. |
|
Golang HTTP client |
|
Domain does not exist. |
|
dig |
|
Domain does not exist. |
|
Golang HTTP client |
|
DNS server unreachable. |
|
dig |
|
DNS server unreachable. |
-
Domain does not exist → Check whether the domain name itself is correct. If only external domains fail, see External domain name cannot be resolved.
-
DNS server unreachable → Proceed to Step 2.
Step 2: Check DNS policy and server address
Verify that the pod is using CoreDNS as its DNS server.
Retrieve the DNS policy and configuration:
# View the pod's DNS policy
kubectl get pod <pod-name> -o yaml
# Log in to the pod and inspect the DNS configuration
kubectl exec -it <pod-name> -- cat /etc/resolv.conf
Check the dnsPolicy field and the nameserver entries in /etc/resolv.conf.
The following examples show sample DNS policy configurations. Select the configuration that fits your scenario.
Example 1: DNS policy for the default scenario
apiVersion: v1
kind: Pod
metadata:
name: <pod-name>
namespace: <pod-namespace>
spec:
containers:
- image: <container-image>
name: <container-name>
dnsPolicy: ClusterFirst
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
Example 2: DNS policy when NodeLocal DNSCache is used
apiVersion: v1
kind: Pod
metadata:
name: <pod-name>
namespace: <pod-namespace>
spec:
containers:
- image: <container-image>
name: <container-name>
dnsPolicy: None
dnsConfig:
nameservers:
- 169.254.20.10
- 172.21.0.10
options:
- name: ndots
value: "3"
- name: timeout
value: "1"
- name: attempts
value: "2"
searches:
- default.svc.cluster.local
- svc.cluster.local
- cluster.local
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
|
|
Behavior |
|
|
Default. Pod uses the kube-dns Service IP as DNS server. For pods with hostNetwork enabled, ClusterFirst behaves the same as Default. |
|
|
Same as |
|
|
Pod inherits DNS settings from the Elastic Compute Service (ECS) node. Use only when the pod does not resolve cluster-internal names. |
|
|
DNS configured entirely through |
If the pod is not using CoreDNS (nameserver is not the kube-dns Service IP), the pod may be overloaded or the conntrack table may be full. See Client is overloaded and Conntrack table is full.
If the pod is using NodeLocal DNSCache (nameserver is 169.254.20.10), see NodeLocal DNSCache does not work and Alibaba Cloud DNS PrivateZone names cannot be resolved.
If the pod is using CoreDNS, continue to Step 3.
Step 3: Check CoreDNS pod health
Inspect the CoreDNS pods:
# View CoreDNS pod status and placement
kubectl -n kube-system get pod -o wide -l k8s-app=kube-dns
Expected output:
NAME READY STATUS RESTARTS AGE IP NODE
coredns-xxxxxxxxx-xxxxx 1/1 Running 0 25h 172.20.6.53 cn-hangzhou.192.168.0.198# View real-time CPU and memory usage
kubectl -n kube-system top pod -l k8s-app=kube-dns
Expected output:
NAME CPU(cores) MEMORY(bytes)
coredns-xxxxxxxxx-xxxxx 3m 18Mi
-
Pods not in Running state → Run
kubectl -n kube-system describe pod <CoreDNS-pod-name>to identify the cause. See CoreDNS pods do not run as normal. -
CPU or memory near the limit → See CoreDNS pods are overloaded.
-
CPU usage uneven across pods → See DNS queries are not evenly distributed.
Step 4: Check CoreDNS operational logs
kubectl -n kube-system logs -f --tail=500 --timestamps <coredns-pod-name>
|
Flag |
Description |
|
|
Stream the log output. |
|
|
Show the last 500 lines. |
|
|
Include timestamps in each log line. |
Look for error patterns that match known issues. For DNS query-level logs, first enable the CoreDNS log plugin. See Configure unmanaged CoreDNS.
With the log plugin enabled, each resolved query produces an entry like:
[INFO] 172.20.2.25:44525 - 36259 "A IN redis-master.default.svc.cluster.local. udp 56 false 512" NOERROR qr,aa,rd 110 0.000116946s
Common response codes:
|
Response code |
Meaning |
What to do |
|
|
Resolved successfully. |
No action needed. |
|
|
Domain does not exist on the upstream server. |
Check whether the domain name includes a search suffix that doesn't resolve. |
|
|
Upstream DNS server returned an error. |
Check CoreDNS connectivity to upstream servers. |
|
|
Upstream server rejected the query. |
Check the CoreDNS Corefile configuration and the node's |
DNS response codes are defined in RFC 1035.
Step 5: Reproduce the error and isolate the cause
If the error occurs consistently:
-
Check the DNS query log for error response codes. See External domain name cannot be resolved.
-
Test network connectivity between application pods and CoreDNS. See Test network connectivity between application pods and CoreDNS.
-
Check for container network connectivity errors. See Container network connectivity errors cause DNS failures.
If the error occurs intermittently:
Capture packets to collect evidence. See Capture packets.
Diagnostic methods
Test network connectivity between application pods and CoreDNS
Enter the application pod's network namespace using one of these methods:
-
Method 1 (recommended): Run
kubectl exec -it <pod-name> -- bashto enter the pod. -
Method 2: Log in to the node, find the process ID with
ps aux | grep <application-process-name>, then enter the network namespace withnsenter -t <pid> -n bash. -
Method 3 (for frequently restarting pods):
-
Log in to the node.
-
Run
docker ps -a | grep <application-container-name>to find sandboxed container IDs (names start withk8s_POD_). -
Run
docker inspect <sandboxed-container-ID> | grep netnsto find the network namespace path in/var/run/docker/netns/xxxx. -
Run
nsenter -n<netns-path> bashto enter the network namespace, where<netns-path>is the path obtained in the previous step.NoteDo not add a space between
-nand<netns-path>.
-
From the pod's network namespace, test connectivity:
# Test connectivity to the kube-dns Service
dig <domain> @<kube-dns-svc-ip>
# Test Internet Control Message Protocol (ICMP) connectivity to the CoreDNS pod
ping <coredns-pod-ip>
# Test DNS query directly to the CoreDNS pod
dig <domain> @<coredns-pod-ip>
Replace <kube-dns-svc-ip> with the kube-dns Service IP in the kube-system namespace, and <coredns-pod-ip> with the IP of a CoreDNS pod.
|
Symptom |
Likely cause |
Next step |
|
Cannot reach the kube-dns Service |
Node overloaded, kube-proxy down, or security group blocking User Datagram Protocol (UDP) port 53 |
|
|
Cannot reach the CoreDNS pod (ICMP) |
Container network error or security group blocking ICMP |
Check whether security group rules allow ICMP. |
|
Cannot reach the CoreDNS pod (DNS) |
Node overloaded or security group blocking UDP port 53 |
|
Test network connectivity of CoreDNS
You can check the network connectivity of the CoreDNS pod from the console or by using the CLI.
Console
Use the Network Diagnosis feature of the cluster to diagnose connectivity between the CoreDNS pod and an upstream DNS server.
Log in to the ACK console.
On the Clusters page, click the name of your cluster or click Details in the Actions column.
In the left-side navigation pane, choose Operations > Cluster Check.
On the Container Intelligence Service page, choose Cluster Check > Diagnosis.
On the Diagnosis page, click the Network Diagnosis tab.
Set Source Address to the IP of the CoreDNS pod, Destination Address to the upstream DNS server (by default
100.100.2.136or100.100.2.138), Destination Port to53, and Protocol toudp. Read the notes, select I Know and Agree, and then click Create Diagnosis.In the diagnosis list, click Diagnosis Details for your record.
The Diagnosis Result section shows the network diagnosis result, and the All Possible Paths area shows the full access map of the diagnosed path.
CLI
-
Log in to the node where the CoreDNS pod runs.
-
Run
ps aux | grep corednsto get the CoreDNS process ID. -
Run
nsenter -t <pid> -n bashto enter the CoreDNS network namespace. -
Test connectivity:
# Test connectivity to the Kubernetes API server telnet <apiserver_clusterip> 6443 # apiserver_clusterip is the ClusterIP of the kubernetes Service in the default namespace. # Test connectivity to upstream DNS servers dig <domain> @100.100.2.136 dig <domain> @100.100.2.138
|
Symptom |
Likely cause |
Next step |
|
Cannot reach the Kubernetes API server |
API server error, node overloaded, or kube-proxy down |
|
|
Cannot reach upstream DNS servers |
Node overloaded, CoreDNS misconfigured, or Express Connect routing error |
|
Diagnose the container network
-
Log in to the ACK console.
-
On the Clusters page, click the name of your cluster or click Details in the Actions column.
-
In the left-side navigation pane, choose Operations > Cluster Check.
-
On the Container Intelligence Service page, choose Cluster Check > Diagnosis.
-
On the Diagnosis page, click the Network Diagnosis tab.
-
Set Source Address to the application pod IP, Destination Address to the kube-dns Service IP, Destination Port to
53, and Protocol toudp. Select Enable Packet Tracing and I Know and Agree, then click Create Diagnosis. -
In the diagnosis list, click Diagnosis Details for your record.
The results show Diagnosis Result, Packet Paths, and All possible paths, along with identified error causes. See Use cluster diagnostics.
For example, the diagnosis result contains one FATAL record for node cn-hangzhou.172.xx.0.240: the route is invalid, invalid route "0.0.0.0/0 dev eth1 via 172.16.3.253 scope universe type unicast" for packet (src=172.16.1.45, dst=172.16.1.3), while the expected route is dev: calibb5fee8d7c0 scope: link type: unicast. The topology in the All possible paths area shows the access links from the nginx pod to two CoreDNS pods through the faulty node, which is highlighted in red.
Capture packets
Use packet capture when errors are intermittent and hard to reproduce.
-
Log in to the nodes where the application pods and the CoreDNS pod run.
-
Capture DNS traffic on each ECS instance:
tcpdump -i any port 53 -C 20 -W 200 -w /tmp/client_dns.pcapThis captures all traffic on port 53, rotating across up to 200 files of 20 MB each.
-
Reproduce the error and analyze packets from the failure time window. Check application logs for exact timestamps.
Packet capture has negligible service impact—only a slight increase in CPU utilization and disk I/O.
Known issues
Check for these environment-specific issues before deeper investigation.
|
Issue |
Affected environments |
Quick identification |
|
All (especially Alpine-based images and PHP apps) |
Intermittent failures; packet capture shows simultaneous A/AAAA queries on the same port |
|
|
kube-proxy in IP Virtual Server (IPVS) mode; CentOS or Alibaba Cloud Linux 2 with kernel earlier than |
Failures last approximately 5 minutes during node scaling or CoreDNS scaling |
|
|
High-traffic nodes |
|
|
|
Clusters using both NodeLocal DNSCache and DNS PrivateZone |
PrivateZone or |
|
|
Clusters creating containers at high frequency |
External names intermittently fail or resolve to wrong IPs; internal names usually resolve normally, except in clusters that create containers at high frequency, where internal service names may also resolve to wrong IPs |
FAQ
External domain name cannot be resolved
Symptom: pods resolve cluster-internal domain names correctly, but fail to resolve certain external domain names.
Check the CoreDNS query log for the response code. Enable the log plugin if not already on (see DNS policies and domain name resolution), then search for the failing domain. NXDOMAIN means the domain does not exist upstream—often because a search suffix was appended, creating an invalid FQDN. SERVFAIL or REFUSED means the upstream server has a problem; check CoreDNS configuration and connectivity to 100.100.2.136 and 100.100.2.138.
Newly added headless Service domain names cannot be resolved
Symptom: pods that query CoreDNS cannot resolve a headless Service domain name that was added recently.
In CoreDNS before 1.7.0, API server network jitter can cause CoreDNS to exit, stopping headless Service record updates. Update to 1.7.0 or later. See [Component Updates] Update CoreDNS.
Headless Service domain names cannot be resolved after CoreDNS is upgraded
Symptom: some components of earlier versions, such as etcd, nacos, and Kafka, do not work as expected in clusters of Kubernetes 1.20 or later that run CoreDNS 1.8.4 or later.
CoreDNS 1.8.4 and later prefer the EndpointSlice API to synchronize service IP information in the cluster. Some open-source components use the service.alpha.kubernetes.io/tolerate-unready-endpoints annotation provided by the Endpoint API during initialization to publish services that are not ready. This annotation is deprecated in the EndpointSlice API and replaced by publishNotReadyAddresses. As a result, after CoreDNS is upgraded, these components cannot publish services that are not ready and cannot perform service discovery.
Check whether the service.alpha.kubernetes.io/tolerate-unready-endpoints annotation exists in the YAML file or Helm chart of the component. If it exists, upgrade the component or consult the community of the component.
Headless Service domain names fail to be resolved when responses are too large
Symptom: pods that query CoreDNS cannot resolve headless Service domain names. The dig response contains the tc flag, which indicates that the response message is too large.
If a headless Service domain name has too many IP entries, a client that sends DNS queries over UDP may exceed the UDP DNS message size limit, which causes resolution failures.
To avoid resolution failures, switch the client to TCP for DNS queries. CoreDNS supports both TCP and UDP queries. Modify the client based on its resolver implementation:
glibc resolvers: add the
use-vcoption todnsConfigto use TCP for DNS queries. These settings are mapped to theoptionsconfiguration in/etc/resolv.conf. For more information about theoptionsconfiguration, see Linux manual pages.dnsConfig: options: - name: use-vcApplications written in Go: use TCP for DNS queries as shown in the following example.
package main import ( "fmt" "net" "context" ) func main() { resolver := &net.Resolver{ PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { return net.Dial("tcp", address) }, } addrs, err := resolver.LookupHost(context.TODO(), "example.com") if err != nil { fmt.Println("Error:", err) return } fmt.Println("Addresses:", addrs) }
Domain names of StatefulSet pods cannot be resolved
The StatefulSet pod template must set serviceName to the headless Service name. Without this, per-pod DNS names (for example, pod.headless-svc.ns.svc.cluster.local) cannot be resolved, even though the Service-level name (for example, headless-svc.ns.svc.cluster.local) works. Set serviceName in the StatefulSet spec.
DNS queries are blocked by security group rules or network ACLs
Security group rules or network access control lists (ACLs) are blocking UDP port 53, causing DNS failures on affected nodes. Allow inbound and outbound UDP port 53 traffic.
Container network connectivity errors cause DNS failures
Symptom: pods on some or all nodes fail to resolve domain names consistently.
Container network errors block UDP port 53. Use the Network Diagnosis feature to identify the broken path and root cause.
CoreDNS pods are overloaded
When query volume exceeds CoreDNS replica capacity, latency rises and failures occur. Check whether CPU and memory usage is near the limit (kubectl -n kube-system top pod -l k8s-app=kube-dns).
Two fixes:
-
Deploy NodeLocal DNSCache to absorb queries locally and reduce the load on CoreDNS. See Configure NodeLocal DNSCache.
-
Scale out CoreDNS replicas so that peak CPU utilization per pod stays well below the node's available CPU.
DNS queries are not evenly distributed among CoreDNS pods
Imbalanced pod scheduling or a sessionAffinity setting on kube-dns can cause uneven query distribution. Symptom: noticeably different CPU utilization across CoreDNS pods. Also check the replica count and placement: fewer than two CoreDNS replicas, or several replicas scheduled on the same node.
Two fixes:
-
Scale out CoreDNS pods and spread them across different nodes.
-
Remove the
sessionAffinitysetting from the kube-dns Service. See Configure the kube-dns Service.
CoreDNS pods do not run as normal
Misconfigured YAML or ConfigMap can prevent CoreDNS from starting or cause crashes. Symptoms: pods not Running, increasing restart count, or log errors.
Check the CoreDNS log for these common errors:
|
Error |
Cause |
Fix |
|
|
CoreDNS ConfigMap contains a plugin unsupported by the current version. |
Delete the unsupported plugin, such as |
|
|
API server connections were interrupted when the log was generated. |
If no DNS failures occurred, this is not the root cause. Otherwise, test CoreDNS connectivity. See Test network connectivity of CoreDNS. |
|
|
CoreDNS could not reach upstream DNS servers. |
Test connectivity from the CoreDNS pod to |
DNS resolutions fail because the client is overloaded
Symptom: DNS resolution fails during peak hours, or fails suddenly and intermittently. Monitoring data of the Elastic Compute Service (ECS) instance shows an abnormal network interface controller (NIC) retransmission rate and high CPU utilization.
When the ECS instance that hosts the application pods querying CoreDNS is fully loaded, UDP packets may drop before reaching CoreDNS.
Deploy NodeLocal DNSCache to reduce inter-node DNS traffic. See Configure NodeLocal DNSCache.
Conntrack table is full
When the conntrack table is full, new UDP and TCP connections drop. This typically causes peak-hour DNS failures that recover off-peak. To confirm, run dmesg -H on the affected node and look for conntrack full during the failure window.
Increase the maximum number of entries in the conntrack table. See How do I increase the maximum number of tracked connections in the conntrack table of the Linux kernel?
autopath plugin does not work as normal
A known autopath plugin defect causes occasional resolution failures or wrong IPs for external domains. Internal domains resolve correctly. The issue worsens in clusters with high container creation rates.
Disable the autopath plugin:
-
Edit the CoreDNS ConfigMap with
kubectl -n kube-system edit configmap coredns. -
Delete the
autopath @kubernetesline. Save and exit. -
Verify the configuration loaded by checking CoreDNS logs for
reload.
DNS resolutions fail due to concurrent A and AAAA record queries
Some Linux distributions send A and AAAA queries simultaneously over the same port, triggering conntrack conflicts that drop UDP packets.
Symptoms: intermittent resolution failures; packet capture shows simultaneous A and AAAA queries from the same source port.
On ARM instances, libc (glibc) versions earlier than 2.33 send A and AAAA requests concurrently in a way that causes request timeouts and retransmissions. See GLIBC#26600.
Fixes depend on your image base:
-
CentOS or Ubuntu: Add
options timeout:2 attempts:3 rotate single-request-reopento the DNS resolver configuration. CentOS or Ubuntu on ARM: Upgrade libc (glibc) to version 2.33 or later to avoid the concurrent A and AAAA resolution issue. See GLIBC#26600.
-
Alpine Linux: Replace the Alpine-based image with one based on another OS. See Alpine caveats.
-
PHP with cURL: Add
CURL_IPRESOLVE_V4to force IPv4-only resolution. See cURL functions. -
All environments: Deploy NodeLocal DNSCache, which mitigates the race condition. See Configure NodeLocal DNSCache.
DNS resolutions fail due to IPVS errors
In IP Virtual Server (IPVS) mode with CentOS or Alibaba Cloud Linux 2 (kernel before 4.19.91-25.1.al7.x86_64), DNS queries may reach a CoreDNS pod that no longer works as expected. The resulting intermittent DNS failures usually last approximately 5 minutes during node scaling or CoreDNS scaling events.
For example, when the node that hosts a CoreDNS pod is removed, the node resources are released immediately and the pod stops working. However, the cluster requires about 1 minute to detect the status update and mark the node as NotReady. Before the node status is updated, the pod is still considered healthy and keeps receiving DNS queries.
After the node is marked NotReady, the pod is removed from the CoreDNS Service backend and no longer accepts new connections. If kube-proxy runs in IPVS mode, IPVS UDP session persistence keeps sending some DNS requests to the pod until the UDP timeout expires, so the failures last longer.
Two fixes:
-
Deploy NodeLocal DNSCache to bypass the IPVS path for DNS queries. See Configure NodeLocal DNSCache.
-
Shorten the UDP session timeout in IPVS mode. See Change the UDP timeout period in IPVS mode.
NodeLocal DNSCache does not work
Symptom: no traffic enters NodeLocal DNSCache, and all DNS queries still reach CoreDNS.
DNS queries bypass NodeLocal DNSCache when either condition applies:
-
dnsConfigwas not injected into the application pods, so they still point to the kube-dns Service IP. -
Pods use an Alpine Linux base image, which queries all nameservers concurrently, including CoreDNS directly.
For the first case, enable automatic dnsConfig injection. See Configure NodeLocal DNSCache. For Alpine images, use an image built on another OS. See Alpine caveats.
Alibaba Cloud DNS PrivateZone names cannot be resolved
Alibaba Cloud DNS PrivateZone requires UDP, not TCP. With NodeLocal DNSCache, PrivateZone domains, vpc-proxy API endpoints, or other domain names may fail to resolve or resolve to wrong IPs.
Add prefer_udp to the CoreDNS configuration to force UDP for upstream queries. See Configure unmanaged CoreDNS.
DNS resolution failures caused by traffic bursts
Symptom: after network traffic increases sharply, some DNS requests fail to be resolved.
A traffic burst sharply increases the number of DNS requests. The high traffic that passes through CoreDNS may cause the CPU of CoreDNS to be throttled, which leads to resolution failures. Verify this cause in the following ways:
Run the following command on the node that hosts the CoreDNS pod to check for UDP packet loss:
nsenter -t <coredns-pid> -n -- netstat -suIf the output contains
sendorrecv buffer errors, UDP packets are dropped. Example:Udp: 1090421 packets received 850 packets to unknown port received 15662 packet receive errors 5607627 packets sent 15662 receive buffer errors 0 send buffer errorsCheck the CPU throttling metrics of the CoreDNS pod.
If the CPU of CoreDNS is throttled, DNS resolution may fail intermittently or the DNS response latency may increase. Check this metric together with the UDP packet loss found in the previous step.
NoteCPU utilization is sampled and calculated every 15 seconds, so the CPU of a pod may be throttled even when its CPU utilization looks low. For more information, see Enable the CPU Burst performance optimization policy.
On the Prometheus monitoring page, choose Application Monitoring > Cluster Pod Monitoring, set Namespace to
kube-system, select the CoreDNS pod, and then view the CPU Throttled Percent line chart in the CPU Resource section. If the metric stays close to 0%, the CPU is not throttled.Collect CoreDNS metrics and view the CoreDNS dashboard. Whether you use Managed Service for Prometheus or a self-managed Prometheus stack, we recommend that you always collect CoreDNS metrics so that you can identify abnormal metrics and locate the time at which the failures occurred. Log in to the ACK console and open the CoreDNS dashboard in the networking section of Prometheus Service.
Solutions:
Configure a NodeSelector to schedule CoreDNS pods to a separate node pool so that the pods run on dedicated nodes and do not configure CPU resource limits for CoreDNS.
If a CPU resource limit is configured for the CoreDNS pods, also enable the CPU Burst performance optimization policy.
Install the NodeLocal DNSCache add-on and configure pods to use the local DNS cache. For more information, see Use the NodeLocal DNSCache add-on.