coredns: [Warning] messages are printed while log is configured for `error`

What happened: I keep seeing warning messages although logs is configured for error only. Here is an example:

[WARNING] No files matching import glob pattern: custom/*.override
[WARNING] No files matching import glob pattern: custom/*.server

What you expected to happen: No warning messages should be shown if the log plugin is in error mode.

Environment:

  • the version of CoreDNS: coredns:1.6.3
  • Corefile: ".:8053 { \n errors\n log . {\n class error\n }\n health\n \ ready\n kubernetes cluster.local in-addr.arpa ip6.arpa {\n pods insecure\n upstream\n fallthrough in-addr.arpa ip6.arpa\n ttl 30\n }\n prometheus 0.0.0.0:9153\n forward . /etc/resolv.conf\n cache 30\n loop\n reload\n loadbalance round_robin\n import custom/*.override\n}\nimport custom/*.server"
  • Others: kubernetes version 1.16, 1.15, 1.14

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Combining k3s-io/k3s#7639 (comment) and #3600 (comment) I got

# Deploy this manually via kubectl apply -f and restart the Pod
apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  log.override: |
    #
  stub.server: |
    #

CoreDNS-1.10.1, K3s 1.29

Thank you @zc-devs for providing the solution , this issue is still present using K3S v1.28.10+k3s1 which uses CoreDNS-1.10.1

I have written the following instructions for those who doesn’t quite understand whats needed to be done.

Running the following resolves the issue:

kubectl apply -f - <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  log.override: |
    #
  stub.server: |
    #
EOF

kubectl rollout restart deploy/coredns -n kube-system

Before

 ❯ k -n kube-system logs pod/coredns-5f4f679fbd-d4gsj
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
.:53
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[INFO] plugin/reload: Running configuration SHA512 = b941b080e5322f6519009bb49349462c7ddb6317425b0f6a83e5451175b720703949e3f3b454a24e77f3ffe57fd5e9c6130e528a5a1dd00d9000e4afd6c1108d
CoreDNS-1.10.1
linux/amd64, go1.20, 055b2c3
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.override
[WARNING] No files matching import glob pattern: /etc/coredns/custom/*.server

After

 ❯ k logs pod/coredns-8466d7cd9c-tkjfb -n kube-system
[INFO] plugin/ready: Still waiting on: "kubernetes"
.:53
[INFO] plugin/reload: Running configuration SHA512 = b941b080e5322f6519009bb49349462c7ddb6317425b0f6a83e5451175b720703949e3f3b454a24e77f3ffe57fd5e9c6130e528a5a1dd00d9000e4afd6c1108d
CoreDNS-1.10.1
linux/amd64, go1.20, 055b2c3

Combining https://github.com/k3s-io/k3s/issues/7639#issuecomment-1592172869 and https://github.com/coredns/coredns/issues/3600#issuecomment-575239919 I got

# Deploy this manually via kubectl apply -f and restart the Pod
apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  log.override: |
    #
  stub.server: |
    #

CoreDNS-1.10.1, K3s 1.29

I tested real quick - and found that importing an empty file causes CoreDNS not to start. However importing a file that has a single comment in it works ok and produces no warning.

e.g. custom/empty.server containing …

# empty

very annoying message spam in loki/grafana

I tested real quick - and found that importing an empty file causes CoreDNS not to start. However importing a file that has a single comment in it works ok and produces no warning.

How did you actually create this /etc/coredns/custom/empty.server file given that the CoreDNS pod doesn’t have bash, sh, or tar so you can’t use kubectl cp?

Is there a way to globally disable warnings?

Not that I am aware of. The warnings will go away once the imports have something to import … i.e. when there are actually files present matching the pattern, you will no longer see those warnings. You could try putting empty files in those locations to silence the errors, but I don’t know if an empty file may in itself generate another warning.

Best way would be to remove the imports from the Corefile. i.e. remove the lines…

import custom/*.override
import custom/*.server

from your Corefile.