Run DNS queries¶
With NodelocalDNS installed on your MKE cluster, you can run queries from the Pod that has the DNS diagnostic utilities.
Run the Pod:
kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
Example output:
pod/dnsutils created
Verify that Pod status has changed to
Running
:kubectl get pods dnsutils
Example output:
NAME READY STATUS RESTARTS AGE dnsutils 1/1 Running 0 26m
Run the
nslookup
anddig
DNS queries multiple times. The cache hits should increase forNodeLocalDnsCache
.DNS query using
nslookup
:kubectl exec -i -t dnsutils -- nslookup example.com kubectl exec -i -t dnsutils -- dig +short @169.254.0.10 example.com
Example output:
kubectl exec -i -t dnsutils -- nslookup example.com Server: 10.96.0.10 Address: 10.96.0.10#53 Non-authoritative answer: Name: example.com Address: 93.184.215.14
DNS query using
dig
:kubectl exec -i -t dnsutils -- dig +short @169.254.0.10 example.com
Example output:
93.184.215.14
Check the NodeLocalDNS metrics for cache hits:
curl http://localhost:9253/metrics | grep coredns_cache_hits_total
Example output:
curl http://localhost:9253/metrics | grep coredns_cache_hits_total % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0# HELP coredns_cache_hits_total The count of cache hits. # TYPE coredns_cache_hits_total counter coredns_cache_hits_total{server="dns://10.96.0.10:53",type="denial",view="",zones="."} 8 coredns_cache_hits_total{server="dns://10.96.0.10:53",type="denial",view="",zones="cluster.local."} 71 coredns_cache_hits_total{server="dns://10.96.0.10:53",type="success",view="",zones="."} 8 coredns_cache_hits_total{server="dns://10.96.0.10:53",type="success",view="",zones="cluster.local."} 53 coredns_cache_hits_total{server="dns://169.254.0.10:53",type="success",view="",zones="."} 6 100 64055 0 64055 0 0 30.5M 0 --:--:-- --:--:-- --:--:-- 30.5M