<p>I have a CoreFile configutation like this</p>
<pre><code>.:53 {
    errors
    health {
       lameduck 5s
    }
    ready
    kubernetes cluster.local in-addr.arpa ip6.arpa {
       pods insecure
       fallthrough in-addr.arpa ip6.arpa
       ttl 30
    }
    prometheus :9153
    forward . /etc/resolv.conf {
       max_concurrent 1000
    }
    cache 30
    loop
    reload
    loadbalance
}
</code></pre>
<p>I would like all my pods to be able to resolve myapi.local to a specific IP ( 192.168.49.2 )
Is there any easy way to achieve this like the what I can do with OS's host file</p>

qkhanhpro
<p>Below configuration should do the trick</p>
<pre><code>.:53 {
    errors
    health
    ready
    kubernetes cluster.local in-addr.arpa ip6.arpa {
        pods insecure
        fallthrough in-addr.arpa ip6.arpa
    }
    prometheus :9153
    hosts custom.hosts myapi.local {
        192.168.49.2 myapi.local
        fallthrough
    }
    forward . 8.8.8.8 8.8.4.4
    cache 30
    loop
    reload
    loadbalance
}
</code></pre>
<p>Reference <a href="https://medium.com/@hjrocha/add-a-custom-host-to-kubernetes-a06472cedccb" rel="noreferrer">https://medium.com/@hjrocha/add-a-custom-host-to-kubernetes-a06472cedccb</a></p>
<p>Or you can try using the hosts plugin <a href="https://coredns.io/plugins/hosts/" rel="noreferrer">https://coredns.io/plugins/hosts/</a></p>
