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.

103 lines
3.2 KiB

  1. apiVersion: apps/v1
  2. kind: DaemonSet
  3. metadata:
  4. name: nodelocaldns-second
  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-second
  13. template:
  14. metadata:
  15. labels:
  16. k8s-app: node-local-dns-second
  17. annotations:
  18. prometheus.io/scrape: 'true'
  19. prometheus.io/port: '{{ nodelocaldns_secondary_prometheus_port }}'
  20. spec:
  21. nodeSelector:
  22. {{ nodelocaldns_ds_nodeselector }}
  23. priorityClassName: system-cluster-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: [ "-localip", "{{ nodelocaldns_ip }}", "-conf", "/etc/coredns/Corefile", "-upstreamsvc", "coredns", "-skipteardown" ]
  42. securityContext:
  43. privileged: true
  44. {% if nodelocaldns_bind_metrics_host_ip %}
  45. env:
  46. - name: MY_HOST_IP
  47. valueFrom:
  48. fieldRef:
  49. fieldPath: status.hostIP
  50. {% endif %}
  51. livenessProbe:
  52. httpGet:
  53. host: {{ nodelocaldns_ip }}
  54. path: /health
  55. port: {{ nodelocaldns_health_port }}
  56. scheme: HTTP
  57. timeoutSeconds: 5
  58. successThreshold: 1
  59. failureThreshold: 10
  60. readinessProbe:
  61. httpGet:
  62. host: {{ nodelocaldns_ip }}
  63. path: /health
  64. port: {{ nodelocaldns_health_port }}
  65. scheme: HTTP
  66. timeoutSeconds: 5
  67. successThreshold: 1
  68. failureThreshold: 10
  69. volumeMounts:
  70. - name: config-volume
  71. mountPath: /etc/coredns
  72. - name: xtables-lock
  73. mountPath: /run/xtables.lock
  74. lifecycle:
  75. preStop:
  76. exec:
  77. command:
  78. - sh
  79. - -c
  80. - sleep {{ nodelocaldns_secondary_skew_seconds }} && kill -9 1
  81. volumes:
  82. - name: config-volume
  83. configMap:
  84. name: nodelocaldns
  85. items:
  86. - key: Corefile-second
  87. path: Corefile
  88. {% if dns_etchosts | default(None) %}
  89. - key: hosts
  90. path: hosts
  91. {% endif %}
  92. - name: xtables-lock
  93. hostPath:
  94. path: /run/xtables.lock
  95. type: FileOrCreate
  96. # Implement a time skew between the main nodelocaldns and this secondary.
  97. # Since the two nodelocaldns instances share the :53 port, we want to keep
  98. # at least one running at any time enven if the manifests are replaced simultaneously
  99. terminationGracePeriodSeconds: {{ nodelocaldns_secondary_skew_seconds }}
  100. updateStrategy:
  101. rollingUpdate:
  102. maxUnavailable: {{ serial | default('20%') }}
  103. type: RollingUpdate