Get the version of Gadget
- MyTechClouds
- May 27
- 1 min read
Updated: Jun 16
GADGET_VERSION=$(kubectl gadget version | grep Server | awk '{print $3}')
Run the trace_dns gadget
kubectl gadget run trace_dns:$GADGET_VERSION --all-namespaces --fields "src,dst,name,qr,qtype,id,rcode,latency_ns"
```
Verify the Health of the Upstream DNS Servers in AKS
You can use the DNS gadget to verify the health of the upstream DNS servers used by CoreDNS. If applications try to reach external domains, the queries are forwarded to the upstream DNS servers via CoreDNS. To understand the health of these queries, trace the DNS packets leaving the CoreDNS pods and filter by the nameserver.
In the following example, the default Azure DNS Server (IP address 168.63.129.16) is used as the upstream nameserver. If you're using a custom DNS server, you can use its IP address as the upstream nameserver. You can find the IP address by looking up /etc/resolv.conf on the node.
```bash
kubectl gadget run trace_dns:$GADGET_VERSION \
--all-namespaces \
--fields src,dst,id,qr,name,nameserver,rcode,latency_ns \
--filter "nameserver.addr==168.63.129.16"
```
Verify DNS Queries Get Responses in a Timely Manner
You can use the DNS gadget to verify that a particular DNS query receives a response promptly. To perform this check, filter the events with a DNS name and match the query/response IDs:
```bash
kubectl gadget run trace_dns:$GADGET_VERSION \
-l app=test-pod \
--fields k8s.node,k8s.namespace,k8s.podname,id,qtype,qr,name,rcode,latency_ns \
--filter name==microsoft.com.
```
Conclusion
In this article, I have outlined the steps to troubleshoot DNS resolution problems in Azure Kubernetes Service (AKS). By following this structured approach, you can effectively identify and resolve DNS issues in your AKS cluster.
About MyTechClouds
MyTechClouds specializes in Cloud Infrastructure, Kubernetes, Cybersecurity, DevOps, AI Solutions, and Remote Engineering Support.
🌐 https://www.mytechclouds.com 📧 info@mytechclouds.com 📱 +91 7982628512
Comments