2018-03-13 19:00:05 +08:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: ConfigMap
|
|
|
|
metadata:
|
|
|
|
name: coredns
|
2018-03-30 19:29:13 +08:00
|
|
|
namespace: kube-system
|
2018-11-16 01:52:12 +08:00
|
|
|
labels:
|
|
|
|
addonmanager.kubernetes.io/mode: EnsureExists
|
2018-03-13 19:00:05 +08:00
|
|
|
data:
|
|
|
|
Corefile: |
|
2020-03-27 14:34:23 +08:00
|
|
|
{% if coredns_external_zones is defined and coredns_external_zones|length > 0 %}
|
|
|
|
{% for block in coredns_external_zones %}
|
|
|
|
{{ block['zones'] | join(' ') }} {
|
2020-03-28 02:39:54 +08:00
|
|
|
log
|
|
|
|
errors
|
|
|
|
forward . {{ block['nameservers'] | join(' ') }}
|
|
|
|
loadbalance
|
|
|
|
cache {{ block['cache'] | default(5) }}
|
|
|
|
reload
|
2020-06-26 15:03:31 +08:00
|
|
|
{% if dns_etchosts | default(None) %}
|
|
|
|
hosts /etc/coredns/hosts {
|
|
|
|
fallthrough
|
|
|
|
}
|
|
|
|
{% endif %}
|
2020-03-28 02:39:54 +08:00
|
|
|
}
|
2020-03-27 14:34:23 +08:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-03-13 19:00:05 +08:00
|
|
|
.:53 {
|
|
|
|
errors
|
2020-04-22 20:27:52 +08:00
|
|
|
health {
|
|
|
|
lameduck 5s
|
|
|
|
}
|
2019-05-28 21:47:57 +08:00
|
|
|
ready
|
2020-09-25 17:33:11 +08:00
|
|
|
kubernetes {{ dns_domain }} {% if enable_coredns_reverse_dns_lookups %}in-addr.arpa ip6.arpa {% endif %}{
|
2018-03-13 19:00:05 +08:00
|
|
|
pods insecure
|
2019-08-01 02:26:15 +08:00
|
|
|
{% if enable_coredns_k8s_endpoint_pod_names %}
|
|
|
|
endpoint_pod_names
|
2018-10-08 22:08:51 +08:00
|
|
|
{% endif %}
|
2020-09-25 17:33:11 +08:00
|
|
|
{% if enable_coredns_reverse_dns_lookups %}
|
2018-03-13 19:00:05 +08:00
|
|
|
fallthrough in-addr.arpa ip6.arpa
|
2020-09-25 17:33:11 +08:00
|
|
|
{% endif %}
|
2018-03-13 19:00:05 +08:00
|
|
|
}
|
|
|
|
prometheus :9153
|
2021-12-06 18:46:32 +08:00
|
|
|
{% if upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
|
2019-06-05 14:27:55 +08:00
|
|
|
forward . {{ upstream_dns_servers|join(' ') }} {
|
|
|
|
prefer_udp
|
|
|
|
}
|
2018-10-08 22:08:51 +08:00
|
|
|
{% else %}
|
2019-06-05 14:27:55 +08:00
|
|
|
forward . /etc/resolv.conf {
|
|
|
|
prefer_udp
|
|
|
|
}
|
2019-07-16 15:53:23 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if enable_coredns_k8s_external %}
|
|
|
|
k8s_external {{ coredns_k8s_external_zone }}
|
2018-10-08 22:08:51 +08:00
|
|
|
{% endif %}
|
2022-02-01 16:48:18 +08:00
|
|
|
{{ coredns_default_zone_cache_block | indent(width=8, first=False) }}
|
2018-10-11 15:12:58 +08:00
|
|
|
loop
|
|
|
|
reload
|
|
|
|
loadbalance
|
2020-06-26 15:03:31 +08:00
|
|
|
{% if dns_etchosts | default(None) %}
|
|
|
|
hosts /etc/coredns/hosts {
|
|
|
|
fallthrough
|
|
|
|
}
|
|
|
|
{% endif %}
|
2018-03-13 19:00:05 +08:00
|
|
|
}
|
2020-06-26 15:03:31 +08:00
|
|
|
{% if dns_etchosts | default(None) %}
|
|
|
|
hosts: |
|
2021-11-25 00:56:21 +08:00
|
|
|
{{ dns_etchosts | indent(width=4, first=False) }}
|
2020-06-26 15:03:31 +08:00
|
|
|
{% endif %}
|