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.

134 lines
4.1 KiB

  1. ---
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: metrics-server
  6. namespace: kube-system
  7. labels:
  8. app.kubernetes.io/name: metrics-server
  9. kubernetes.io/cluster-service: "true"
  10. addonmanager.kubernetes.io/mode: Reconcile
  11. version: {{ metrics_server_version }}
  12. spec:
  13. selector:
  14. matchLabels:
  15. app.kubernetes.io/name: metrics-server
  16. version: {{ metrics_server_version }}
  17. template:
  18. metadata:
  19. name: metrics-server
  20. labels:
  21. app.kubernetes.io/name: metrics-server
  22. version: {{ metrics_server_version }}
  23. annotations:
  24. seccomp.security.alpha.kubernetes.io/pod: 'docker/default'
  25. spec:
  26. priorityClassName: system-cluster-critical
  27. serviceAccountName: metrics-server
  28. containers:
  29. - name: metrics-server
  30. image: {{ metrics_server_image_repo }}:{{ metrics_server_image_tag }}
  31. command:
  32. - /metrics-server
  33. - --logtostderr
  34. - --cert-dir=/tmp
  35. - --secure-port=8443
  36. {% if metrics_server_kubelet_preferred_address_types %}
  37. - --kubelet-preferred-address-types={{ metrics_server_kubelet_preferred_address_types }}
  38. {% endif %}
  39. {% if metrics_server_kubelet_insecure_tls %}
  40. - --kubelet-insecure-tls
  41. {% endif %}
  42. - --metric-resolution={{ metrics_server_metric_resolution }}
  43. ports:
  44. - containerPort: 8443
  45. name: https
  46. protocol: TCP
  47. volumeMounts:
  48. - name: tmp
  49. mountPath: /tmp
  50. livenessProbe:
  51. httpGet:
  52. path: /healthz
  53. port: https
  54. scheme: HTTPS
  55. successThreshold: 1
  56. initialDelaySeconds: 20
  57. failureThreshold: 3
  58. timeoutSeconds: 10
  59. readinessProbe:
  60. httpGet:
  61. path: /healthz
  62. port: https
  63. scheme: HTTPS
  64. successThreshold: 1
  65. initialDelaySeconds: 20
  66. failureThreshold: 3
  67. timeoutSeconds: 10
  68. securityContext:
  69. allowPrivilegeEscalation: false
  70. capabilities:
  71. drop: ["all"]
  72. readOnlyRootFilesystem: true
  73. runAsGroup: 10001
  74. runAsNonRoot: true
  75. runAsUser: 10001
  76. - name: metrics-server-nanny
  77. image: {{ addon_resizer_image_repo }}:{{ addon_resizer_image_tag }}
  78. resources:
  79. limits:
  80. cpu: {{ addon_resizer_limits_cpu }}
  81. memory: {{ addon_resizer_limits_memory }}
  82. requests:
  83. cpu: {{ addon_resizer_requests_cpu }}
  84. memory: {{ addon_resizer_requests_memory }}
  85. env:
  86. - name: MY_POD_NAME
  87. valueFrom:
  88. fieldRef:
  89. fieldPath: metadata.name
  90. - name: MY_POD_NAMESPACE
  91. valueFrom:
  92. fieldRef:
  93. fieldPath: metadata.namespace
  94. volumeMounts:
  95. - name: metrics-server-config-volume
  96. mountPath: /etc/config
  97. command:
  98. - /pod_nanny
  99. - --config-dir=/etc/config
  100. - --cpu={{ metrics_server_cpu }}
  101. - --extra-cpu=0.5m
  102. - --memory={{ metrics_server_memory }}
  103. - --extra-memory={{ metrics_server_memory_per_node }}
  104. - --threshold=5
  105. - --deployment=metrics-server
  106. - --container=metrics-server
  107. - --poll-period=300000
  108. - --estimator=exponential
  109. # Specifies the smallest cluster (defined in number of nodes)
  110. # resources will be scaled to.
  111. - --minClusterSize={{ metrics_server_min_cluster_size }}
  112. volumes:
  113. - name: metrics-server-config-volume
  114. configMap:
  115. name: metrics-server-config
  116. - name: tmp
  117. emptyDir: {}
  118. {% if not masters_are_not_tainted %}
  119. tolerations:
  120. - key: node-role.kubernetes.io/master
  121. effect: NoSchedule
  122. - key: "CriticalAddonsOnly"
  123. operator: "Exists"
  124. {% endif %}
  125. affinity:
  126. nodeAffinity:
  127. preferredDuringSchedulingIgnoredDuringExecution:
  128. - weight: 100
  129. preference:
  130. matchExpressions:
  131. - key: node-role.kubernetes.io/master
  132. operator: In
  133. values:
  134. - ""