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.

133 lines
4.2 KiB

  1. ---
  2. apiVersion: extensions/v1beta1
  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. {% if kube_version is version('v1.11.1', '>=') %}
  27. priorityClassName: system-cluster-critical
  28. {% endif %}
  29. serviceAccountName: metrics-server
  30. containers:
  31. - name: metrics-server
  32. image: {{ metrics_server_image_repo }}:{{ metrics_server_image_tag }}
  33. command:
  34. - /metrics-server
  35. {% if metrics_server_kubelet_preferred_address_types %}
  36. - --kubelet-preferred-address-types={{ metrics_server_kubelet_preferred_address_types }}
  37. {% endif %}
  38. {% if metrics_server_kubelet_insecure_tls %}
  39. - --kubelet-insecure-tls
  40. {% endif %}
  41. - --metric-resolution={{ metrics_server_metric_resolution }}
  42. ports:
  43. - containerPort: 443
  44. name: https
  45. protocol: TCP
  46. livenessProbe:
  47. failureThreshold: 3
  48. httpGet:
  49. path: /healthz
  50. port: https
  51. scheme: HTTPS
  52. initialDelaySeconds: 30
  53. periodSeconds: 30
  54. successThreshold: 1
  55. timeoutSeconds: 10
  56. readinessProbe:
  57. failureThreshold: 3
  58. httpGet:
  59. path: /healthz
  60. port: 443
  61. scheme: HTTPS
  62. initialDelaySeconds: 30
  63. periodSeconds: 30
  64. successThreshold: 1
  65. timeoutSeconds: 10
  66. securityContext:
  67. # Currently non root is not supported:
  68. # https://github.com/kubernetes-incubator/metrics-server/issues/37
  69. #
  70. # runAsNonRoot: true
  71. # runAsUser: 65534
  72. capabilities:
  73. drop:
  74. - ALL
  75. add:
  76. - NET_BIND_SERVICE
  77. - name: metrics-server-nanny
  78. image: {{ addon_resizer_image_repo }}:{{ addon_resizer_image_tag }}
  79. resources:
  80. limits:
  81. cpu: {{ addon_resizer_limits_cpu }}
  82. memory: {{ addon_resizer_limits_memory }}
  83. requests:
  84. cpu: {{ addon_resizer_requests_cpu }}
  85. memory: {{ addon_resizer_requests_memory }}
  86. env:
  87. - name: MY_POD_NAME
  88. valueFrom:
  89. fieldRef:
  90. fieldPath: metadata.name
  91. - name: MY_POD_NAMESPACE
  92. valueFrom:
  93. fieldRef:
  94. fieldPath: metadata.namespace
  95. volumeMounts:
  96. - name: metrics-server-config-volume
  97. mountPath: /etc/config
  98. command:
  99. - /pod_nanny
  100. - --config-dir=/etc/config
  101. - --cpu={{ metrics_server_cpu }}
  102. - --extra-cpu=0.5m
  103. - --memory={{ metrics_server_memory }}
  104. - --extra-memory={{ metrics_server_memory_per_node }}
  105. - --threshold=5
  106. - --deployment=metrics-server
  107. - --container=metrics-server
  108. - --poll-period=300000
  109. - --estimator=exponential
  110. # Specifies the smallest cluster (defined in number of nodes)
  111. # resources will be scaled to.
  112. - --minClusterSize={{ metrics_server_min_cluster_size }}
  113. volumes:
  114. - name: metrics-server-config-volume
  115. configMap:
  116. name: metrics-server-config
  117. {% if not masters_are_not_tainted %}
  118. tolerations:
  119. - key: node-role.kubernetes.io/master
  120. effect: NoSchedule
  121. - key: "CriticalAddonsOnly"
  122. operator: "Exists"
  123. {% endif %}
  124. affinity:
  125. nodeAffinity:
  126. preferredDuringSchedulingIgnoredDuringExecution:
  127. - weight: 100
  128. preference:
  129. matchExpressions:
  130. - key: node-role.kubernetes.io/master
  131. operator: In
  132. values:
  133. - ""