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 Presets for opentelemetry-kube-stack #1166

Merged
merged 39 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
89fa6a5
Add presets
jaronoff97 May 1, 2024
b4ba76c
add presets
jaronoff97 May 2, 2024
e2c37b1
oop
jaronoff97 May 2, 2024
dc2a403
did the thing maybe
jaronoff97 May 2, 2024
715477c
bump
jaronoff97 May 2, 2024
5cadb7f
generate examples with all the fixins
jaronoff97 May 3, 2024
b461e0e
fix bork
jaronoff97 May 3, 2024
d9a862b
Clean logic
jaronoff97 May 3, 2024
6543884
defaults and digs
jaronoff97 May 3, 2024
3646da6
hooks
jaronoff97 May 3, 2024
94b4a1e
example hooks
jaronoff97 May 3, 2024
057106b
install crds
jaronoff97 May 3, 2024
5f0ab08
remove otlp exporter preset
jaronoff97 May 6, 2024
fdfee6a
fix
jaronoff97 May 10, 2024
4d5af9a
better
jaronoff97 May 13, 2024
a6f0c7c
Change default
jaronoff97 May 13, 2024
bc9db6c
Merge branch 'main' of github.com:open-telemetry/opentelemetry-helm-c…
jaronoff97 May 17, 2024
dd9c5d1
update
jaronoff97 May 17, 2024
18210c4
remove customization
jaronoff97 May 17, 2024
5c3f6ad
use v1beta1
jaronoff97 May 17, 2024
99a17cd
examples
jaronoff97 May 17, 2024
69f1a74
Add cert manager, deploy
jaronoff97 May 17, 2024
8427012
maybe
jaronoff97 May 17, 2024
63b8957
What happens without this
jaronoff97 May 17, 2024
695bed1
nvm
jaronoff97 May 17, 2024
cc80061
facepalm
jaronoff97 May 17, 2024
a4ebd91
test
jaronoff97 May 28, 2024
316ab94
okay
jaronoff97 May 28, 2024
517e890
Merge branch 'main' of github.com:open-telemetry/opentelemetry-helm-c…
jaronoff97 Jun 24, 2024
671a828
remove args
jaronoff97 Jun 24, 2024
3eb39f6
remove dupe
jaronoff97 Jun 24, 2024
0239c7b
updates from feedback
jaronoff97 Jun 26, 2024
7c8dd02
fix whitespace
jaronoff97 Jun 26, 2024
fa9b0db
remove sampler
jaronoff97 Jun 27, 2024
33522aa
Merge branch 'main' of github.com:jaronoff97/opentelemetry-helm-chart…
jaronoff97 Jul 1, 2024
722cc63
move batch processor
jaronoff97 Jul 1, 2024
af756bb
remove the bad
jaronoff97 Jul 1, 2024
c2b4af4
update readme and versions
jaronoff97 Jul 1, 2024
452d09a
update
jaronoff97 Jul 1, 2024
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
10 changes: 5 additions & 5 deletions .github/workflows/kube-stack-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
create-kind-cluster: "true"

# We'll need this eventually, but for now leave it commented.
# - name: Install cert-manager
# run: |
# kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml
# kubectl wait --timeout=5m --for=condition=available deployment cert-manager -n cert-manager
# kubectl wait --timeout=5m --for=condition=available deployment cert-manager-webhook -n cert-manager
- name: Install cert-manager
run: |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.yaml
kubectl wait --timeout=5m --for=condition=available deployment cert-manager -n cert-manager
kubectl wait --timeout=5m --for=condition=available deployment cert-manager-webhook -n cert-manager

- name: Run chart-testing (install)
run: ct install --charts charts/opentelemetry-kube-stack
6 changes: 3 additions & 3 deletions charts/opentelemetry-kube-stack/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dependencies:
version: 0.0.0
- name: opentelemetry-operator
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.61.0
digest: sha256:0eedb0c3014ffbab4516d2ef28e1254e699daa4f64980033783e44f2b5ceed3e
generated: "2024-06-05T15:15:04.402697-04:00"
version: 0.63.0
digest: sha256:31f544ae26a7c742da6a043d38190833eb9b0571dad072427ed6006d70887be0
generated: "2024-06-24T11:36:56.631314-04:00"
6 changes: 3 additions & 3 deletions 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.6
version: 0.0.7
description: |
OpenTelemetry Quickstart chart for Kubernetes.
Installs an operator and collector for an easy way to get started with Kubernetes observability.
Expand All @@ -13,12 +13,12 @@ maintainers:
- name: dmitryax
- name: TylerHelmuth
icon: https://raw.githubusercontent.com/cncf/artwork/a718fa97fffec1b9fd14147682e9e3ac0c8817cb/projects/opentelemetry/icon/color/opentelemetry-icon-color.png
appVersion: 0.101.0
appVersion: 0.102.0
TylerHelmuth marked this conversation as resolved.
Show resolved Hide resolved
dependencies:
- name: crds
version: "0.0.0"
condition: crds.install
- name: opentelemetry-operator
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.61.0
version: 0.63.0
condition: opentelemetry-operator.enabled
20 changes: 20 additions & 0 deletions charts/opentelemetry-kube-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@

