How to enable CoreDNS query logging in a Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes cluster

Follow
Table of Contents

Task

By default, DNS query logging is disabled in CoreDNS, this article details the steps to enable query logging for CoreDNS in a Kubernetes cluster provisioned by the Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x.

Pre-requisites

  • A Kubernetes cluster provisioned by the Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x, using the CoreDNS dns add-on.

Steps

To enable DNS query logging the log plugin needs to be configured, by addition of log to the Corefile in the coredns ConfigMap of the kube-system Namespace.

For example, to use the default log plugin configuration and log all queries, the Corefile definition would be updated as follows:

.:53 {
    log
    errors
    health
    ready
    kubernetes cluster.local in-addr.arpa ip6.arpa {
      pods insecure
      fallthrough in-addr.arpa ip6.arpa
    }
    prometheus :9153
    forward . "/etc/resolv.conf" {
      policy random
    }
    cache 30
    loop
    reload
    loadbalance
}

Steps to update the CoreDNS ConfigMap and persist these changes can be found in the article "How to update the CoreDNS ConfigMap in a Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes cluster".

For the full list of available options when configuring the log plugin refer to the plugin documentation.

Further reading

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.