Adding Custom Zones to CoreDNS

To add your own zone in the CoreDNS configuration in the cluster, add a configmap with the coredns-custom name to the kube-system namespace.

The file name created by configmap must end with the .custom postfix, for example:

apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  test.custom: | # test.custom --- name, must end with the .custom postfix
    example.com:53 {
      whoami
    }

After that, restart the coredns pods by running the following command:

kubectl delete po -n kube-system -l k8s-app=kube-dns