c12s-kubespray/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2
Mateus Caruccio 3237b2702f
Add config coredns_external_zones (#5280)
Allows to add custom zone resolving servers.
2020-03-26 23:34:23 -07:00

56 lines
1.5 KiB
Django/Jinja
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: EnsureExists
data:
Corefile: |
{% if coredns_external_zones is defined and coredns_external_zones|length > 0 %}
{% for block in coredns_external_zones %}
{{ block['zones'] | join(' ') }} {
        log
        errors
        forward . {{ block['nameservers'] | join(' ') }}
        loadbalance
        cache {{ block['cache'] | default(5) }}
        reload
    }
{% endfor %}
{% endif %}
.:53 {
errors
health
ready
kubernetes {{ dns_domain }} in-addr.arpa ip6.arpa {
pods insecure
{% if enable_coredns_k8s_endpoint_pod_names %}
endpoint_pod_names
{% endif %}
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
upstream {{ upstream_dns_servers|join(' ') }}
{% else %}
upstream /etc/resolv.conf
{% endif %}
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
{% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
forward . {{ upstream_dns_servers|join(' ') }} {
prefer_udp
}
{% else %}
forward . /etc/resolv.conf {
prefer_udp
}
{% endif %}
{% if enable_coredns_k8s_external %}
k8s_external {{ coredns_k8s_external_zone }}
{% endif %}
cache 30
loop
reload
loadbalance
}