<p>For my project I need to overwrite CNAME DNS records with CoreDNS for internal cluster DNS resolution. 
I can do this globally for a cluster like this:</p>

<pre><code>apiVersion: v1
        data:
        Corefile: |
            # Add your CoreDNS customizations as import files.
            # Refer to https://cloud.ibm.com/docs/containers?topic=containers-cluster_dns for details.
            .:53 {
                rewrite name test.example.com example.namespace1.svc.cluster.local
                ...
            }
...
</code></pre>

<p>So in the whole cluster all requests to <code>test.example.com</code> will be sended to service: <code>example.namespace1.svc.cluster.local</code>.</p>

<p>Is it possible to define rewrite rule only for specific namespace?
For example I want only <code>namespace1</code> to have this rewrite rule in place.</p>

<p>Thank you!</p>

mflame
<p>No it's not possible to have DNS per namespace by modifying the configMap of core DNS because coreDNS is a cluster wide DNS . If your use case is to expose services via hostname then you can explore <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">ingress</a> </p>
