In correlation with the end of life (EOL) for MKE 3.7.x, maintenance of this documentation set was discontinued as of 2025-AUG-29. Click here for the latest MKE 3.x version documentation.

Run DNS queries

With NodelocalDNS installed on your MKE cluster, you can run queries from the Pod that has the DNS diagnostic utilities.

  1. Run the Pod:

    kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml
    

    Example output:

    pod/dnsutils created
    
  2. 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
    
  3. Run the nslookup and dig DNS queries multiple times. The cache hits should increase for NodeLocalDnsCache.

    1. 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
      
    2. DNS query using dig:

      kubectl exec -i -t dnsutils -- dig +short @169.254.0.10 example.com
      

      Example output:

      93.184.215.14
      
  4. 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