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

Cleanup nodelocaldns configuration #11238

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ metadata:
name: nodelocaldns
namespace: kube-system
labels:
k8s-app: kube-dns
k8s-app: node-local-dns
kubernetes.io/cluster-service: "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that label is deprecated. (I don't find direct reference, but see kubernetes/kubernetes#72757

addonmanager.kubernetes.io/mode: Reconcile
spec:
selector:
Expand Down Expand Up @@ -42,9 +43,7 @@ spec:
- -localip
- {{ nodelocaldns_ip }}
- -conf
- /etc/coredns/Corefile
- -upstreamsvc
Copy link
Contributor

Choose a reason for hiding this comment

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

why removing the upstreamsvc?

Copy link
Author

@evan-a-a evan-a-a May 28, 2024

Choose a reason for hiding this comment

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

I explain this in the commit message, but this is a no-op in the Kubespray configuration, since we use Ansible to template the Corefile. The sole purpose of upstreamsvc is to replace __PILLAR__CLUSTER__DNS__ during templating from Corefile.base with the IP of the upstream service.

- coredns
- /etc/Corefile
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this file configured ?

Copy link
Author

Choose a reason for hiding this comment

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

Node-cache generates the Corefile from Corefile.base, substituting any templated values in the process.

{% if enable_nodelocaldns_secondary %}
- -skipteardown
{% else %}
Expand Down Expand Up @@ -97,7 +96,7 @@ spec:
name: nodelocaldns
items:
- key: Corefile
path: Corefile
path: Corefile.base
Copy link
Contributor

Choose a reason for hiding this comment

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

Corefile.base doesn't seem used anywhere

Copy link
Author

Choose a reason for hiding this comment

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

{% if dns_etchosts | default(None) %}
- key: hosts
path: hosts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ metadata:
name: nodelocaldns
namespace: kube-system
labels:
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ metadata:
name: nodelocaldns-second
namespace: kube-system
labels:
k8s-app: kube-dns
k8s-app: node-local-dns
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
selector:
Expand Down Expand Up @@ -38,7 +39,7 @@ spec:
requests:
cpu: {{ nodelocaldns_cpu_requests }}
memory: {{ nodelocaldns_memory_requests }}
args: [ "-localip", "{{ nodelocaldns_ip }}", "-conf", "/etc/coredns/Corefile", "-upstreamsvc", "coredns", "-skipteardown" ]
args: [ "-localip", "{{ nodelocaldns_ip }}", "-conf", "/etc/Corefile", "-skipteardown" ]
securityContext:
privileged: true
{% if nodelocaldns_bind_metrics_host_ip %}
Expand Down Expand Up @@ -84,7 +85,7 @@ spec:
name: nodelocaldns
items:
- key: Corefile-second
path: Corefile
path: Corefile.base
{% if dns_etchosts | default(None) %}
- key: hosts
path: hosts
Expand Down