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.

121 lines
3.8 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. - --logtostderr
  36. - --cert-dir=/tmp
  37. - --secure-port={{ metrics_server_container_port }}
  38. {% if metrics_server_kubelet_preferred_address_types %}
  39. - --kubelet-preferred-address-types={{ metrics_server_kubelet_preferred_address_types }}
  40. {% endif %}
  41. - --kubelet-use-node-status-port
  42. {% if metrics_server_kubelet_insecure_tls %}
  43. - --kubelet-insecure-tls=true
  44. {% endif %}
  45. - --metric-resolution={{ metrics_server_metric_resolution }}
  46. ports:
  47. - containerPort: {{ metrics_server_container_port }}
  48. name: https
  49. protocol: TCP
  50. volumeMounts:
  51. - name: tmp
  52. mountPath: /tmp
  53. livenessProbe:
  54. httpGet:
  55. path: /livez
  56. port: https
  57. scheme: HTTPS
  58. periodSeconds: 10
  59. failureThreshold: 3
  60. initialDelaySeconds: 40
  61. readinessProbe:
  62. httpGet:
  63. path: /readyz
  64. port: https
  65. scheme: HTTPS
  66. periodSeconds: 10
  67. failureThreshold: 3
  68. initialDelaySeconds: 40
  69. securityContext:
  70. readOnlyRootFilesystem: true
  71. runAsNonRoot: true
  72. runAsUser: 1000
  73. allowPrivilegeEscalation: false
  74. seccompProfile:
  75. type: RuntimeDefault
  76. capabilities:
  77. drop:
  78. - ALL
  79. resources:
  80. limits:
  81. cpu: {{ metrics_server_limits_cpu }}
  82. memory: {{ metrics_server_limits_memory }}
  83. requests:
  84. cpu: {{ metrics_server_requests_cpu }}
  85. memory: {{ metrics_server_requests_memory }}
  86. volumes:
  87. - name: tmp
  88. emptyDir: {}
  89. {% if not masters_are_not_tainted or metrics_server_extra_tolerations is defined %}
  90. tolerations:
  91. {% if not masters_are_not_tainted %}
  92. - key: node-role.kubernetes.io/master
  93. effect: NoSchedule
  94. - key: node-role.kubernetes.io/control-plane
  95. effect: NoSchedule
  96. {% endif %}
  97. {% if metrics_server_extra_tolerations is defined %}
  98. {{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
  99. {% endif %}
  100. {% endif %}
  101. affinity:
  102. podAntiAffinity:
  103. preferredDuringSchedulingIgnoredDuringExecution:
  104. - weight: 100
  105. podAffinityTerm:
  106. labelSelector:
  107. matchExpressions:
  108. - key: app.kubernetes.io/name
  109. operator: In
  110. values:
  111. - metrics-server
  112. topologyKey: kubernetes.io/hostname
  113. namespaces:
  114. - kube-system
  115. {% if metrics_server_extra_affinity is defined %}
  116. {{ metrics_server_extra_affinity | to_nice_yaml | indent(width=8) }}
  117. {% endif %}
  118. {% if metrics_server_nodeselector is defined %}
  119. nodeSelector:
  120. {{ metrics_server_nodeselector | to_nice_yaml | indent(width=8) }}
  121. {% endif %}