2018-11-23 16:36:21 +08:00
|
|
|
---
|
2019-09-11 03:06:55 +08:00
|
|
|
apiVersion: apps/v1
|
2018-11-23 16:36:21 +08:00
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: metrics-server
|
|
|
|
namespace: kube-system
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: metrics-server
|
|
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
|
|
version: {{ metrics_server_version }}
|
|
|
|
spec:
|
2022-12-07 10:22:38 +08:00
|
|
|
replicas: {{ metrics_server_replicas }}
|
2018-11-23 16:36:21 +08:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: metrics-server
|
|
|
|
version: {{ metrics_server_version }}
|
2021-08-12 23:19:48 +08:00
|
|
|
strategy:
|
|
|
|
rollingUpdate:
|
|
|
|
maxUnavailable: 0
|
2018-11-23 16:36:21 +08:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
name: metrics-server
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: metrics-server
|
|
|
|
version: {{ metrics_server_version }}
|
|
|
|
spec:
|
|
|
|
priorityClassName: system-cluster-critical
|
|
|
|
serviceAccountName: metrics-server
|
2022-11-06 18:38:15 +08:00
|
|
|
hostNetwork: {{ metrics_server_host_network | default(false) }}
|
2018-11-23 16:36:21 +08:00
|
|
|
containers:
|
|
|
|
- name: metrics-server
|
|
|
|
image: {{ metrics_server_image_repo }}:{{ metrics_server_image_tag }}
|
2020-05-11 18:55:50 +08:00
|
|
|
imagePullPolicy: {{ k8s_image_pull_policy }}
|
2021-08-12 23:19:48 +08:00
|
|
|
args:
|
2019-04-26 15:44:26 +08:00
|
|
|
- --cert-dir=/tmp
|
2022-01-08 00:18:33 +08:00
|
|
|
- --secure-port={{ metrics_server_container_port }}
|
2018-11-23 16:36:21 +08:00
|
|
|
{% if metrics_server_kubelet_preferred_address_types %}
|
|
|
|
- --kubelet-preferred-address-types={{ metrics_server_kubelet_preferred_address_types }}
|
|
|
|
{% endif %}
|
2021-01-19 21:45:44 +08:00
|
|
|
- --kubelet-use-node-status-port
|
2018-11-23 16:36:21 +08:00
|
|
|
{% if metrics_server_kubelet_insecure_tls %}
|
2023-06-03 09:16:40 +08:00
|
|
|
- --kubelet-insecure-tls=true
|
2018-11-23 16:36:21 +08:00
|
|
|
{% endif %}
|
|
|
|
- --metric-resolution={{ metrics_server_metric_resolution }}
|
|
|
|
ports:
|
2022-01-08 00:18:33 +08:00
|
|
|
- containerPort: {{ metrics_server_container_port }}
|
2018-11-23 16:36:21 +08:00
|
|
|
name: https
|
|
|
|
protocol: TCP
|
2019-04-26 15:44:26 +08:00
|
|
|
volumeMounts:
|
|
|
|
- name: tmp
|
|
|
|
mountPath: /tmp
|
2018-11-23 16:36:21 +08:00
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
2021-08-12 23:19:48 +08:00
|
|
|
path: /livez
|
2018-11-23 16:36:21 +08:00
|
|
|
port: https
|
|
|
|
scheme: HTTPS
|
2021-08-12 23:19:48 +08:00
|
|
|
periodSeconds: 10
|
|
|
|
failureThreshold: 3
|
|
|
|
initialDelaySeconds: 40
|
2018-11-23 16:36:21 +08:00
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
2021-08-12 23:19:48 +08:00
|
|
|
path: /readyz
|
2019-04-26 15:44:26 +08:00
|
|
|
port: https
|
2018-11-23 16:36:21 +08:00
|
|
|
scheme: HTTPS
|
2021-08-12 23:19:48 +08:00
|
|
|
periodSeconds: 10
|
|
|
|
failureThreshold: 3
|
|
|
|
initialDelaySeconds: 40
|
2018-11-23 16:36:21 +08:00
|
|
|
securityContext:
|
2019-04-26 15:44:26 +08:00
|
|
|
readOnlyRootFilesystem: true
|
|
|
|
runAsNonRoot: true
|
2023-04-26 19:10:16 +08:00
|
|
|
runAsUser: 1000
|
2022-01-08 00:18:33 +08:00
|
|
|
allowPrivilegeEscalation: false
|
2023-04-26 19:10:16 +08:00
|
|
|
seccompProfile:
|
|
|
|
type: RuntimeDefault
|
|
|
|
capabilities:
|
|
|
|
drop:
|
|
|
|
- ALL
|
2020-09-10 18:46:02 +08:00
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: {{ metrics_server_limits_cpu }}
|
|
|
|
memory: {{ metrics_server_limits_memory }}
|
|
|
|
requests:
|
|
|
|
cpu: {{ metrics_server_requests_cpu }}
|
|
|
|
memory: {{ metrics_server_requests_memory }}
|
2018-11-23 16:36:21 +08:00
|
|
|
volumes:
|
2019-04-26 15:44:26 +08:00
|
|
|
- name: tmp
|
|
|
|
emptyDir: {}
|
2023-04-26 15:30:16 +08:00
|
|
|
{% if not masters_are_not_tainted or metrics_server_extra_tolerations is defined %}
|
2018-11-23 16:36:21 +08:00
|
|
|
tolerations:
|
2023-04-26 15:30:16 +08:00
|
|
|
{% if not masters_are_not_tainted %}
|
2021-01-22 00:13:03 +08:00
|
|
|
- key: node-role.kubernetes.io/control-plane
|
|
|
|
effect: NoSchedule
|
2023-04-26 15:30:16 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if metrics_server_extra_tolerations is defined %}
|
|
|
|
{{ metrics_server_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
|
|
|
|
{% endif %}
|
2018-11-23 16:36:21 +08:00
|
|
|
{% endif %}
|
|
|
|
affinity:
|
2022-12-07 10:22:38 +08:00
|
|
|
podAntiAffinity:
|
2018-11-23 16:36:21 +08:00
|
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- weight: 100
|
2022-12-07 10:22:38 +08:00
|
|
|
podAffinityTerm:
|
|
|
|
labelSelector:
|
|
|
|
matchExpressions:
|
|
|
|
- key: app.kubernetes.io/name
|
|
|
|
operator: In
|
|
|
|
values:
|
|
|
|
- metrics-server
|
|
|
|
topologyKey: kubernetes.io/hostname
|
|
|
|
namespaces:
|
2023-02-06 17:35:16 +08:00
|
|
|
- kube-system
|
2023-04-26 15:30:16 +08:00
|
|
|
{% if metrics_server_extra_affinity is defined %}
|
|
|
|
{{ metrics_server_extra_affinity | to_nice_yaml | indent(width=8) }}
|
|
|
|
{% endif %}
|
|
|
|
{% if metrics_server_nodeselector is defined %}
|
|
|
|
nodeSelector:
|
|
|
|
{{ metrics_server_nodeselector | to_nice_yaml | indent(width=8) }}
|
|
|
|
{% endif %}
|