Skip to content

Commit c7132d0

Browse files
committed
eks: Make unbound work in ipv4 and ipv6 clusters
Signed-off-by: Mikkel Oscar Lyderik Larsen <[email protected]>
1 parent bb719e0 commit c7132d0

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

cluster/manifests/01-coredns-local/configmap-local.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ data:
1010
unbound.conf: |
1111
server:
1212
directory: "/etc/unbound/"
13+
{{- if and (eq .Cluster.Provider "zalando-eks") (eq .Cluster.ConfigItems.eks_ip_family "ipv6") }}
14+
interface: "::0"
15+
{{- else }}
1316
interface: 0.0.0.0
17+
{{- end }}
1418
interface-automatic: yes
1519
# Drop user privileges after binding the port.
1620
username: "_unbound"
@@ -21,24 +25,52 @@ data:
2125
log-servfail: yes
2226
# allow query localhost (coredns at 127.0.0.1:9254)
2327
do-not-query-localhost: no
28+
{{- if and (eq .Cluster.Provider "zalando-eks") (eq .Cluster.ConfigItems.eks_ip_family "ipv6") }}
29+
access-control: ::/0 allow
30+
{{- else }}
2431
access-control: 0.0.0.0/0 allow
32+
{{- end }}
2533
harden-dnssec-stripped: no
2634
so-reuseport: yes
2735
cache-min-ttl: 1
2836
disable-dnssec-lame-check: yes
2937
minimal-responses: yes
3038
extended-statistics: yes
3139
# support reverse lookup of kubernetes addresses
40+
{{- if eq .Cluster.Provider "zalando-eks" }}
41+
# CoreDNS is authoritative for the reverse lookup ranges. Therefore
42+
# disable the default protection in unbound to allow reverse lookup
43+
# queries to pass through to CoreDNS
44+
# https://github.com/NLnetLabs/unbound/blob/5c84bb573f9728c10bcb3592dbd12be403d362de/doc/example.conf.in#L804-L850
45+
local-zone: "d.f.ip6.arpa." nodefault
46+
local-zone: "8.e.f.ip6.arpa." nodefault
47+
local-zone: "9.e.f.ip6.arpa." nodefault
48+
local-zone: "a.e.f.ip6.arpa." nodefault
49+
local-zone: "b.e.f.ip6.arpa." nodefault
50+
local-zone: "8.b.d.0.1.0.0.2.ip6.arpa." nodefault
51+
local-zone: "ip6.arpa." transparent
52+
local-zone: "10.in-addr.arpa." nodefault
53+
local-zone: "in-addr.arpa." transparent
54+
{{- else }}
3255
local-zone: "2.10.in-addr.arpa." transparent
3356
local-zone: "3.10.in-addr.arpa." transparent
3457
local-zone: "5.10.in-addr.arpa." transparent
58+
{{- end }}
3559
# make metrics available for the unbound-telemetry container (127.0.0.1:9054)
3660
remote-control:
3761
control-enable: yes
3862
control-use-cert: no
3963
forward-zone:
4064
name: "."
4165
forward-addr: 127.0.0.1@9254 # coredns
66+
{{- if eq .Cluster.Provider "zalando-eks" }}
67+
forward-zone:
68+
name: "ip6.arpa."
69+
forward-addr: 127.0.0.1@9254 # coredns
70+
forward-zone:
71+
name: "in-addr.arpa."
72+
forward-addr: 127.0.0.1@9254 # coredns
73+
{{- else }}
4274
forward-zone:
4375
name: "2.10.in-addr.arpa."
4476
forward-addr: 127.0.0.1@9254 # coredns
@@ -48,6 +80,7 @@ data:
4880
forward-zone:
4981
name: "5.10.in-addr.arpa."
5082
forward-addr: 127.0.0.1@9254 # coredns
83+
{{- end }}
5184
Corefile: |
5285
{{ if and .Cluster.ConfigItems.custom_dns_zone .Cluster.ConfigItems.custom_dns_zone_nameservers }}
5386
{{ .Cluster.ConfigItems.custom_dns_zone }}:9254 {

cluster/manifests/01-coredns-local/daemonset-coredns.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ spec:
6666
command:
6767
- dig
6868
- "+short"
69-
{{- if and (eq .Cluster.Provider "zalando-eks") (eq .Cluster.ConfigItems.eks_ip_family "ipv4") }}
70-
- "@127.0.0.1"
69+
{{- if and (eq .Cluster.Provider "zalando-eks") (eq .Cluster.ConfigItems.eks_ip_family "ipv6") }}
70+
- "@::1"
7171
{{- else }}
72-
- "::1"
72+
- "@127.0.0.1"
7373
{{- end }}
7474
- "kubernetes.default.svc.cluster.local"
7575
initialDelaySeconds: 60
@@ -183,7 +183,6 @@ spec:
183183
args:
184184
- --v=2
185185
- --logtostderr
186-
# TODO: ipv6
187186
- --probe=dnsmasq,127.0.0.1:9254,ec2.amazonaws.com,5,A
188187
- --prometheus-port=9054
189188
ports:

0 commit comments

Comments
 (0)