Skip to content

Commit badbd10

Browse files
committed
kube-system: Add nodelocaldns
1 parent 7f81581 commit badbd10

File tree

4 files changed

+174
-0
lines changed

4 files changed

+174
-0
lines changed

metal/roles/k3s/templates/config.yaml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ token-file: {{ k3s_token_file }}
77
{% if 'kube_control_plane' in group_names %}
88
{{ k3s_server_config | to_nice_yaml }}
99
{% endif %}
10+
kubelet-arg:
11+
- "cluster-dns=169.254.25.10"

system/kube-system/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace: kube-system
55
resources:
66
- resources/cilium/bgp-peering-policy.yaml
77
- resources/cilium/load-balancer-ip-pool.yaml
8+
- resources/nodelocaldns/configmap.yaml
9+
- resources/nodelocaldns/daemonset.yaml
810
- resources/priority-class-high.yaml
911
- resources/runtime-class.yaml
1012

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
labels:
5+
k8s-app: kube-dns
6+
name: nodelocaldns
7+
data:
8+
Corefile: |
9+
cluster.local:53 {
10+
errors
11+
cache {
12+
success 9984 30
13+
denial 9984 5
14+
}
15+
reload
16+
loop
17+
bind 169.254.25.10
18+
forward . 10.43.0.10 {
19+
force_tcp
20+
}
21+
prometheus :9253
22+
health 169.254.25.10:9254
23+
hosts /etc/coredns/hosts {
24+
fallthrough
25+
}
26+
}
27+
in-addr.arpa:53 {
28+
errors
29+
cache 30
30+
reload
31+
loop
32+
bind 169.254.25.10
33+
forward . 10.43.0.10 {
34+
force_tcp
35+
}
36+
prometheus :9253
37+
}
38+
ip6.arpa:53 {
39+
errors
40+
cache 30
41+
reload
42+
loop
43+
bind 169.254.25.10
44+
forward . 10.43.0.10 {
45+
force_tcp
46+
}
47+
prometheus :9253
48+
}
49+
.:53 {
50+
errors
51+
cache 30
52+
reload
53+
loop
54+
bind 169.254.25.10
55+
forward . /etc/resolv.conf
56+
prometheus :9253
57+
hosts /etc/coredns/hosts {
58+
fallthrough
59+
}
60+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
labels:
5+
k8s-app: kube-dns
6+
name: nodelocaldns
7+
spec:
8+
revisionHistoryLimit: 10
9+
selector:
10+
matchLabels:
11+
k8s-app: node-local-dns
12+
template:
13+
metadata:
14+
labels:
15+
k8s-app: node-local-dns
16+
spec:
17+
containers:
18+
- args:
19+
- -localip
20+
- 169.254.25.10
21+
- -conf
22+
- /etc/coredns/Corefile
23+
- -upstreamsvc
24+
- coredns
25+
image: registry.k8s.io/dns/k8s-dns-node-cache:1.22.28
26+
imagePullPolicy: IfNotPresent
27+
livenessProbe:
28+
failureThreshold: 10
29+
httpGet:
30+
host: 169.254.25.10
31+
path: /health
32+
port: 9254
33+
scheme: HTTP
34+
periodSeconds: 10
35+
successThreshold: 1
36+
timeoutSeconds: 5
37+
name: node-cache
38+
ports:
39+
- containerPort: 53
40+
hostPort: 53
41+
name: dns
42+
protocol: UDP
43+
- containerPort: 53
44+
hostPort: 53
45+
name: dns-tcp
46+
protocol: TCP
47+
- containerPort: 9253
48+
hostPort: 9253
49+
name: metrics
50+
protocol: TCP
51+
readinessProbe:
52+
failureThreshold: 10
53+
httpGet:
54+
host: 169.254.25.10
55+
path: /health
56+
port: 9254
57+
scheme: HTTP
58+
periodSeconds: 10
59+
successThreshold: 1
60+
timeoutSeconds: 5
61+
resources:
62+
limits:
63+
memory: 200Mi
64+
requests:
65+
cpu: 100m
66+
memory: 70Mi
67+
securityContext:
68+
privileged: true
69+
terminationMessagePath: /dev/termination-log
70+
terminationMessagePolicy: File
71+
volumeMounts:
72+
- mountPath: /etc/coredns
73+
name: config-volume
74+
- mountPath: /run/xtables.lock
75+
name: xtables-lock
76+
dnsPolicy: Default
77+
hostNetwork: true
78+
nodeSelector:
79+
kubernetes.io/os: linux
80+
priorityClassName: system-node-critical
81+
restartPolicy: Always
82+
schedulerName: default-scheduler
83+
securityContext: {}
84+
serviceAccount: nodelocaldns
85+
serviceAccountName: nodelocaldns
86+
terminationGracePeriodSeconds: 0
87+
tolerations:
88+
- effect: NoSchedule
89+
operator: Exists
90+
- effect: NoExecute
91+
operator: Exists
92+
volumes:
93+
- configMap:
94+
defaultMode: 420
95+
items:
96+
- key: Corefile
97+
path: Corefile
98+
- key: hosts
99+
path: hosts
100+
name: nodelocaldns
101+
name: config-volume
102+
- hostPath:
103+
path: /run/xtables.lock
104+
type: FileOrCreate
105+
name: xtables-lock
106+
updateStrategy:
107+
rollingUpdate:
108+
maxSurge: 0
109+
maxUnavailable: 20%
110+
type: RollingUpdate

0 commit comments

Comments
 (0)