2018-12-11 09:28:03 +08:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
|
|
|
name: nodelocaldns
|
|
|
|
namespace: kube-system
|
|
|
|
labels:
|
|
|
|
k8s-app: kube-dns
|
|
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
|
|
spec:
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2023-02-03 07:42:28 +08:00
|
|
|
k8s-app: node-local-dns
|
2018-12-11 09:28:03 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
2019-01-28 17:57:40 +08:00
|
|
|
labels:
|
2023-02-03 07:42:28 +08:00
|
|
|
k8s-app: node-local-dns
|
2019-01-28 17:57:40 +08:00
|
|
|
annotations:
|
|
|
|
prometheus.io/scrape: 'true'
|
2021-11-10 01:57:47 +08:00
|
|
|
prometheus.io/port: '{{ nodelocaldns_prometheus_port }}'
|
2018-12-11 09:28:03 +08:00
|
|
|
spec:
|
2021-05-26 04:40:43 +08:00
|
|
|
nodeSelector:
|
|
|
|
{{ nodelocaldns_ds_nodeselector }}
|
2024-04-10 10:48:01 +08:00
|
|
|
priorityClassName: system-node-critical
|
2018-12-11 09:28:03 +08:00
|
|
|
serviceAccountName: nodelocaldns
|
|
|
|
hostNetwork: true
|
|
|
|
dnsPolicy: Default # Don't use cluster DNS.
|
|
|
|
tolerations:
|
2019-04-08 17:24:26 +08:00
|
|
|
- effect: NoSchedule
|
|
|
|
operator: "Exists"
|
|
|
|
- effect: NoExecute
|
|
|
|
operator: "Exists"
|
2018-12-11 09:28:03 +08:00
|
|
|
containers:
|
|
|
|
- name: node-cache
|
|
|
|
image: "{{ nodelocaldns_image_repo }}:{{ nodelocaldns_image_tag }}"
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
memory: {{ nodelocaldns_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ nodelocaldns_cpu_requests }}
|
2021-05-26 04:40:43 +08:00
|
|
|
memory: {{ nodelocaldns_memory_requests }}
|
2021-11-10 01:57:47 +08:00
|
|
|
args:
|
|
|
|
- -localip
|
|
|
|
- {{ nodelocaldns_ip }}
|
|
|
|
- -conf
|
|
|
|
- /etc/coredns/Corefile
|
|
|
|
- -upstreamsvc
|
|
|
|
- coredns
|
|
|
|
{% if enable_nodelocaldns_secondary %}
|
|
|
|
- -skipteardown
|
|
|
|
{% else %}
|
2018-12-11 09:28:03 +08:00
|
|
|
ports:
|
|
|
|
- containerPort: 53
|
|
|
|
name: dns
|
|
|
|
protocol: UDP
|
|
|
|
- containerPort: 53
|
|
|
|
name: dns-tcp
|
|
|
|
protocol: TCP
|
|
|
|
- containerPort: 9253
|
|
|
|
name: metrics
|
|
|
|
protocol: TCP
|
2021-11-10 01:57:47 +08:00
|
|
|
{% endif %}
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
{% if nodelocaldns_bind_metrics_host_ip %}
|
|
|
|
env:
|
|
|
|
- name: MY_HOST_IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: status.hostIP
|
|
|
|
{% endif %}
|
2018-12-11 09:28:03 +08:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
host: {{ nodelocaldns_ip }}
|
|
|
|
path: /health
|
2019-07-09 15:52:01 +08:00
|
|
|
port: {{ nodelocaldns_health_port }}
|
2018-12-11 09:28:03 +08:00
|
|
|
scheme: HTTP
|
|
|
|
timeoutSeconds: 5
|
|
|
|
successThreshold: 1
|
2019-04-24 05:46:02 +08:00
|
|
|
failureThreshold: 10
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
host: {{ nodelocaldns_ip }}
|
|
|
|
path: /health
|
2019-07-09 15:52:01 +08:00
|
|
|
port: {{ nodelocaldns_health_port }}
|
2019-04-24 05:46:02 +08:00
|
|
|
scheme: HTTP
|
|
|
|
timeoutSeconds: 5
|
|
|
|
successThreshold: 1
|
|
|
|
failureThreshold: 10
|
2018-12-11 09:28:03 +08:00
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /etc/coredns
|
2019-01-28 17:57:40 +08:00
|
|
|
- name: xtables-lock
|
|
|
|
mountPath: /run/xtables.lock
|
2018-12-11 09:28:03 +08:00
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
name: nodelocaldns
|
|
|
|
items:
|
|
|
|
- key: Corefile
|
|
|
|
path: Corefile
|
2020-06-26 15:03:31 +08:00
|
|
|
{% if dns_etchosts | default(None) %}
|
|
|
|
- key: hosts
|
|
|
|
path: hosts
|
|
|
|
{% endif %}
|
2019-01-28 17:57:40 +08:00
|
|
|
- name: xtables-lock
|
|
|
|
hostPath:
|
|
|
|
path: /run/xtables.lock
|
|
|
|
type: FileOrCreate
|
|
|
|
# Minimize downtime during a rolling upgrade or deletion; tell Kubernetes to do a "force
|
|
|
|
# deletion": https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods.
|
|
|
|
terminationGracePeriodSeconds: 0
|
|
|
|
updateStrategy:
|
|
|
|
rollingUpdate:
|
|
|
|
maxUnavailable: {{ serial | default('20%') }}
|
|
|
|
type: RollingUpdate
|