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: |
|
2023-07-05 11:36:54 +08:00
|
|
|
{% if coredns_external_zones is defined and coredns_external_zones | length > 0 %}
|
2020-03-27 14:34:23 +08:00
|
|
|
{% for block in coredns_external_zones %}
|
|
|
|
{{ block['zones'] | join(' ') }} {
|
2020-03-28 02:39:54 +08:00
|
|
|
log
|
2023-10-10 20:32:41 +08:00
|
|
|
errors {
|
|
|
|
{% if coredns_additional_error_config is defined %}
|
|
|
|
{{ coredns_additional_error_config | indent(width=10, first=False) }}
|
|
|
|
{% endif %}
|
|
|
|
}
|
2023-07-05 11:36:54 +08:00
|
|
|
{% if block['rewrite'] is defined and block['rewrite'] | length > 0 %}
|
2022-09-04 07:16:35 +08:00
|
|
|
{% for rewrite_match in block['rewrite'] %}
|
|
|
|
rewrite {{ rewrite_match }}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2020-03-28 02:39:54 +08:00
|
|
|
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 %}
|
2024-05-14 05:51:11 +08:00
|
|
|
.:53 {
|
2023-10-10 20:32:41 +08:00
|
|
|
{% if coredns_additional_configs is defined %}
|
2023-05-09 21:45:58 +08:00
|
|
|
{{ coredns_additional_configs | indent(width=8, first=False) }}
|
2023-10-10 20:32:41 +08:00
|
|
|
{% endif %}
|
|
|
|
errors {
|
|
|
|
{% if coredns_additional_error_config is defined %}
|
|
|
|
{{ coredns_additional_error_config | indent(width=10, first=False) }}
|
|
|
|
{% endif %}
|
|
|
|
}
|
2020-04-22 20:27:52 +08:00
|
|
|
health {
|
|
|
|
lameduck 5s
|
|
|
|
}
|
2023-05-13 05:32:46 +08:00
|
|
|
{% if coredns_rewrite_block is defined %}
|
|
|
|
{{ coredns_rewrite_block | indent(width=8, first=False) }}
|
|
|
|
{% endif %}
|
2024-01-24 13:31:22 +08:00
|
|
|
{% for old_dns_domain in old_dns_domains %}
|
|
|
|
rewrite name suffix {{ old_dns_domain }} {{ dns_domain }} answer auto
|
|
|
|
{% endfor %}
|
2019-05-28 21:47:57 +08:00
|
|
|
ready
|
2023-01-05 22:57:58 +08:00
|
|
|
kubernetes {{ dns_domain }} {% if coredns_kubernetes_extra_domains is defined %}{{ coredns_kubernetes_extra_domains }} {% endif %}{% 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
|
2022-12-28 10:21:27 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if coredns_kubernetes_extra_opts is defined %}
|
|
|
|
{% for opt in coredns_kubernetes_extra_opts %}
|
|
|
|
{{ opt }}
|
|
|
|
{% endfor %}
|
2020-09-25 17:33:11 +08:00
|
|
|
{% endif %}
|
2018-03-13 19:00:05 +08:00
|
|
|
}
|
|
|
|
prometheus :9153
|
2023-07-05 11:36:54 +08:00
|
|
|
forward . {{ upstream_dns_servers | join(' ') if upstream_dns_servers is defined and upstream_dns_servers | length > 0 else '/etc/resolv.conf' }} {
|
2019-06-05 14:27:55 +08:00
|
|
|
prefer_udp
|
2022-09-22 19:27:03 +08:00
|
|
|
max_concurrent 1000
|
2022-11-08 22:44:25 +08:00
|
|
|
{% if dns_upstream_forward_extra_opts is defined %}
|
|
|
|
{% for optname, optvalue in dns_upstream_forward_extra_opts.items() %}
|
|
|
|
{{ optname }} {{ optvalue }}
|
|
|
|
{% endfor %}
|
2019-07-16 15:53:23 +08:00
|
|
|
{% endif %}
|
2022-11-08 22:44:25 +08:00
|
|
|
}
|
2019-07-16 15:53:23 +08:00
|
|
|
{% 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 %}
|