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.

115 lines
3.2 KiB

  1. apiVersion: apps/v1
  2. kind: DaemonSet
  3. metadata:
  4. name: nodelocaldns
  5. namespace: kube-system
  6. labels:
  7. k8s-app: kube-dns
  8. addonmanager.kubernetes.io/mode: Reconcile
  9. spec:
  10. selector:
  11. matchLabels:
  12. k8s-app: node-local-dns
  13. template:
  14. metadata:
  15. labels:
  16. k8s-app: node-local-dns
  17. annotations:
  18. prometheus.io/scrape: 'true'
  19. prometheus.io/port: '{{ nodelocaldns_prometheus_port }}'
  20. spec:
  21. nodeSelector:
  22. {{ nodelocaldns_ds_nodeselector }}
  23. priorityClassName: system-node-critical
  24. serviceAccountName: nodelocaldns
  25. hostNetwork: true
  26. dnsPolicy: Default # Don't use cluster DNS.
  27. tolerations:
  28. - effect: NoSchedule
  29. operator: "Exists"
  30. - effect: NoExecute
  31. operator: "Exists"
  32. containers:
  33. - name: node-cache
  34. image: "{{ nodelocaldns_image_repo }}:{{ nodelocaldns_image_tag }}"
  35. resources:
  36. limits:
  37. memory: {{ nodelocaldns_memory_limit }}
  38. requests:
  39. cpu: {{ nodelocaldns_cpu_requests }}
  40. memory: {{ nodelocaldns_memory_requests }}
  41. args:
  42. - -localip
  43. - {{ nodelocaldns_ip }}
  44. - -conf
  45. - /etc/coredns/Corefile
  46. - -upstreamsvc
  47. - coredns
  48. {% if enable_nodelocaldns_secondary %}
  49. - -skipteardown
  50. {% else %}
  51. ports:
  52. - containerPort: 53
  53. name: dns
  54. protocol: UDP
  55. - containerPort: 53
  56. name: dns-tcp
  57. protocol: TCP
  58. - containerPort: 9253
  59. name: metrics
  60. protocol: TCP
  61. {% endif %}
  62. securityContext:
  63. privileged: true
  64. {% if nodelocaldns_bind_metrics_host_ip %}
  65. env:
  66. - name: MY_HOST_IP
  67. valueFrom:
  68. fieldRef:
  69. fieldPath: status.hostIP
  70. {% endif %}
  71. livenessProbe:
  72. httpGet:
  73. host: {{ nodelocaldns_ip }}
  74. path: /health
  75. port: {{ nodelocaldns_health_port }}
  76. scheme: HTTP
  77. timeoutSeconds: 5
  78. successThreshold: 1
  79. failureThreshold: 10
  80. readinessProbe:
  81. httpGet:
  82. host: {{ nodelocaldns_ip }}
  83. path: /health
  84. port: {{ nodelocaldns_health_port }}
  85. scheme: HTTP
  86. timeoutSeconds: 5
  87. successThreshold: 1
  88. failureThreshold: 10
  89. volumeMounts:
  90. - name: config-volume
  91. mountPath: /etc/coredns
  92. - name: xtables-lock
  93. mountPath: /run/xtables.lock
  94. volumes:
  95. - name: config-volume
  96. configMap:
  97. name: nodelocaldns
  98. items:
  99. - key: Corefile
  100. path: Corefile
  101. {% if dns_etchosts | default(None) %}
  102. - key: hosts
  103. path: hosts
  104. {% endif %}
  105. - name: xtables-lock
  106. hostPath:
  107. path: /run/xtables.lock
  108. type: FileOrCreate
  109. # Minimize downtime during a rolling upgrade or deletion; tell Kubernetes to do a "force
  110. # deletion": https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods.
  111. terminationGracePeriodSeconds: 0
  112. updateStrategy:
  113. rollingUpdate:
  114. maxUnavailable: {{ serial | default('20%') }}
  115. type: RollingUpdate