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.

159 lines
4.8 KiB

  1. ---
  2. apiVersion: extensions/v1beta1
  3. kind: Deployment
  4. metadata:
  5. name: kube-dns
  6. namespace: "{{system_namespace}}"
  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. scheduler.alpha.kubernetes.io/critical-pod: ''
  29. spec:
  30. tolerations:
  31. - key: "CriticalAddonsOnly"
  32. operator: "Exists"
  33. - effect: NoSchedule
  34. operator: Exists
  35. volumes:
  36. - name: kube-dns-config
  37. configMap:
  38. name: kube-dns
  39. optional: true
  40. containers:
  41. - name: kubedns
  42. image: "{{ kubedns_image_repo }}:{{ kubedns_image_tag }}"
  43. imagePullPolicy: {{ k8s_image_pull_policy }}
  44. resources:
  45. # TODO: Set memory limits when we've profiled the container for large
  46. # clusters, then set request = limit to keep this container in
  47. # guaranteed class. Currently, this container falls into the
  48. # "burstable" category so the kubelet doesn't backoff from restarting it.
  49. limits:
  50. memory: {{ dns_memory_limit }}
  51. requests:
  52. cpu: {{ dns_cpu_requests }}
  53. memory: {{ dns_memory_requests }}
  54. livenessProbe:
  55. httpGet:
  56. path: /healthcheck/kubedns
  57. port: 10054
  58. scheme: HTTP
  59. initialDelaySeconds: 60
  60. timeoutSeconds: 5
  61. successThreshold: 1
  62. failureThreshold: 5
  63. readinessProbe:
  64. httpGet:
  65. path: /readiness
  66. port: 8081
  67. scheme: HTTP
  68. # we poll on pod startup for the Kubernetes master service and
  69. # only setup the /readiness HTTP server once that's available.
  70. initialDelaySeconds: 3
  71. timeoutSeconds: 5
  72. args:
  73. - --domain={{ dns_domain }}.
  74. - --dns-port=10053
  75. - --config-dir=/kube-dns-config
  76. - --v={{ kube_log_level }}
  77. env:
  78. - name: PROMETHEUS_PORT
  79. value: "10055"
  80. ports:
  81. - containerPort: 10053
  82. name: dns-local
  83. protocol: UDP
  84. - containerPort: 10053
  85. name: dns-tcp-local
  86. protocol: TCP
  87. - containerPort: 10055
  88. name: metrics
  89. protocol: TCP
  90. volumeMounts:
  91. - name: kube-dns-config
  92. mountPath: /kube-dns-config
  93. - name: dnsmasq
  94. image: "{{ dnsmasq_nanny_image_repo }}:{{ dnsmasq_nanny_image_tag }}"
  95. imagePullPolicy: {{ k8s_image_pull_policy }}
  96. livenessProbe:
  97. httpGet:
  98. path: /healthcheck/dnsmasq
  99. port: 10054
  100. scheme: HTTP
  101. initialDelaySeconds: 60
  102. timeoutSeconds: 5
  103. successThreshold: 1
  104. failureThreshold: 5
  105. args:
  106. - -v={{ kube_log_level }}
  107. - -logtostderr
  108. - -configDir=/etc/k8s/dns/dnsmasq-nanny
  109. - -restartDnsmasq=true
  110. - --
  111. - -k
  112. - --cache-size=1000
  113. - --log-facility=-
  114. - --server=/{{ dns_domain }}/127.0.0.1#10053
  115. - --server=/in-addr.arpa/127.0.0.1#10053
  116. - --server=/ip6.arpa/127.0.0.1#10053
  117. ports:
  118. - containerPort: 53
  119. name: dns
  120. protocol: UDP
  121. - containerPort: 53
  122. name: dns-tcp
  123. protocol: TCP
  124. # see: https://github.com/kubernetes/kubernetes/issues/29055 for details
  125. resources:
  126. requests:
  127. cpu: 150m
  128. memory: 20Mi
  129. volumeMounts:
  130. - name: kube-dns-config
  131. mountPath: /etc/k8s/dns/dnsmasq-nanny
  132. - name: sidecar
  133. image: "{{ dnsmasq_sidecar_image_repo }}:{{ dnsmasq_sidecar_image_tag }}"
  134. livenessProbe:
  135. httpGet:
  136. path: /metrics
  137. port: 10054
  138. scheme: HTTP
  139. initialDelaySeconds: 60
  140. timeoutSeconds: 5
  141. successThreshold: 1
  142. failureThreshold: 5
  143. args:
  144. - --v={{ kube_log_level }}
  145. - --logtostderr
  146. - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.{{ dns_domain }},5,A
  147. - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.{{ dns_domain }},5,A
  148. ports:
  149. - containerPort: 10054
  150. name: metrics
  151. protocol: TCP
  152. resources:
  153. requests:
  154. memory: 20Mi
  155. cpu: 10m
  156. dnsPolicy: Default # Don't use cluster DNS.
  157. {% if rbac_enabled %}
  158. serviceAccountName: kube-dns
  159. {% endif %}