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

Add kube-prom-stack exporters #1284

Merged
merged 3 commits into from
Jul 30, 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/opentelemetry-kube-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: opentelemetry-kube-stack
version: 0.0.12
version: 0.0.13
description: |
OpenTelemetry Quickstart chart for Kubernetes.
Installs an operator and collector for an easy way to get started with Kubernetes observability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: OpAMPBridge
metadata:
name: example
labels:
helm.sh/chart: opentelemetry-kube-stack-0.0.12
helm.sh/chart: opentelemetry-kube-stack-0.0.13
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-cluster-stats
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.0.12
helm.sh/chart: opentelemetry-kube-stack-0.0.13
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
opentelemetry.io/opamp-reporting: "true"
Expand Down Expand Up @@ -189,7 +189,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.0.12
helm.sh/chart: opentelemetry-kube-stack-0.0.13
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
opentelemetry.io/opamp-reporting: "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kind: Instrumentation
metadata:
name: example
labels:
helm.sh/chart: opentelemetry-kube-stack-0.0.12
helm.sh/chart: opentelemetry-kube-stack-0.0.13
app.kubernetes.io/version: "0.103.0"
app.kubernetes.io/managed-by: Helm
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Prometheus Replacement example
This example contains files to allow a user to replace an installation of kube-prometheus-stack. The opentelemetry-kube-stack chart aims to make the replacement process straightforward by utilizing the target allocator to pull any servicemonitors and podmonitors.

> [!INFO]
> This chart has most of the same configurations as the kube-prometheus-stack chart, but requires that kubelet monitoring is done via a manual scrape config. This is because of how the prometheus-operator manages endpoints for the Kubelet service. If you'd like to avoid a scrape-config altogether, it's recommended to use the kubelet receiver in the opentelemetry collector.
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
# This is used for scrape kubelet
{{- if .kubelet.enabled }}
- authorization:
credentials_file: "/var/run/secrets/kubernetes.io/serviceaccount/token"
type: Bearer
follow_redirects: true
honor_labels: {{ .kubelet.serviceMonitor.honorLabels }}
honor_timestamps: {{ .kubelet.serviceMonitor.honorTimestamps }}
job_name: serviceMonitor/{{ .namespace }}/{{ .Chart.Name }}-kubelet/0
kubernetes_sd_configs:
- follow_redirects: true
kubeconfig_file: ''
role: node
metrics_path: "/metrics"
relabel_configs:
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- job
target_label: __tmp_prometheus_job_name
- action: replace
replacement: "kubelet"
target_label: job
- action: replace
regex: "(.*)"
replacement: "${1}"
separator: ";"
source_labels:
- __meta_kubernetes_node_name
target_label: node
- action: replace
regex: "(.*)"
replacement: https-metrics
separator: ";"
target_label: endpoint
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- __metrics_path__
target_label: metrics_path
- action: hashmod
modulus: 1
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- __address__
target_label: __tmp_hash
- action: keep
regex: "$(SHARD)"
replacement: "$1"
separator: ";"
source_labels:
- __tmp_hash
{{- if .kubelet.serviceMonitor.https }}
scheme: https
{{- else }}
schema: http
{{- end }}
scrape_interval: {{ .kubelet.serviceMonitor.interval | default "30s" }}
scrape_timeout: {{ .kubelet.serviceMonitor.scrapeTimeout | default "10s" }}
tls_config:
ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify: true
{{- if .kubelet.serviceMonitor.cAdvisor }}
- authorization:
credentials_file: "/var/run/secrets/kubernetes.io/serviceaccount/token"
type: Bearer
follow_redirects: true
honor_labels: true
honor_timestamps: true
job_name: serviceMonitor/{{ .namespace }}/{{ .Chart.Name }}-kubelet/1
kubernetes_sd_configs:
- follow_redirects: true
kubeconfig_file: ''
role: node
metric_relabel_configs:
- action: drop
regex: container_cpu_(cfs_throttled_seconds_total|load_average_10s|system_seconds_total|user_seconds_total)
replacement: "$1"
separator: ";"
source_labels:
- __name__
- action: drop
regex: container_fs_(io_current|io_time_seconds_total|io_time_weighted_seconds_total|reads_merged_total|sector_reads_total|sector_writes_total|writes_merged_total)
replacement: "$1"
separator: ";"
source_labels:
- __name__
- action: drop
regex: container_memory_(mapped_file|swap)
replacement: "$1"
separator: ";"
source_labels:
- __name__
- action: drop
regex: container_(file_descriptors|tasks_state|threads_max)
replacement: "$1"
separator: ";"
source_labels:
- __name__
- action: drop
regex: container_spec.*
replacement: "$1"
separator: ";"
source_labels:
- __name__
- action: drop
regex: ".+;"
replacement: "$1"
separator: ";"
source_labels:
- id
- pod
metrics_path: "/metrics/cadvisor"
relabel_configs:
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- job
target_label: __tmp_prometheus_job_name
- action: replace
replacement: "kubelet"
target_label: job
- action: replace
regex: "(.*)"
replacement: "${1}"
separator: ";"
source_labels:
- __meta_kubernetes_node_name
target_label: node
- action: replace
regex: "(.*)"
replacement: https-metrics
separator: ";"
target_label: endpoint
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- __metrics_path__
target_label: metrics_path
- action: hashmod
modulus: 1
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- __address__
target_label: __tmp_hash
- action: keep
regex: "$(SHARD)"
replacement: "$1"
separator: ";"
source_labels:
- __tmp_hash
{{- if .kubelet.serviceMonitor.https }}
scheme: https
{{- else }}
schema: http
{{- end }}
scrape_interval: {{ .kubelet.serviceMonitor.scrapeTimeout | default "30s" }}
scrape_timeout: 10s
tls_config:
ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify: true

{{- end }}
{{- if .kubelet.serviceMonitor.probes }}
- authorization:
credentials_file: "/var/run/secrets/kubernetes.io/serviceaccount/token"
type: Bearer
follow_redirects: true
honor_labels: true
honor_timestamps: true
job_name: serviceMonitor/{{ .namespace }}/{{ .Chart.Name }}-kubelet/2
kubernetes_sd_configs:
- follow_redirects: true
kubeconfig_file: ''
role: node
metrics_path: "/metrics/probes"
relabel_configs:
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- job
target_label: __tmp_prometheus_job_name
- action: replace
replacement: "kubelet"
target_label: job
- action: replace
regex: "(.*)"
replacement: "${1}"
separator: ";"
source_labels:
- __meta_kubernetes_node_name
target_label: node
- action: replace
regex: "(.*)"
replacement: https-metrics
separator: ";"
target_label: endpoint
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- __metrics_path__
target_label: metrics_path
- action: hashmod
modulus: 1
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- __address__
target_label: __tmp_hash
- action: keep
regex: "$(SHARD)"
replacement: "$1"
separator: ";"
source_labels:
- __tmp_hash
{{- if .kubelet.serviceMonitor.https }}
scheme: https
{{- else }}
schema: http
{{- end }}
scrape_interval: {{ .kubelet.serviceMonitor.scrapeTimeout | default "30s" }}
scrape_timeout: 10s
tls_config:
ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify: true
{{- end }}
{{- end }}
Loading
Loading