Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds nodelocaldns_additional_configs to facilitate additional CoreDNS config options #11657

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/advanced/dns-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ Custom options to be added to the kubernetes coredns plugin.

Extra domains to be forwarded to the kubernetes coredns plugin.

### coredns_additional_configs

Extra configuration to be added to CoreDNS configuration

### coredns_rewrite_block

[Rewrite](https://coredns.io/plugins/rewrite/) plugin block to perform internal message rewriting.
Expand Down Expand Up @@ -290,6 +294,10 @@ nodelocaldns_external_zones:

See [dns_etchosts](#dns_etchosts-coredns) above.

### nodelocaldns_additional_configs

Extra configuration to be added to CoreDNS configuration

### Nodelocal DNS HA

Under some circumstances the single POD nodelocaldns implementation may not be able to be replaced soon enough and a cluster upgrade or a nodelocaldns upgrade can cause DNS requests to time out for short intervals. If for any reason your applications cannot tolerate this behavior you can enable a redundant nodelocal DNS pod on each node:
Expand Down
5 changes: 5 additions & 0 deletions roles/kubernetes-apps/ansible/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ nodelocaldns_ds_nodeselector: "kubernetes.io/os: linux"
nodelocaldns_prometheus_port: 9253
nodelocaldns_secondary_prometheus_port: 9255

# nodelocaldns_additional_configs adds any extra configuration to coredns
# nodelocaldns_additional_configs: |
# whoami
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@0x4c6565 0x4c6565 Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my particular use case, I wish to use the template plugin to respond to a query, so that this can be rewritten to a k8s service address via CNAME. I'm unable to utilise the existing coredns_additional_configs variable for this as this isn't used in the nodelocal dns config template, only in the coredns config template, and queries for non-k8s service addresses are passed directly to upstream from nodelocal dns

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explanation.

# local

# Limits for dns-autoscaler
dns_autoscaler_cpu_requests: 20m
dns_autoscaler_memory_requests: 10Mi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ data:
prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_prometheus_port }}
}
.:53 {
{% if nodelocaldns_additional_configs is defined %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should in-addr.arpa:53 and ip6.arpa:53 require these configs if we need these configs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on the intended use of this variable I suppose. I kept this consistent with coredns_additional_configs:

.:53 {
{% if coredns_additional_configs is defined %}
{{ coredns_additional_configs | indent(width=8, first=False) }}
{% endif %}

{{ nodelocaldns_additional_configs | indent(width=8, first=False) }}
{% endif %}
errors
cache 30
reload
Expand Down Expand Up @@ -157,6 +160,9 @@ data:
prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_secondary_prometheus_port }}
}
.:53 {
{% if nodelocaldns_additional_configs is defined %}
{{ nodelocaldns_additional_configs | indent(width=8, first=False) }}
{% endif %}
errors
cache 30
reload
Expand Down