-
Notifications
You must be signed in to change notification settings - Fork 163
/
daemonset-coredns.yaml
247 lines (247 loc) · 7.18 KB
/
daemonset-coredns.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: coredns
namespace: kube-system
labels:
application: kubernetes
component: coredns
spec:
updateStrategy:
type: OnDelete
selector:
matchLabels:
daemonset: coredns
template:
metadata:
labels:
daemonset: coredns
application: kubernetes
component: coredns
instance: node-dns
annotations:
logging/destination: "{{.Cluster.ConfigItems.log_destination_infra}}"
prometheus.io/path: /metrics
prometheus.io/scrape: "true"
prometheus.io/port: "9153"
spec:
initContainers:
- name: ensure-apiserver
image: container-registry.zalando.net/teapot/ensure-apiserver:master-6
resources:
requests:
cpu: 1m
memory: 50Mi
ephemeral-storage: 256Mi
limits:
cpu: 1m
memory: 50Mi
containers:
{{ if eq .Cluster.ConfigItems.dns_cache "unbound" }}
- name: unbound
image: container-registry.zalando.net/teapot/unbound:1.19.2-master-9
args:
- -d
- -c
- /etc/unbound/unbound.conf
ports:
- containerPort: 53
name: dns-udp
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
{{- if eq .Cluster.ConfigItems.expirimental_dns_unbound_liveness_probe "true" }}
livenessProbe:
exec:
command:
- dig
- "+short"
- "@127.0.0.1"
- "kubernetes.default.svc.cluster.local"
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
{{- end }}
resources:
requests:
ephemeral-storage: 256Mi
limits:
cpu: {{.Cluster.ConfigItems.dns_unbound_cpu}}
memory: {{.Cluster.ConfigItems.dns_unbound_mem}}
volumeMounts:
- mountPath: /etc/unbound/unbound.conf
name: config-volume
readOnly: true
subPath: unbound.conf
- name: unbound-telemetry
image: container-registry.zalando.net/teapot/unbound-telemetry:master-5
args:
- tcp
- --bind=0.0.0.0:9054
ports:
- name: metrics
containerPort: 9054
protocol: TCP
resources:
requests:
ephemeral-storage: 256Mi
limits:
cpu: {{.Cluster.ConfigItems.dns_unbound_telemetry_cpu}}
memory: {{.Cluster.ConfigItems.dns_unbound_telemetry_mem}}
{{ end }}
{{ if eq .Cluster.ConfigItems.dns_cache "dnsmasq" }}
- name: dnsmasq
image: container-registry.zalando.net/teapot/k8s-dns-dnsmasq-nanny:1.17.4-master-15
securityContext:
privileged: true
livenessProbe:
httpGet:
path: /healthcheck/dnsmasq
port: 9054
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
args:
- -v=2
- -logtostderr
- -configDir=/etc/k8s/dns/dnsmasq-nanny
- -restartDnsmasq=true
- --
- --no-resolv
- --keep-in-foreground
- --log-facility=-
- --cache-size=50000
- --dns-forward-max=500
- --neg-ttl=60
# send requests to the last server first, only fallback to the previous ones if it's unreachable
- --strict-order
- --server=10.5.0.11#53
- --server=127.0.0.1#9254
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
resources:
requests:
ephemeral-storage: 256Mi
limits:
cpu: {{.Cluster.ConfigItems.dns_dnsmasq_cpu}}
memory: {{.Cluster.ConfigItems.dns_dnsmasq_mem}}
- name: sidecar
image: container-registry.zalando.net/teapot/k8s-dns-sidecar:1.17.4-master-15
securityContext:
privileged: true
livenessProbe:
httpGet:
path: /metrics
port: 9054
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
args:
- --v=2
- --logtostderr
- --probe=dnsmasq,127.0.0.1:9254,ec2.amazonaws.com,5,A
- --prometheus-port=9054
ports:
- containerPort: 9054
name: metrics
protocol: TCP
resources:
requests:
ephemeral-storage: 256Mi
limits:
cpu: {{.Cluster.ConfigItems.dns_dnsmasq_sidecar_cpu}}
memory: {{.Cluster.ConfigItems.dns_dnsmasq_sidecar_mem}}
{{ end }}
- name: coredns
image: container-registry.zalando.net/teapot/coredns:1.11.3-master-24
args: [ "-conf", "/etc/coredns/Corefile" ]
env:
- name: ZONE
valueFrom:
fieldRef:
fieldPath: metadata.annotations['topology.kubernetes.io/zone']
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
ports:
- containerPort: 9254
name: dns
protocol: UDP
- containerPort: 9254
name: dns-tcp
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: 9154
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
readinessProbe:
httpGet:
path: /ready
port: 9155
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 3
resources:
requests:
ephemeral-storage: 256Mi
limits:
cpu: {{.Cluster.ConfigItems.dns_coredns_cpu}}
memory: {{.Cluster.ConfigItems.dns_coredns_mem}}
priorityClassName: system-node-critical
serviceAccountName: coredns
hostNetwork: true
dnsPolicy: Default
tolerations:
- key: node.kubernetes.io/role
value: master
effect: NoSchedule
- key: node.kubernetes.io/not-ready
operator: Exists
- key: dedicated
operator: Exists
- key: aws.amazon.com/spot
operator: Exists
- key: zalando.org/node-not-ready
operator: Exists
effect: NoSchedule
- key: nvidia.com/gpu
value: present
effect: NoSchedule
# these are tolerated in the unlikely case an already scheduled daemonset
# pod is deleted and needs to be rescheduled on a to be terminated node.
- key: decommission-pending
operator: Exists
- key: karpenter.sh/disruption
operator: Exists
- key: DeletionCandidateOfClusterAutoscaler
operator: Exists
- key: ToBeDeletedByClusterAutoscaler
operator: Exists
- key: BeingDeletedByClusterAutoscaler
operator: Exists
volumes:
- name: config-volume
configMap:
name: coredns-local
items:
- key: Corefile
path: Corefile
- key: unbound.conf
path: unbound.conf