You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
5.7 KiB

  1. ---
  2. apiVersion: extensions/v1beta1
  3. kind: Deployment
  4. metadata:
  5. name: kube-dns
  6. namespace: kube-system
  7. labels:
  8. k8s-app: kube-dns
  9. kubernetes.io/cluster-service: "true"
  10. addonmanager.kubernetes.io/mode: Reconcile
  11. spec:
  12. # replicas: not specified here:
  13. # 1. In order to make Addon Manager do not reconcile this replicas parameter.
  14. # 2. Default is 1.
  15. # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
  16. strategy:
  17. rollingUpdate:
  18. maxSurge: 10%
  19. maxUnavailable: 0
  20. selector:
  21. matchLabels:
  22. k8s-app: kube-dns
  23. template:
  24. metadata:
  25. labels:
  26. k8s-app: kube-dns
  27. annotations:
  28. seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
  29. spec:
  30. {% if kube_version is version('v1.11.1', '>=') %}
  31. priorityClassName: system-cluster-critical
  32. {% endif %}
  33. nodeSelector:
  34. beta.kubernetes.io/os: linux
  35. tolerations:
  36. - key: "CriticalAddonsOnly"
  37. operator: "Exists"
  38. - effect: "NoSchedule"
  39. operator: "Equal"
  40. key: "node-role.kubernetes.io/master"
  41. affinity:
  42. podAntiAffinity:
  43. requiredDuringSchedulingIgnoredDuringExecution:
  44. - topologyKey: "kubernetes.io/hostname"
  45. labelSelector:
  46. matchLabels:
  47. k8s-app: kube-dns
  48. nodeAffinity:
  49. preferredDuringSchedulingIgnoredDuringExecution:
  50. - weight: 100
  51. preference:
  52. matchExpressions:
  53. - key: node-role.kubernetes.io/master
  54. operator: In
  55. values:
  56. - ""
  57. volumes:
  58. - name: kube-dns-config
  59. configMap:
  60. name: kube-dns
  61. optional: true
  62. containers:
  63. - name: kubedns
  64. image: "{{ kubedns_image_repo }}:{{ kubedns_image_tag }}"
  65. imagePullPolicy: {{ k8s_image_pull_policy }}
  66. resources:
  67. # TODO: Set memory limits when we've profiled the container for large
  68. # clusters, then set request = limit to keep this container in
  69. # guaranteed class. Currently, this container falls into the
  70. # "burstable" category so the kubelet doesn't backoff from restarting it.
  71. limits:
  72. memory: {{ dns_memory_limit }}
  73. requests:
  74. cpu: {{ dns_cpu_requests }}
  75. memory: {{ dns_memory_requests }}
  76. livenessProbe:
  77. httpGet:
  78. path: /healthcheck/kubedns
  79. port: 10054
  80. scheme: HTTP
  81. initialDelaySeconds: 60
  82. timeoutSeconds: 5
  83. successThreshold: 1
  84. failureThreshold: 5
  85. readinessProbe:
  86. httpGet:
  87. path: /readiness
  88. port: 8081
  89. scheme: HTTP
  90. # we poll on pod startup for the Kubernetes master service and
  91. # only setup the /readiness HTTP server once that's available.
  92. initialDelaySeconds: 3
  93. timeoutSeconds: 5
  94. args:
  95. - --domain={{ dns_domain }}.
  96. - --dns-port=10053
  97. - --config-dir=/kube-dns-config
  98. - --v={{ kube_log_level }}
  99. {% if resolvconf_mode == 'host_resolvconf' and upstream_dns_servers is defined and upstream_dns_servers|length > 0 %}
  100. - --nameservers={{ upstream_dns_servers|join(',') }}
  101. {% endif %}
  102. env:
  103. - name: PROMETHEUS_PORT
  104. value: "10055"
  105. ports:
  106. - containerPort: 10053
  107. name: dns-local
  108. protocol: UDP
  109. - containerPort: 10053
  110. name: dns-tcp-local
  111. protocol: TCP
  112. - containerPort: 10055
  113. name: metrics
  114. protocol: TCP
  115. volumeMounts:
  116. - name: kube-dns-config
  117. mountPath: /kube-dns-config
  118. - name: dnsmasq
  119. image: "{{ dnsmasq_nanny_image_repo }}:{{ dnsmasq_nanny_image_tag }}"
  120. imagePullPolicy: {{ k8s_image_pull_policy }}
  121. livenessProbe:
  122. httpGet:
  123. path: /healthcheck/dnsmasq
  124. port: 10054
  125. scheme: HTTP
  126. initialDelaySeconds: 60
  127. timeoutSeconds: 5
  128. successThreshold: 1
  129. failureThreshold: 5
  130. args:
  131. - -v={{ kube_log_level }}
  132. - -logtostderr
  133. - -configDir=/etc/k8s/dns/dnsmasq-nanny
  134. - -restartDnsmasq=true
  135. - --
  136. - -k
  137. - --cache-size=1000
  138. - --no-negcache
  139. - --dns-loop-detect
  140. - --log-facility=-
  141. - --server=/{{ dns_domain }}/127.0.0.1#10053
  142. - --server=/in-addr.arpa/127.0.0.1#10053
  143. - --server=/ip6.arpa/127.0.0.1#10053
  144. ports:
  145. - containerPort: 53
  146. name: dns
  147. protocol: UDP
  148. - containerPort: 53
  149. name: dns-tcp
  150. protocol: TCP
  151. # see: https://github.com/kubernetes/kubernetes/issues/29055 for details
  152. resources:
  153. requests:
  154. cpu: 150m
  155. memory: 20Mi
  156. volumeMounts:
  157. - name: kube-dns-config
  158. mountPath: /etc/k8s/dns/dnsmasq-nanny
  159. - name: sidecar
  160. image: "{{ dnsmasq_sidecar_image_repo }}:{{ dnsmasq_sidecar_image_tag }}"
  161. livenessProbe:
  162. httpGet:
  163. path: /metrics
  164. port: 10054
  165. scheme: HTTP
  166. initialDelaySeconds: 60
  167. timeoutSeconds: 5
  168. successThreshold: 1
  169. failureThreshold: 5
  170. args:
  171. - --v={{ kube_log_level }}
  172. - --logtostderr
  173. - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.{{ dns_domain }},5,SRV
  174. - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.{{ dns_domain }},5,SRV
  175. ports:
  176. - containerPort: 10054
  177. name: metrics
  178. protocol: TCP
  179. resources:
  180. requests:
  181. memory: 20Mi
  182. cpu: 10m
  183. dnsPolicy: Default # Don't use cluster DNS.
  184. serviceAccountName: kube-dns