Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] Feat: Improve cAdvisor metrics scrape #5063

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 67.1.0
version: 67.2.0
appVersion: v0.79.0
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ spec:
path: /metrics/cadvisor
{{- if .Values.kubelet.serviceMonitor.interval }}
interval: {{ .Values.kubelet.serviceMonitor.interval }}
{{- else }}
interval: {{ .Values.kubelet.serviceMonitor.cAdvisorInterval }}
{{- end }}
{{- if .Values.kubelet.serviceMonitor.proxyUrl }}
proxyUrl: {{ .Values.kubelet.serviceMonitor.proxyUrl }}
Expand All @@ -69,7 +71,11 @@ spec:
scrapeTimeout: {{ .Values.kubelet.serviceMonitor.scrapeTimeout }}
{{- end }}
honorLabels: {{ .Values.kubelet.serviceMonitor.honorLabels }}
{{- if .Values.kubelet.serviceMonitor.trackTimestampsStaleness }}
honorTimestamps: true
{{- else }}
honorTimestamps: {{ .Values.kubelet.serviceMonitor.honorTimestamps }}
{{- end }}
trackTimestampsStaleness: {{ .Values.kubelet.serviceMonitor.trackTimestampsStaleness }}
SuperQ marked this conversation as resolved.
Show resolved Hide resolved
{{- include "kube-prometheus-stack.kubelet.authConfig" . | indent 4 }}
{{- if .Values.kubelet.serviceMonitor.cAdvisorMetricRelabelings }}
Expand Down Expand Up @@ -112,6 +118,8 @@ spec:
path: {{ .Values.kubelet.serviceMonitor.resourcePath }}
SuperQ marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.kubelet.serviceMonitor.interval }}
interval: {{ .Values.kubelet.serviceMonitor.interval }}
{{- else }}
interval: {{ .Values.kubelet.serviceMonitor.resourceInterval }}
{{- end }}
{{- if .Values.kubelet.serviceMonitor.proxyUrl }}
proxyUrl: {{ .Values.kubelet.serviceMonitor.proxyUrl }}
Expand All @@ -120,7 +128,11 @@ spec:
scrapeTimeout: {{ .Values.kubelet.serviceMonitor.scrapeTimeout }}
{{- end }}
honorLabels: {{ .Values.kubelet.serviceMonitor.honorLabels }}
{{- if .Values.kubelet.serviceMonitor.trackTimestampsStaleness }}
honorTimestamps: true
{{- else }}
honorTimestamps: {{ .Values.kubelet.serviceMonitor.honorTimestamps }}
{{- end }}
trackTimestampsStaleness: {{ .Values.kubelet.serviceMonitor.trackTimestampsStaleness }}
{{- include "kube-prometheus-stack.kubelet.authConfig" . | indent 4 }}
{{- if .Values.kubelet.serviceMonitor.resourceMetricRelabelings }}
Expand Down
17 changes: 12 additions & 5 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ kubelet:

## If true, defines whether Prometheus tracks staleness of the metrics that have an explicit timestamp present in scraped data. Has no effect if `honorTimestamps` is false.
## We recommend enabling this if you want the best possible accuracy for container_ metrics scraped from cadvisor.
##
## For more details see: https://github.com/prometheus-community/helm-charts/pull/5063#issuecomment-2545374849
trackTimestampsStaleness: true

## SampleLimit defines per-scrape limit on number of scraped samples that will be accepted.
Expand Down Expand Up @@ -1362,10 +1362,6 @@ kubelet:
##
insecureSkipVerify: true

## Enable scraping /metrics/cadvisor from kubelet's service
##
cAdvisor: true

## Enable scraping /metrics/probes from kubelet's service
##
probes: true
Expand All @@ -1376,7 +1372,18 @@ kubelet:
resource: false
# From kubernetes 1.18, /metrics/resource/v1alpha1 renamed to /metrics/resource
resourcePath: "/metrics/resource/v1alpha1"
## Configure the scrape interval for resource metrics. This is configured to the default Kubelet cAdvisor
## minimum housekeeping interval in order to avoid missing samples. Note, this value is ignored
## if kubelet.serviceMonitor.interval is not empty.
resourceInterval: 10s

## Enable scraping /metrics/cadvisor from kubelet's service
##
cAdvisor: true
## Configure the scrape interval for cAdvisor. This is configured to the default Kubelet cAdvisor
## minimum housekeeping interval in order to avoid missing samples. Note, this value is ignored
## if kubelet.serviceMonitor.interval is not empty.
cAdvisorInterval: 10s
## MetricRelabelConfigs to apply to samples after scraping, but before ingestion.
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#relabelconfig
##
Expand Down
Loading