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 }}
|
|
|
|
annotations:
|
2020-05-28 05:02:02 +08:00
|
|
|
seccomp.security.alpha.kubernetes.io/pod: 'runtime/default'
|
2018-11-23 16:36:21 +08:00
|
|
|
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
|
|
|
- --logtostderr
|
|
|
|
- --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 %}
|
|
|
|
- --kubelet-insecure-tls
|
|
|
|
{% 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
|
|
|
|
runAsGroup: 10001
|
|
|
|
runAsNonRoot: true
|
|
|
|
runAsUser: 10001
|
2022-01-08 00:18:33 +08:00
|
|
|
allowPrivilegeEscalation: false
|
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: {}
|
2018-11-23 16:36:21 +08:00
|
|
|
{% if not masters_are_not_tainted %}
|
|
|
|
tolerations:
|
2019-04-17 22:58:06 +08:00
|
|
|
- key: node-role.kubernetes.io/master
|
2018-11-23 16:36:21 +08:00
|
|
|
effect: NoSchedule
|
2021-01-22 00:13:03 +08:00
|
|
|
- key: node-role.kubernetes.io/control-plane
|
|
|
|
effect: NoSchedule
|
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:
|
|
|
|
- kube-system
|