-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathdeployment.yaml
More file actions
160 lines (160 loc) · 5.23 KB
/
deployment.yaml
File metadata and controls
160 lines (160 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{{ range $rsName, $rs := .Values.remoteStorages }}
{{ if $rs.writeURL }}
{{ $writeURLs := $rs.writeURL | splitList "," }}
{{ range $replica := until ($.Values.writeReplicas | default 1 | int) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "prometheus-benchmark.fullname" $ }}-vmagent-{{ $rsName }}-replica-{{ $replica }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "prometheus-benchmark.labels" $ | nindent 4 }}
spec:
selector:
matchLabels:
job: vmagent
remote-storage-name: {{ $rsName | quote }}
{{- include "prometheus-benchmark.selectorLabels" $ | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
annotations:
checksum/nginx-cm: {{ include (print $.Template.BasePath "/vmagent/nginx-cm.yaml") $ | sha256sum }}
labels:
job: vmagent
remote-storage-name: {{ $rsName | quote }}
{{- include "prometheus-benchmark.labels" $ | nindent 8 }}
spec:
{{- with $.Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: vmagent-config-updater
image: "{{ $.Values.vmagentConfigUpdater.image }}:{{ $.Values.vmagentConfigUpdater.tag }}"
args:
- --httpListenAddr=:8436
- --targetsCount={{ $.Values.targetsCount }}
- --targetAddr=0.0.0.0:9102
- --scrapeInterval={{ $.Values.scrapeInterval }}
- --scrapeConfigUpdatePercent={{ $.Values.scrapeConfigUpdatePercent }}
- --scrapeConfigUpdateInterval={{ $.Values.scrapeConfigUpdateInterval }}
- name: vmagent
resources:
requests:
cpu: {{ $.Values.writeReplicaCPU }}
memory: {{ $.Values.writeReplicaMem }}
limits:
memory: {{ $.Values.writeReplicaMem }}
image: "victoriametrics/vmagent:{{ $.Values.vmtag }}"
args:
- --httpListenAddr=:8429
- --remoteWrite.showURL
- --promscrape.config=http://0.0.0.0:8436/api/v1/config
- --promscrape.configCheckInterval={{ $.Values.scrapeConfigUpdateInterval }}
{{- range $url := $writeURLs }}
{{- range $urlReplica := until ($rs.writeURLReplicas | default 1 | int) }}
- --remoteWrite.url={{ $url }}?extra_label=url_replica={{ $urlReplica }}
{{- end }}
{{- end }}
- --remoteWrite.tmpDataPath=/vmagent-data
- --remoteWrite.maxDiskUsagePerURL=100MiB
{{- if $.Values.writeConcurrency }}
- --remoteWrite.queues={{ $.Values.writeConcurrency }}
{{- end }}
- --remoteWrite.label=replica={{ $replica }}
- --promscrape.disableCompression
- --promscrape.noStaleMarkers
{{- if $rs.writeBearerToken }}
- --remoteWrite.bearerToken={{ $rs.writeBearerToken }}
{{- end }}
{{- if $rs.writeHeaders }}
- --remoteWrite.headers={{ $rs.writeHeaders }}
{{- end }}
{{- range $rs.vmagentExtraFlags }}
- {{ . }}
{{- end }}
{{- with $rs.vmagentExtraEnvs }}
env:
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
- name: metrics
containerPort: 8429
volumeMounts:
- mountPath: /vmagent-data
name: vmagent-data
- name: nodeexporter
image: prom/node-exporter:v1.4.0
args:
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
- --path.rootfs=/host/root
# When disabling a collector make sure its metrics aren't used
# in alerting rules (chart/files/alerts.yaml)
- --no-collector.wifi
- --no-collector.arp
- --collector.processes
- --collector.filesystem.mount-points-exclude=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/.+|run/containerd/.+|home/kubernetes/.+)($|/)
- --web.max-requests=40
- --web.listen-address=:9101
volumeMounts:
- name: proc
mountPath: /host/proc
readOnly: true
- name: sys
mountPath: /host/sys
readOnly: true
- name: root
mountPath: /host/root
mountPropagation: HostToContainer
readOnly: true
ports:
- containerPort: 9101
name: metrics
- name: nginx
image: nginx:1.23.1
args:
- nginx
- -c
- /opt/nginx/nginx.conf
ports:
- containerPort: 9102
name: nginx
volumeMounts:
- mountPath: /opt/nginx
name: nginx-cm
- mountPath: /tmp/nginx
name: nginx-cache
- mountPath: /etc/nginx
name: nginx-empty
securityContext:
fsGroup: 65534
runAsGroup: 65534
runAsNonRoot: true
runAsUser: 65534
volumes:
- name: vmagent-data
emptyDir:
medium: Memory
- name: proc
hostPath:
path: /proc
- name: sys
hostPath:
path: /sys
- name: root
hostPath:
path: /
- name: nginx-cache
emptyDir: {}
- name: nginx-cm
configMap:
name: {{ include "prometheus-benchmark.fullname" $ }}-nginx-cm
- name: nginx-empty
emptyDir: {}
---
{{ end }}
{{ end }}
{{ end }}