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.

118 lines
3.7 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. addonmanager.kubernetes.io/mode: Reconcile
  10. version: {{ metrics_server_version }}
  11. spec:
  12. replicas: {{ metrics_server_replicas }}
  13. selector:
  14. matchLabels:
  15. app.kubernetes.io/name: metrics-server
  16. version: {{ metrics_server_version }}
  17. strategy:
  18. rollingUpdate:
  19. maxUnavailable: 0
  20. template:
  21. metadata:
  22. name: metrics-server
  23. labels:
  24. app.kubernetes.io/name: metrics-server
  25. version: {{ metrics_server_version }}
  26. spec:
  27. priorityClassName: system-cluster-critical
  28. serviceAccountName: metrics-server
  29. hostNetwork: {{ metrics_server_host_network | default(false) }}
  30. containers:
  31. - name: metrics-server
  32. image: {{ metrics_server_image_repo }}:{{ metrics_server_image_tag }}
  33. imagePullPolicy: {{ k8s_image_pull_policy }}
  34. args:
  35. - --cert-dir=/tmp
  36. - --secure-port={{ metrics_server_container_port }}
  37. {% if metrics_server_kubelet_preferred_address_types %}
  38. - --kubelet-preferred-address-types={{ metrics_server_kubelet_preferred_address_types }}
  39. {% endif %}
  40. - --kubelet-use-node-status-port
  41. {% if metrics_server_kubelet_insecure_tls %}
  42. - --kubelet-insecure-tls=true
  43. {% endif %}
  44. - --metric-resolution={{ metrics_server_metric_resolution }}
  45. ports:
  46. - containerPort: {{ metrics_server_container_port }}
  47. name: https
  48. protocol: TCP
  49. volumeMounts:
  50. - name: tmp
  51. mountPath: /tmp
  52. livenessProbe:
  53. httpGet:
  54. path: /livez
  55. port: https
  56. scheme: HTTPS
  57. periodSeconds: 10
  58. failureThreshold: 3
  59. initialDelaySeconds: 40
  60. readinessProbe:
  61. httpGet:
  62. path: /readyz
  63. port: https
  64. scheme: HTTPS
  65. periodSeconds: 10
  66. failureThreshold: 3
  67. initialDelaySeconds: 40
  68. securityContext:
  69. readOnlyRootFilesystem: true
  70. runAsNonRoot: true
  71. runAsUser: 1000
  72. allowPrivilegeEscalation: false
  73. seccompProfile:
  74. type: RuntimeDefault
  75. capabilities:
  76. drop:
  77. - ALL
  78. resources:
  79. limits:
  80. cpu: {{ metrics_server_limits_cpu }}
  81. memory: {{ metrics_server_limits_memory }}
  82. requests:
  83. cpu: {{ metrics_server_requests_cpu }}
  84. memory: {{ metrics_server_requests_memory }}
  85. volumes:
  86. - name: tmp
  87. emptyDir: {}
  88. {% if not control_plane_nodes_are_not_tainted or metrics_server_extra_tolerations is defined %}
  89. tolerations:
  90. {% if not control_plane_nodes_are_not_tainted %}
  91. - key: node-role.kubernetes.io/control-plane
  92. effect: NoSchedule
  93. {% endif %}
  94. {% if metrics_server_extra_tolerations is defined %}
  95. {{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
  96. {% endif %}
  97. {% endif %}
  98. affinity:
  99. podAntiAffinity:
  100. preferredDuringSchedulingIgnoredDuringExecution:
  101. - weight: 100
  102. podAffinityTerm:
  103. labelSelector:
  104. matchExpressions:
  105. - key: app.kubernetes.io/name
  106. operator: In
  107. values:
  108. - metrics-server
  109. topologyKey: kubernetes.io/hostname
  110. namespaces:
  111. - kube-system
  112. {% if metrics_server_extra_affinity is defined %}
  113. {{ metrics_server_extra_affinity | to_nice_yaml | indent(width=8) }}
  114. {% endif %}
  115. {% if metrics_server_nodeselector is defined %}
  116. nodeSelector:
  117. {{ metrics_server_nodeselector | to_nice_yaml | indent(width=8) }}
  118. {% endif %}