8487: Allow override of default CoreDNS zone cache (#8488)

Using the coredns_cluster_zone_cache_block variable
This commit is contained in:
Tristan 2022-02-01 08:48:18 +00:00 committed by GitHub
parent 2bbe5732b7
commit 92d612c3e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View file

@ -86,6 +86,28 @@ dns_etchosts: |
Whether reverse DNS lookups are enabled in the coredns config. Defaults to `true`. Whether reverse DNS lookups are enabled in the coredns config. Defaults to `true`.
### CoreDNS default zone cache plugin
If you wish to configure the caching behaviour of CoreDNS on the default zone, you can do so using the `coredns_default_zone_cache_block` string block.
An example value (more information on the [plugin's documentation](https://coredns.io/plugins/cache/)) to:
* raise the max cache TTL to 3600 seconds
* raise the max amount of success responses to cache to 3000
* disable caching of denial responses altogether
* enable pre-fetching of lookups with at least 10 lookups per minute before they expire
Would be as follows:
```yaml
coredns_default_zone_cache_block: |
cache 3600 {
success 3000
denial 0
prefetch 10 1m
}
```
## DNS modes supported by Kubespray ## DNS modes supported by Kubespray
You can modify how Kubespray sets up DNS for your cluster with the variables ``dns_mode`` and ``resolvconf_mode``. You can modify how Kubespray sets up DNS for your cluster with the variables ``dns_mode`` and ``resolvconf_mode``.

View file

@ -11,6 +11,8 @@ enable_coredns_reverse_dns_lookups: true
coredns_ordinal_suffix: "" coredns_ordinal_suffix: ""
# dns_extra_tolerations: [{effect: NoSchedule, operator: "Exists"}] # dns_extra_tolerations: [{effect: NoSchedule, operator: "Exists"}]
coredns_deployment_nodeselector: "kubernetes.io/os: linux" coredns_deployment_nodeselector: "kubernetes.io/os: linux"
coredns_default_zone_cache_block: |
cache 30
# nodelocaldns # nodelocaldns
nodelocaldns_cpu_requests: 100m nodelocaldns_cpu_requests: 100m

View file

@ -53,7 +53,7 @@ data:
{% if enable_coredns_k8s_external %} {% if enable_coredns_k8s_external %}
k8s_external {{ coredns_k8s_external_zone }} k8s_external {{ coredns_k8s_external_zone }}
{% endif %} {% endif %}
cache 30 {{ coredns_default_zone_cache_block | indent(width=8, first=False) }}
loop loop
reload reload
loadbalance loadbalance