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)
Thank you @zc-devs for providing the solution , this issue is still present using K3S
v1.28.10+k3s1which usesCoreDNS-1.10.1I have written the following instructions for those who doesn’t quite understand whats needed to be done.
Running the following resolves the issue:
Before
After
Combining https://github.com/k3s-io/k3s/issues/7639#issuecomment-1592172869 and https://github.com/coredns/coredns/issues/3600#issuecomment-575239919 I got
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.servercontaining …very annoying message spam in loki/grafana
How did you actually create this
/etc/coredns/custom/empty.serverfile given that the CoreDNS pod doesn’t have bash, sh, or tar so you can’t use kubectl cp?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…
from your Corefile.