Skip to content
Closed
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.20.6
version: 0.20.7
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.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
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.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: agent
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down Expand Up @@ -232,7 +232,7 @@ metadata:
name: gateway
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down Expand Up @@ -365,7 +365,7 @@ metadata:
name: ingress
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
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.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down Expand Up @@ -173,7 +173,7 @@ metadata:
name: example-daemon
namespace: default
labels:
helm.sh/chart: opentelemetry-kube-stack-0.20.6
helm.sh/chart: opentelemetry-kube-stack-0.20.7
app.kubernetes.io/version: "0.154.0"
app.kubernetes.io/managed-by: Helm
release: "example"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ spec:
- "delete"
- "instrumentations,opampbridges,opentelemetrycollectors"
- "-l"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.6"
- "helm.sh/chart=opentelemetry-kube-stack-0.20.7"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,26 @@
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.
> This chart has most of the same configurations as the kube-prometheus-stack chart, but requires that kubelet monitoring is done via ScrapeConfig custom resources. This is because of how the prometheus-operator manages endpoints for the Kubelet service. If you'd like to avoid scrape configs altogether, it's recommended to use the kubelet receiver in the opentelemetry collector.

## Usage

Install the chart with this example's values file:

```bash
helm install opentelemetry-kube-stack open-telemetry/opentelemetry-kube-stack -f values.yaml
```

Then create the kubelet scrape configuration. The manifests assume the `default` namespace, so adjust the namespace fields in the file first if you installed the chart elsewhere:

```bash
kubectl apply -n default -f kubelet_scrape_configs_cr.yaml
```

The chart installs the required ScrapeConfig CRD by default through its prometheus-crds dependency (`crds.installPrometheus`).

## How kubelet scraping works here

`kubelet_scrape_configs_cr.yaml` contains ScrapeConfig custom resources for the kubelet's `/metrics`, `/metrics/cadvisor`, and `/metrics/probes` endpoints, along with a dedicated service account, token secret, and the RBAC needed to authenticate against the kubelet. The target allocator picks these up through the `scrapeConfigSelector` configured in this example's values.yaml and distributes the resulting jobs to the daemonset collector.

Earlier versions of this example pointed `scrape_configs_file` at `examples/prometheus-otel/kubelet_scrape_configs.yaml`. That only works from a checkout of this repository's source tree, because packaged charts (for example those fetched with `helm pull`) do not include the examples folder. The ScrapeConfig approach works the same way regardless of how the chart was obtained. The raw prometheus form of the kubelet scrape configuration is kept in `kubelet_scrape_configs.yaml` as a reference for users who prefer to inline it into their collector configuration.
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Kubelet scrape configuration as Prometheus Operator ScrapeConfig custom resources.
#
# These resources replace the static scrape_configs_file that this example used to
# reference. The target allocator discovers them through prometheusCR.scrapeConfigSelector
# (enabled in this example's values.yaml) and hands the resulting jobs to the collector,
# so they work with the packaged chart where the examples folder is not shipped.
#
# The kubelet requires authentication. ScrapeConfig resources cannot reference the
# collector's mounted service account token file, so this manifest creates a dedicated
# service account with a long-lived token secret and the RBAC needed to scrape the
# kubelet endpoints. The target allocator reads the token from the secret and embeds
# it in the scrape configuration it serves to the collector.
#
# Apply this file into the same namespace the chart is installed in. The manifests
# below assume the `default` namespace; change it if you installed elsewhere.
#
# kubectl apply -n default -f kubelet_scrape_configs_cr.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubelet-monitoring
namespace: default
---
apiVersion: v1
kind: Secret
metadata:
name: kubelet-monitoring-token
namespace: default
annotations:
kubernetes.io/service-account.name: kubelet-monitoring
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubelet-monitoring
rules:
- apiGroups: [""]
resources:
- nodes/metrics
verbs: ["get"]
- nonResourceURLs:
- /metrics
- /metrics/cadvisor
- /metrics/probes
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubelet-monitoring
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubelet-monitoring
subjects:
- kind: ServiceAccount
name: kubelet-monitoring
namespace: default
---
# Scrapes the kubelet's /metrics endpoint.
apiVersion: monitoring.coreos.com/v1alpha1
kind: ScrapeConfig
metadata:
name: kubelet
namespace: default
spec:
authorization:
type: Bearer
credentials:
name: kubelet-monitoring-token
key: token
honorLabels: true
honorTimestamps: true
kubernetesSDConfigs:
- role: Node
metricsPath: /metrics
relabelings:
- sourceLabels: [job]
targetLabel: __tmp_prometheus_job_name
- targetLabel: job
replacement: kubelet
- sourceLabels: [__meta_kubernetes_node_name]
targetLabel: node
- targetLabel: endpoint
replacement: https-metrics
- sourceLabels: [__metrics_path__]
targetLabel: metrics_path
scheme: HTTPS
scrapeInterval: 30s
scrapeTimeout: 10s
tlsConfig:
insecureSkipVerify: true
---
# Scrapes the kubelet's /metrics/cadvisor endpoint for container metrics.
apiVersion: monitoring.coreos.com/v1alpha1
kind: ScrapeConfig
metadata:
name: kubelet-cadvisor
namespace: default
spec:
authorization:
type: Bearer
credentials:
name: kubelet-monitoring-token
key: token
honorLabels: true
honorTimestamps: true
kubernetesSDConfigs:
- role: Node
metricRelabelings:
- sourceLabels: [__name__]
regex: container_cpu_(cfs_throttled_seconds_total|load_average_10s|system_seconds_total|user_seconds_total)
action: drop
- sourceLabels: [__name__]
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)
action: drop
- sourceLabels: [__name__]
regex: container_memory_(mapped_file|swap)
action: drop
- sourceLabels: [__name__]
regex: container_(file_descriptors|tasks_state|threads_max)
action: drop
- sourceLabels: [__name__]
regex: container_spec.*
action: drop
- sourceLabels: [id, pod]
regex: .+;
action: drop
metricsPath: /metrics/cadvisor
relabelings:
- sourceLabels: [job]
targetLabel: __tmp_prometheus_job_name
- targetLabel: job
replacement: kubelet
- sourceLabels: [__meta_kubernetes_node_name]
targetLabel: node
- targetLabel: endpoint
replacement: https-metrics
- sourceLabels: [__metrics_path__]
targetLabel: metrics_path
scheme: HTTPS
scrapeInterval: 30s
scrapeTimeout: 10s
tlsConfig:
insecureSkipVerify: true
---
# Scrapes the kubelet's /metrics/probes endpoint.
apiVersion: monitoring.coreos.com/v1alpha1
kind: ScrapeConfig
metadata:
name: kubelet-probes
namespace: default
spec:
authorization:
type: Bearer
credentials:
name: kubelet-monitoring-token
key: token
honorLabels: true
honorTimestamps: true
kubernetesSDConfigs:
- role: Node
metricsPath: /metrics/probes
relabelings:
- sourceLabels: [job]
targetLabel: __tmp_prometheus_job_name
- targetLabel: job
replacement: kubelet
- sourceLabels: [__meta_kubernetes_node_name]
targetLabel: node
- targetLabel: endpoint
replacement: https-metrics
- sourceLabels: [__metrics_path__]
targetLabel: metrics_path
scheme: HTTPS
scrapeInterval: 30s
scrapeTimeout: 10s
tlsConfig:
insecureSkipVerify: true
Loading