forked from kubernetes-sigs/usage-metrics-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
collector.yaml
391 lines (388 loc) · 13.3 KB
/
collector.yaml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
kind: MetricsPrometheusCollector
prefix: kube_usage
# preComputeMetrics configures pre-computing and caching metrics
# to reduce response latency
preComputeMetrics:
enabled: true
# exitOnConfigChange exits the collector if the collector config changes
exitOnConfigChange: true
# cacheOptions configures the informer cache
cacheOptions:
unsafeDisableDeepCopy: false
dropAnnotations:
- "kubectl.kubernetes.io/last-applied-configuration"
#
# utilizationServer configures how utilization metrics are pushed
# to the collector
#
utilizationServer:
# when logging missing utilization metrics for containers, consider nodes unhealthy
# if they have any of these conditions. conditions are ordered by precedence
# since multiple conditions may match
unhealthyNodeConditions:
- type: "Ready"
status: "Unknown"
- type: "Ready"
status: "False"
protoBindPort: 9090 # accept pushed metrics on this grpc port
jsonProtoBindPort: 8090 # perform health checks on this json port
# check for expired responses every 10 minutes, and remove
# them from the map
expireReponsesFrequencyDuration: 10m
# consider responses expired and stop exporting them after 5 minutes
responseTTLDuration: 5m
# find the pods that should be sending samples
# use these to export health metrics about why we may be missing utilization
# data for containers (e.g. the sampler pod is Terminating)
samplerPodLabels: {"app": "metrics-node-sampler"}
samplerNamespaceName: "usage-metrics-collector"
#
# resources defines the type of compute resources to collect metrics for
#
resources:
cpu: "cpu_cores" # use "cpu_cores" as the metrics suffix for "cpu" resources
memory: "memory_bytes"
items: "items" # count of objects
#
# extensions defines extension metric labels read from Kubernetes objects
#
extensions:
# podLabels:
# - name: example_label_from_pod_annotation
# annotation: "ANNOTATION_NAME"
# - name: example_label_from__podlabel
# label: "LABEL_NAME"
# namespaceLabels:
# - name: example_label_from_namespace_annotation
# annotation: "ANNOTATION_NAME"
# - name: example_label_from_namespace_label
# label: "LABEL_NAME"
# nodeLabels:
# - name: example_label_from_node_annotation
# annotation: "ANNOTATION_NAME"
# - name: example_label_from_node_label
# label: "LABEL_NAME"
#
# nodeTaints set metrics labels derived from node taints.
#
nodeTaints:
# set a metric label "node_no_schedule" if no-schedule taints are present
- name: node_no_schedule # label name
value: true # label value if taints present
negativeValue: false # label value if taints not present
effects:
- operator: In
values: [ NoSchedule, NoExecute ]
#
# Metrics
#
aggregations:
#
# Node Capacity Metrics
#
# Node capacity metrics aggregate node capacity, requests and limits.
# They are useful for understanding how much of each cluster's capacity
# has been consumed by running pods.
#
- sources:
type: "node"
node:
- "node_capacity" # total capacity as reported by the to the apiserver
- "node_allocatable" # schedulable capacity as reported by the to the apiserver
- "node_requests" # total active pod requests scheduled to the node
- "node_limits" # total active pod limits scheduled to the node
levels:
# kube_usage_node_sum_node_allocatable_cpu_cores{}
# kube_usage_node_sum_node_allocatable_memory_bytes{}
# kube_usage_node_sum_node_requests_cpu_cores{}
# kube_usage_node_sum_node_requests_memory_bytes{}
# kube_usage_node_sum_node_limits_cpu_cores{}
# kube_usage_node_sum_node_limits_memory_bytes{}
# kube_usage_node_sum_node_capacity_cpu_cores{}
# kube_usage_node_sum_node_capacity_memory_bytes{}
- mask:
name: "node"
builtIn:
exported_node: true
extensions:
node_no_schedule: true
operation: "sum"
# kube_usage_nodecluster_sum_node_allocatable_cpu_cores{}
# kube_usage_nodecluster_sum_node_allocatable_memory_bytes{}
# kube_usage_nodecluster_sum_node_requests_cpu_cores{}
# kube_usage_nodecluster_sum_node_requests_memory_bytes{}
# kube_usage_nodecluster_sum_node_limits_cpu_cores{}
# kube_usage_nodecluster_sum_node_limits_memory_bytes{}
# kube_usage_nodecluster_sum_node_capacity_cpu_cores{}
# kube_usage_nodecluster_sum_node_capacity_memory_bytes{}
- mask:
name: "nodecluster"
extensions:
node_no_schedule: true
operation: "sum"
- sources:
type: "node"
node:
- "node_capacity"
- "node_allocatable"
- "node_requests"
- "node_limits"
levels:
# kube_usage_nodecluster_hist_node_allocatable_cpu_cores{}
# kube_usage_nodecluster_hist_node_allocatable_memory_bytes{}
# kube_usage_nodecluster_hist_node_requests_cpu_cores{}
# kube_usage_nodecluster_hist_node_requests_memory_bytes{}
# kube_usage_nodecluster_hist_node_limits_cpu_cores{}
# kube_usage_nodecluster_hist_node_limits_memory_bytes{}
# kube_usage_nodecluster_hist_node_capacity_cpu_cores{}
# kube_usage_nodecluster_hist_node_capacity_memory_bytes{}
- mask:
name: "nodecluster"
extensions:
node_no_schedule: true
operation: "hist"
histogramBuckets:
cpu_cores: [0.1, 0.25, 0.5, 1, 2, 4, 6, 8, 16, 32, 64, 128, 256]
memory_bytes: [4000000000, 8000000000, 16000000000, 32000000000, 64000000000, 128000000000, 256000000000, 512000000000]
#
# Container Utilization Avg Metrics
#
# Container utilization avg metrics aggregate container metrics using the average
# value of samples of the node scrape window (5m). The per-container values
# are aggregated into the total workload utilization.
#
- sources:
type: "container"
container: [ "utilization" ]
levels:
# not exported -- aggregate the 1s samples to an average per-container
- mask:
name: "container"
builtIn:
exported_container: true
exported_namespace: true
exported_pod: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
exported_node: true
operation: "avg" # use the "avg" operation since we are trying to get the sum in the workload
noExport: true # don't export this to prometheus, it is too granular
# kube_usage_workload_sum_utilization_cpu_cores{}
# kube_usage_workload_sum_utilization_memory_bytes{}
- mask:
name: "workload"
builtIn:
exported_namespace: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
operation: "sum"
# kube_usage_namespace_sum_utilization_cpu_cores{}
# kube_usage_namespace_sum_utilization_memory_bytes{}
- mask:
name: "namespace"
builtIn:
exported_namespace: true
priority_class: true
operation: "sum"
# kube_usage_cluster_sum_utilization_cpu_cores{}
# kube_usage_cluster_sum_utilization_memory_bytes{}
- mask:
name: "cluster"
builtIn:
priority_class: true
operation: "sum"
#
# Workload Utilization P95 Metrics
#
# Workload utilization p95 metrics aggregate workload container utilization samples
# using the p95 of the samples over the node container scrape window (5m).
#
- sources:
type: "container"
container: [ "utilization" ]
levels:
# kube_usage_workload_p95_utilization_cpu_cores{}
# kube_usage_workload_p95_utilization_memory_bytes{}
- mask:
name: "workload"
builtIn:
exported_container: true # keep the individual container names within each pod, but not the pod names
exported_namespace: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
operation: "p95"
#
# Workload Utilization Max Metrics
#
# Workload utilization max metrics aggregate workload container utilization samples
# using the max of the samples over the node container scrape window (5m).
#
- sources:
type: "container"
container: [ "utilization" ]
levels:
# kube_usage_workload_max_utilization_cpu_cores{}
# kube_usage_workload_max_utilization_memory_bytes{}
- mask:
name: "workload"
builtIn:
exported_container: true # keep the individual container names within each pod, but not the pod names
exported_namespace: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
operation: "max"
#
# Workload Utilization Median Metrics
#
# Workload utilization median metrics aggregate workload container utilization samples
# using the median of the samples over the node container scrape window (5m).
#
- sources:
type: "container"
container: [ "utilization", "requests_allocated", "limits_allocated" ]
levels:
# kube_usage_workload_median_utilization_cpu_cores{}
# kube_usage_workload_median_utilization_memory_bytes{}
# kube_usage_workload_median_requests_allocated_cpu_cores{}
# kube_usage_workload_median_requests_allocated_memory_bytes{}
# kube_usage_workload_median_limits_allocated_cpu_cores{}
# kube_usage_workload_median_limits_allocated_memory_bytes{}
- mask:
name: "workload"
builtIn:
exported_container: true # keep the individual container names within each pod, but not the pod names
exported_namespace: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
operation: "median"
#
# Workload Utilization Avg Metrics
#
# Workload utilization avg metrics aggregate workload container utilization samples
# using the avg of the samples over the node container scrape window (5m).
#
- sources:
type: "container"
container: [ "utilization" ]
levels:
# kube_usage_workload_avg_utilization_cpu_cores{}
# kube_usage_workload_avg_utilization_memory_bytes{}
- mask:
name: "workload"
builtIn:
exported_container: true # keep the individual container names within each pod, but not the pod names
exported_namespace: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
operation: "avg"
#
# Workload Capacity Metrics
#
# Workload capacity metrics aggregate the resources consumed by containers as
# requests / limits in the cluster.
#
- sources:
type: "container"
container: [ "requests_allocated", "limits_allocated" ]
levels:
# kube_usage_workload_sum_requests_allocated_cpu_cores{}
# kube_usage_workload_sum_requests_allocated_memory_bytes{}
# kube_usage_workload_sum_limits_allocated_cpu_cores{}
# kube_usage_workload_sum_limits_allocated_memory_bytes{}
- mask:
name: "workload"
builtIn:
exported_container: true # keep the individual container names within each pod, but not the pod names
exported_namespace: true
workload_name: true
workload_kind: true
workload_api_group: true
workload_api_version: true
app: true
priority_class: true
operation: "sum"
# kube_usage_namespace_sum_requests_allocated_cpu_cores{}
# kube_usage_namespace_sum_requests_allocated_memory_bytes{}
# kube_usage_namespace_sum_limits_allocated_cpu_cores{}
# kube_usage_namespace_sum_limits_allocated_memory_bytes{}
- mask:
name: "namespace"
builtIn:
exported_namespace: true
priority_class: true
operation: "sum"
# kube_usage_cluster_sum_requests_allocated_cpu_cores{}
# kube_usage_cluster_sum_requests_allocated_memory_bytes{}
# kube_usage_cluster_sum_limits_allocated_cpu_cores{}
# kube_usage_cluster_sum_limits_allocated_memory_bytes{}
- mask:
name: "cluster"
builtIn:
priority_class: true
operation: "sum"
#
# Namespace Quota Metrics
#
# Namespace quota metrics aggregate the requests / limits quota for each namespace.
#
- sources:
type: "quota"
quota:
- "requests_quota_hard"
- "requests_quota_used"
- "limits_quota_hard"
- "limits_quota_used"
levels:
# kube_usage_namespace_sum_requests_quota_hard_cpu_cores{}
# kube_usage_namespace_sum_requests_quota_hard_memory_bytes{}
# kube_usage_namespace_sum_requests_quota_used_cpu_cores{}
# kube_usage_namespace_sum_requests_quota_used_memory_bytes{}
# kube_usage_namespace_sum_limits_quota_hard_cpu_cores{}
# kube_usage_namespace_sum_limits_quota_hard_memory_bytes{}
# kube_usage_namespace_sum_limits_quota_used_cpu_cores{}
# kube_usage_namespace_sum_limits_quota_used_memory_bytes{}
- mask:
name: "namespace"
builtIn:
exported_namespace: true
priority_class: true
storage_class: true
operation: "sum"
# kube_usage_cluster_sum_requests_quota_hard_cpu_cores{}
# kube_usage_cluster_sum_requests_quota_hard_memory_bytes{}
# kube_usage_cluster_sum_requests_quota_used_cpu_cores{}
# kube_usage_cluster_sum_requests_quota_used_memory_bytes{}
# kube_usage_cluster_sum_limits_quota_hard_cpu_cores{}
# kube_usage_cluster_sum_limits_quota_hard_memory_bytes{}
# kube_usage_cluster_sum_limits_quota_used_cpu_cores{}
# kube_usage_cluster_sum_limits_quota_used_memory_bytes{}
- mask:
name: "cluster"
builtIn:
priority_class: true
storage_class: true
operation: "sum"