2018-03-13 19:00:05 +08:00
|
|
|
---
|
2019-09-11 03:06:55 +08:00
|
|
|
apiVersion: apps/v1
|
2018-03-13 19:00:05 +08:00
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
2019-03-27 02:09:17 +08:00
|
|
|
name: "coredns{{ coredns_ordinal_suffix }}"
|
2018-03-30 19:29:13 +08:00
|
|
|
namespace: kube-system
|
2018-03-13 19:00:05 +08:00
|
|
|
labels:
|
2019-04-10 19:12:13 +08:00
|
|
|
k8s-app: "kube-dns{{ coredns_ordinal_suffix }}"
|
2018-11-16 01:52:12 +08:00
|
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
2019-03-27 02:09:17 +08:00
|
|
|
kubernetes.io/name: "coredns{{ coredns_ordinal_suffix }}"
|
2018-03-13 19:00:05 +08:00
|
|
|
spec:
|
|
|
|
strategy:
|
|
|
|
type: RollingUpdate
|
|
|
|
rollingUpdate:
|
|
|
|
maxUnavailable: 0
|
|
|
|
maxSurge: 10%
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2019-04-10 19:12:13 +08:00
|
|
|
k8s-app: kube-dns{{ coredns_ordinal_suffix }}
|
2018-03-13 19:00:05 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2019-04-10 19:12:13 +08:00
|
|
|
k8s-app: kube-dns{{ coredns_ordinal_suffix }}
|
2018-03-13 19:00:05 +08:00
|
|
|
annotations:
|
2020-05-28 05:02:02 +08:00
|
|
|
seccomp.security.alpha.kubernetes.io/pod: 'runtime/default'
|
2018-03-13 19:00:05 +08:00
|
|
|
spec:
|
2018-09-25 22:50:22 +08:00
|
|
|
priorityClassName: system-cluster-critical
|
2018-11-13 20:54:15 +08:00
|
|
|
nodeSelector:
|
2020-04-17 20:51:06 +08:00
|
|
|
kubernetes.io/os: linux
|
2018-03-13 19:00:05 +08:00
|
|
|
serviceAccountName: coredns
|
|
|
|
tolerations:
|
2019-04-17 22:58:06 +08:00
|
|
|
- key: node-role.kubernetes.io/master
|
2018-03-13 19:00:05 +08:00
|
|
|
effect: NoSchedule
|
2021-01-22 00:13:03 +08:00
|
|
|
- key: node-role.kubernetes.io/control-plane
|
|
|
|
effect: NoSchedule
|
2019-11-27 21:49:21 +08:00
|
|
|
{% if dns_extra_tolerations | default(None) %}
|
|
|
|
{{ dns_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
|
|
|
|
{% endif %}
|
2018-08-09 23:42:53 +08:00
|
|
|
affinity:
|
|
|
|
podAntiAffinity:
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- topologyKey: "kubernetes.io/hostname"
|
|
|
|
labelSelector:
|
|
|
|
matchLabels:
|
2019-04-10 19:12:13 +08:00
|
|
|
k8s-app: kube-dns{{ coredns_ordinal_suffix }}
|
2018-08-09 23:42:53 +08:00
|
|
|
nodeAffinity:
|
|
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- weight: 100
|
|
|
|
preference:
|
|
|
|
matchExpressions:
|
2021-01-22 00:13:03 +08:00
|
|
|
{% if kube_version is version('v1.20.0', '<') %}
|
2019-04-17 22:58:06 +08:00
|
|
|
- key: node-role.kubernetes.io/master
|
2021-01-22 00:13:03 +08:00
|
|
|
{% else %}
|
|
|
|
- key: node-role.kubernetes.io/control-plane
|
|
|
|
{% endif %}
|
2018-08-09 23:42:53 +08:00
|
|
|
operator: In
|
|
|
|
values:
|
2018-11-22 21:27:25 +08:00
|
|
|
- ""
|
2018-03-13 19:00:05 +08:00
|
|
|
containers:
|
|
|
|
- name: coredns
|
|
|
|
image: "{{ coredns_image_repo }}:{{ coredns_image_tag }}"
|
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
|
|
|
resources:
|
|
|
|
# TODO: Set memory limits when we've profiled the container for large
|
|
|
|
# clusters, then set request = limit to keep this container in
|
|
|
|
# guaranteed class. Currently, this container falls into the
|
|
|
|
# "burstable" category so the kubelet doesn't backoff from restarting it.
|
|
|
|
limits:
|
|
|
|
memory: {{ dns_memory_limit }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ dns_cpu_requests }}
|
|
|
|
memory: {{ dns_memory_requests }}
|
|
|
|
args: [ "-conf", "/etc/coredns/Corefile" ]
|
|
|
|
volumeMounts:
|
|
|
|
- name: config-volume
|
|
|
|
mountPath: /etc/coredns
|
|
|
|
ports:
|
|
|
|
- containerPort: 53
|
|
|
|
name: dns
|
|
|
|
protocol: UDP
|
|
|
|
- containerPort: 53
|
|
|
|
name: dns-tcp
|
|
|
|
protocol: TCP
|
|
|
|
- containerPort: 9153
|
|
|
|
name: metrics
|
|
|
|
protocol: TCP
|
2018-10-11 15:12:58 +08:00
|
|
|
securityContext:
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
capabilities:
|
|
|
|
add:
|
|
|
|
- NET_BIND_SERVICE
|
|
|
|
drop:
|
|
|
|
- all
|
|
|
|
readOnlyRootFilesystem: true
|
2018-03-13 19:00:05 +08:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /health
|
|
|
|
port: 8080
|
|
|
|
scheme: HTTP
|
|
|
|
timeoutSeconds: 5
|
|
|
|
successThreshold: 1
|
2019-04-24 05:46:02 +08:00
|
|
|
failureThreshold: 10
|
2019-04-04 15:40:50 +08:00
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
2019-05-28 21:47:57 +08:00
|
|
|
path: /ready
|
|
|
|
port: 8181
|
2019-04-04 15:40:50 +08:00
|
|
|
scheme: HTTP
|
|
|
|
timeoutSeconds: 5
|
|
|
|
successThreshold: 1
|
2019-04-24 05:46:02 +08:00
|
|
|
failureThreshold: 10
|
2018-03-13 19:00:05 +08:00
|
|
|
dnsPolicy: Default
|
|
|
|
volumes:
|
|
|
|
- name: config-volume
|
|
|
|
configMap:
|
|
|
|
name: coredns
|
|
|
|
items:
|
|
|
|
- key: Corefile
|
|
|
|
path: Corefile
|
2020-06-26 15:03:31 +08:00
|
|
|
{% if dns_etchosts | default(None) %}
|
|
|
|
- key: hosts
|
|
|
|
path: hosts
|
|
|
|
{% endif %}
|