Add a Zone File to Kubernetes CoreDNS
Jump to navigation
Jump to search
Internal
Overview
The zone file is added as a ConfigMap entry which will be projected in CoreDNS pods as a file, under the zone file name. The Corefile projected as part of the same ConfigMap should be also modified to refer the new zone file with the "file" directive.
The CoreDNS deployment is then scaled down, the new configuration file is added as an "item" in configMap volume mount, and the deployment is then scaled up.
Procedure
Add the Zone File to ConfigMap
kubectl -n kube-system edit configmap coredns
You should get something similar to:
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
annotations:
...
name: coredns
namespace: kube-system
...