This Helm chart serves as a quickstart for OpenTelemetry in a Kubernetes environment. The chart installs an [OpenTelemetry Operator](https://github.com/open-telemetry/opentelemetry-operator) and a suite of collectors that help you get started with OpenTelemetry metrics, traces, and logs.

## Features

This chart installs the OpenTelemetry Operator and two collector pools with the following features:
* Daemonset collector
* Kubernetes infrastructure metrics
* Applications logs
* OTLP trace receiver
* Kubernetes resource enrichment
* Standalone collector
* Kubernetes events
* Cluster metrics

## Usage

For example usage of this chart, please look in the examples/ folder where you can see how you can set a custom OTLP exporter for your desired destination. The example configuration also shows how to enable Instrumentation and OpAMP Bridge resources.

### scrape_configs_file Details

By default, the daemonset collector will load in the daemon_scrape_configs.yaml file which collects prometheus metrics from applications on the same node that have the prometheus.io/scrape=true annotation, kubernetes node metrics, and cadvisor metrics. Users can disable this by settings collectors.daemon.scrape_configs_file: "" OR they can provide their own promethues scrape config file for the daemonset by supplying collectors.daemon.scrape_configs_file: "<your-file>.yaml"

## Prerequisites

- Kubernetes 1.24+ is required for OpenTelemetry Operator installation
Expand Down
176 changes: 176 additions & 0 deletions charts/opentelemetry-kube-stack/daemon_scrape_configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Collect all metrics from pods on the daemon set's node with at least this annotation
# prometheus.io/scrape: 'true'
# This can be further customized by setting the following annotations:
# prometheus.io/scheme: 'https'
# prometheus.io/path: '/data/metrics'
# prometheus.io/port: '80'
- job_name: kubernetes-pods
scrape_interval: 30s
kubernetes_sd_configs:
- role: pod
selectors:
- role: pod
# only scrape data from pods running on the same node as collector
field: "spec.nodeName=$OTEL_K8S_NODE_NAME"
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels:
[__meta_kubernetes_pod_annotation_prometheus_io_scrape_slow]
action: drop
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scheme]
action: replace
regex: (https?)
target_label: __scheme__
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels:
[__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
# NOTE: otel collector uses env var replacement. $$ is used as a literal $.
replacement: $$1:$$2
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_annotation_prometheus_io_param_(.+)
replacement: __param_$$1
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod
- source_labels: [__meta_kubernetes_pod_phase]
regex: Pending|Succeeded|Failed|Completed
action: drop
- action: replace
source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
target_label: job
# This job is setup to scrape the node metrics on the same host as the daemonset
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/29053
- job_name: node-exporter
scrape_interval: 30s
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)
- action: replace
regex: "(.*)"
replacement: "$1"
separator: ";"
source_labels:
- job
target_label: __tmp_prometheus_job_name
static_configs:
- targets:
- ${OTEL_K8S_NODE_IP}:9100
# We still need to scrape kubelet's CAdvisor which isn't supported in any otel collector receiver
# https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/29053
- authorization:
credentials_file: "/var/run/secrets/kubernetes.io/serviceaccount/token"
type: Bearer
follow_redirects: true
honor_labels: true
honor_timestamps: true
job_name: kubelet
kubernetes_sd_configs:
- follow_redirects: true
role: node
selectors:
- role: node
# only scrape data from pods running on the same node as collector
field: "metadata.name=$OTEL_K8S_NODE_NAME"
metric_relabel_configs:
- action: drop
regex: container_cpu_(load_average_10s|system_seconds_total|user_seconds_total)
replacement: "$1"
separator: ";"
source_labels:
- __name__
- action: drop
regex: container_fs_(io_current|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
scheme: https
scrape_interval: 15s
scrape_timeout: 10s
tls_config:
ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# Source: opentelemetry-kube-stack/templates/bridge.yaml
apiVersion: opentelemetry.io/v1alpha1
kind: OpAMPBridge
metadata:
name: example
labels:
helm.sh/chart: opentelemetry-kube-stack-0.0.7
app.kubernetes.io/version: "0.102.0"
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": hook-failed
spec:
endpoint: http://opamp-server:8080
capabilities:
AcceptsOpAMPConnectionSettings: true
AcceptsOtherConnectionSettings: true
AcceptsRemoteConfig: true
AcceptsRestartCommand: true
ReportsEffectiveConfig: true
ReportsHealth: true
ReportsOwnLogs: true
ReportsOwnMetrics: true
ReportsOwnTraces: true
ReportsRemoteConfig: true
ReportsStatus: true
replicas: 1
image: "ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge:0.102.0"
upgradeStrategy: automatic
securityContext:
runAsNonRoot: true
runAsUser: 1000
resources:
limits:
cpu: 250m
memory: 256Mi
requests:
cpu: 250m
memory: 256Mi
env:
- name: OTEL_K8S_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: OTEL_K8S_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: OTEL_K8S_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: OTEL_K8S_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: OTEL_RESOURCE_ATTRIBUTES
value: "k8s.cluster.name=demo"
Loading
Loading