Kubernetes - How to edit CoreDNS corefile configmap? Kubernetes - How to edit CoreDNS corefile configmap? kubernetes kubernetes

Kubernetes - How to edit CoreDNS corefile configmap?


It looks like your Corefile got somehow corrupted during editing through "kubectl edit ..." command. Probably it's fault of your default text editor, but it's definitely valid.

I would recommend you to replace your current config map with the following command:

kubectl get -n kube-system cm/coredns --export -o yaml | kubectl replace -n kube-system -f coredns_cm.yaml

#coredns_cm.yamlapiVersion: v1data:  Corefile: |    cluster.local:53 {        log        errors        health        kubernetes cluster.local in-addr.arpa ip6.arpa {           pods insecure           upstream           fallthrough in-addr.arpa ip6.arpa        }        prometheus :9153        proxy . /etc/resolv.conf        cache 30        loop        reload        loadbalance    }kind: ConfigMapmetadata:  creationTimestamp: null  name: coredns