mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-02 21:30:46 +09:00
fix(monitoring): give the kube-apiserver scrape its own size limit
kube-apiserver's /metrics grows with the number of resources and CRDs,
and on a full install it outgrows the global 32MB
-promscrape.maxScrapeSize. vmagent then refuses every scrape of it, so
up is 0 and KubeAPIDown and TargetDown fire against a healthy API
server while every rule over API server metrics goes blind.
Set max_scrape_size on the apiserver endpoint instead of raising the
global flag. vmagent uses it in place of the flag for that job only, so
the 32MB guard for every other target stays as it is. vmagent reads the
whole uncompressed body into memory even with streamParse, so the
per-job value is a memory ceiling and stays finite (128MB), exposed as
vmagent.apiserverMaxScrapeSize.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
(cherry picked from commit 4a268f6c01)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
857d557a46
commit
9658de6ef2
3 files changed
+53
No files matched your search
@@ -9,6 +9,9 @@ spec:
|
||||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||
port: https
|
||||
scheme: https
|
||||
{{- with .Values.vmagent.apiserverMaxScrapeSize }}
|
||||
max_scrape_size: {{ . | quote }}
|
||||
{{- end }}
|
||||
relabelConfigs:
|
||||
- action: labeldrop
|
||||
regex: (endpoint|namespace|pod|container)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
suite: kube-apiserver scrape size limit
|
||||
|
||||
# kube-apiserver's /metrics grows with the number of resources and CRDs, and a
|
||||
# full install pushes it past the global 32MB -promscrape.maxScrapeSize. vmagent
|
||||
# then refuses every scrape of it, so up == 0 and KubeAPIDown fires on a
|
||||
# healthy API server. The apiserver endpoint carries its own max_scrape_size,
|
||||
# which replaces the global flag for that job only (upward too), so the guard
|
||||
# for every other target stays at 32MB. vmagent buffers the whole uncompressed
|
||||
# body even with streamParse, so the per-job limit is a memory ceiling and must
|
||||
# stay finite.
|
||||
release:
|
||||
name: monitoring-agents
|
||||
namespace: cozy-monitoring
|
||||
tests:
|
||||
- it: apiserver endpoint gets its own scrape size limit by default
|
||||
template: templates/apiserver-scrape.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.endpoints[0].max_scrape_size
|
||||
value: 128MB
|
||||
|
||||
- it: apiserver scrape size limit follows the value
|
||||
template: templates/apiserver-scrape.yaml
|
||||
set:
|
||||
vmagent.apiserverMaxScrapeSize: 512MB
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.endpoints[0].max_scrape_size
|
||||
value: 512MB
|
||||
|
||||
- it: an empty value falls back to the global flag
|
||||
template: templates/apiserver-scrape.yaml
|
||||
set:
|
||||
vmagent.apiserverMaxScrapeSize: ""
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.endpoints[0].max_scrape_size
|
||||
|
||||
- it: the global limit for every other target is not loosened
|
||||
template: templates/vmagent.yaml
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.extraArgs["promscrape.maxScrapeSize"]
|
||||
value: 32MB
|
||||
|
||||
@@ -283,6 +283,11 @@ vmagent:
|
||||
- http://vminsert-shortterm.{{ .Values.global.target }}.svc:8480/insert/0/prometheus
|
||||
- http://vminsert-longterm.{{ .Values.global.target }}.svc:8480/insert/0/prometheus
|
||||
extraArgs: {}
|
||||
# Replaces the global promscrape.maxScrapeSize (32MB) for the kube-apiserver
|
||||
# job only. Its /metrics grows with the number of CRDs and outgrows 32MB on a
|
||||
# full install. vmagent buffers the whole uncompressed response even with
|
||||
# streamParse, so keep this finite. An empty value falls back to the global.
|
||||
apiserverMaxScrapeSize: 128MB
|
||||
|
||||
fluent-bit:
|
||||
rbac:
|
||||
|
||||
Reference in new issue
Block a user