title: Kubernetes - How to edit CoreDNS corefile configmap?
body: <p>I have a pretty standard installation of Kubernetes running as a single-node cluster on Ubuntu.  I am trying to configure CoreDNS to resolve all internal services within my Kubernetes cluster and SOME external domain names.  So far, I have just been experimenting.  I started by creating a busybox pod as seen here: <a href="https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/" rel="noreferrer">https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/</a></p>
  
  <p>Everything works as described in the guide until I make changes to the corefile.  I am seeing a couple of issues:</p>
  
  <ol>
  <li>I edited the default corefile using <code>kubectl -n kube-system edit configmap coredns</code> and replaced <code>.:53</code> with <code>cluster.local:53</code>.  After waiting, things look promising.  <code>google.com</code> resolution began failing, while <code>kubernetes.default.svc.cluster.local</code> continued to succeed.  However, <code>kubernetes.default</code> resolution began failing too.  Why is that?  There is still a <strong>search</strong> entry for <code>svc.cluster.local</code> in the busybody pod’s <code>/etc/resolv.conf</code>.  All that changed was the corefile.</li>
  <li><p>I tried to add an additional stanza/block to the corefile (again, by editing the config map).  I added a simple block :</p>
  
  <pre><code>.:53{
      log
  }
  </code></pre>
  
  <p>It seems that the corefile fails to compile or something.  The pods seem healthy and don’t report any errors to the logs, but the requests all hang and fail.  </p></li>
  </ol>
  
  <p>I have tried to add the log plugin, but this isn’t working since the plugin is only applied to domains matching the plugin, and either the domain name doesn’t match or the corefile is broken.</p>
  
  <p>For transparency, this is my new corefile :</p>
  
  <pre><code>cluster.local:53 {
      errors
      log
      health
      kubernetes cluster.local in-addr.arpa ip6.arpa {
         pods insecure
         upstream
         fallthrough in-addr.arpa ip6.arpa
      }
      prometheus :9153
      forward . /etc/resolv.conf
      cache 30
      loop
      reload
      loadbalance
  }
  </code></pre>