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:
|
2024-01-09 00:38:05 +08:00
|
|
|
maxUnavailable: 1
|
2018-03-13 19:00:05 +08:00
|
|
|
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:
|
2021-02-09 22:02:40 +08:00
|
|
|
createdby: 'kubespray'
|
2018-03-13 19:00:05 +08:00
|
|
|
spec:
|
2023-11-17 21:41:53 +08:00
|
|
|
hostNetwork: {{ coredns_host_network | default(false) }}
|
2023-04-13 12:38:35 +08:00
|
|
|
securityContext:
|
|
|
|
seccompProfile:
|
|
|
|
type: RuntimeDefault
|
2018-11-13 20:54:15 +08:00
|
|
|
nodeSelector:
|
2021-05-26 04:40:43 +08:00
|
|
|
{{ coredns_deployment_nodeselector }}
|
|
|
|
priorityClassName: system-cluster-critical
|
2018-03-13 19:00:05 +08:00
|
|
|
serviceAccountName: coredns
|
|
|
|
tolerations:
|
2021-01-22 00:13:03 +08:00
|
|
|
- key: node-role.kubernetes.io/control-plane
|
|
|
|
effect: NoSchedule
|
2022-06-20 16:36:06 +08:00
|
|
|
{% if dns_extra_tolerations is defined %}
|
2019-11-27 21:49:21 +08:00
|
|
|
{{ 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
|
|
|
- key: node-role.kubernetes.io/control-plane
|
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:
|
2023-05-19 18:38:29 +08:00
|
|
|
{% if dns_cpu_limit is defined %}
|
|
|
|
cpu: {{ dns_cpu_limit }}
|
|
|
|
{% endif %}
|
2018-03-13 19:00:05 +08:00
|
|
|
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:
|
2023-11-17 21:41:53 +08:00
|
|
|
- containerPort: {{ coredns_port }}
|
2018-03-13 19:00:05 +08:00
|
|
|
name: dns
|
|
|
|
protocol: UDP
|
2023-11-17 21:41:53 +08:00
|
|
|
- containerPort: {{ coredns_port }}
|
2018-03-13 19:00:05 +08:00
|
|
|
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 %}
|