You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.0 KiB

  1. ---
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5. name: coredns
  6. namespace: kube-system
  7. labels:
  8. addonmanager.kubernetes.io/mode: EnsureExists
  9. data:
  10. Corefile: |
  11. {% if coredns_external_zones is defined and coredns_external_zones | length > 0 %}
  12. {% for block in coredns_external_zones %}
  13. {{ block['zones'] | join(' ') }} {
  14. log
  15. errors {
  16. {% if coredns_additional_error_config is defined %}
  17. {{ coredns_additional_error_config | indent(width=10, first=False) }}
  18. {% endif %}
  19. }
  20. {% if block['rewrite'] is defined and block['rewrite'] | length > 0 %}
  21. {% for rewrite_match in block['rewrite'] %}
  22. rewrite {{ rewrite_match }}
  23. {% endfor %}
  24. {% endif %}
  25. forward . {{ block['nameservers'] | join(' ') }}
  26. loadbalance
  27. cache {{ block['cache'] | default(5) }}
  28. reload
  29. {% if dns_etchosts | default(None) %}
  30. hosts /etc/coredns/hosts {
  31. fallthrough
  32. }
  33. {% endif %}
  34. }
  35. {% endfor %}
  36. {% endif %}
  37. .:53 {
  38. {% if coredns_additional_configs is defined %}
  39. {{ coredns_additional_configs | indent(width=8, first=False) }}
  40. {% endif %}
  41. errors {
  42. {% if coredns_additional_error_config is defined %}
  43. {{ coredns_additional_error_config | indent(width=10, first=False) }}
  44. {% endif %}
  45. }
  46. health {
  47. lameduck 5s
  48. }
  49. {% if coredns_rewrite_block is defined %}
  50. {{ coredns_rewrite_block | indent(width=8, first=False) }}
  51. {% endif %}
  52. {% for old_dns_domain in old_dns_domains %}
  53. rewrite name suffix {{ old_dns_domain }} {{ dns_domain }} answer auto
  54. {% endfor %}
  55. ready
  56. 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 %}{
  57. pods insecure
  58. {% if enable_coredns_k8s_endpoint_pod_names %}
  59. endpoint_pod_names
  60. {% endif %}
  61. {% if enable_coredns_reverse_dns_lookups %}
  62. fallthrough in-addr.arpa ip6.arpa
  63. {% endif %}
  64. {% if coredns_kubernetes_extra_opts is defined %}
  65. {% for opt in coredns_kubernetes_extra_opts %}
  66. {{ opt }}
  67. {% endfor %}
  68. {% endif %}
  69. }
  70. prometheus :9153
  71. forward . {{ upstream_dns_servers | join(' ') if upstream_dns_servers is defined and upstream_dns_servers | length > 0 else '/etc/resolv.conf' }} {
  72. prefer_udp
  73. max_concurrent 1000
  74. {% if dns_upstream_forward_extra_opts is defined %}
  75. {% for optname, optvalue in dns_upstream_forward_extra_opts.items() %}
  76. {{ optname }} {{ optvalue }}
  77. {% endfor %}
  78. {% endif %}
  79. }
  80. {% if enable_coredns_k8s_external %}
  81. k8s_external {{ coredns_k8s_external_zone }}
  82. {% endif %}
  83. {{ coredns_default_zone_cache_block | indent(width=8, first=False) }}
  84. loop
  85. reload
  86. loadbalance
  87. {% if dns_etchosts | default(None) %}
  88. hosts /etc/coredns/hosts {
  89. fallthrough
  90. }
  91. {% endif %}
  92. }
  93. {% if dns_etchosts | default(None) %}
  94. hosts: |
  95. {{ dns_etchosts | indent(width=4, first=False) }}
  96. {% endif %}