opentelemetry-collector

by ScriptonBasestar

Helm chartv0.3.0App 0.96.0

OpenTelemetry Collector for unified telemetry collection (traces, metrics, logs)

About this chart

OpenTelemetry Collector Helm Chart

OpenTelemetry Collector for unified telemetry collection (traces, metrics, logs)

Overview

The OpenTelemetry Collector is a vendor-agnostic proxy that can receive, process, and export telemetry data. This chart deploys the collector-contrib image which includes all community-contributed components.

Features

  • OTLP Support: Native OTLP gRPC and HTTP receivers
  • Multiple Exporters: Prometheus, Loki, Tempo, Jaeger, and more
  • Kubernetes Integration: k8sattributes processor for enrichment
  • Flexible Deployment: Deployment (gateway) or DaemonSet (agent) modes
  • Production Ready: HPA, PDB, ServiceMonitor support

TL;DR

helm repo add scripton-charts https://scriptonbasestar-container.github.io/sb-helm-charts
helm repo update

# Install with default configuration
helm install otel-collector scripton-charts/opentelemetry-collector -n monitoring

# Install with production configuration
helm install otel-collector scripton-charts/opentelemetry-collector -n monitoring \
  -f values-example.yaml

Prerequisites

  • Kubernetes 1.24+
  • Helm 3.8+
  • For k8sattributes processor: ClusterRole permissions

Configuration

Key Parameters

ParameterDescriptionDefault
replicaCountNumber of collector replicas1
modeDeployment mode (deployment/daemonset)deployment
image.repositoryCollector imageotel/opentelemetry-collector-contrib
image.tagImage tag"" (appVersion)
configCollector configuration (YAML)See values.yaml
rbac.createCreate RBAC resourcestrue
rbac.clusterRoleCreate ClusterRoletrue
serviceMonitor.enabledEnable Prometheus ServiceMonitorfalse
autoscaling.enabledEnable HPAfalse
podDisruptionBudget.enabledEnable PDBfalse

Deployment Modes

Gateway Mode (deployment):

mode: deployment
replicaCount: 2

Use for centralized collection where applications send telemetry to a central collector.

Agent Mode (daemonset):

mode: daemonset

Use for per-node collection where a collector runs on each node.

Pipeline Configuration

The collector configuration follows the OpenTelemetry Collector config format:

config:
  receivers:
    otlp:
      protocols:
        grpc:
          endpoint: 0.0.0.0:4317
        http:
          endpoint: 0.0.0.0:4318

  processors:
    batch:
      timeout: 5s
    memory_limiter:
      limit_percentage: 80

  exporters:
    prometheusremotewrite:
      endpoint: http://mimir:8080/api/v1/push
    otlp/tempo:
      endpoint: tempo:4317
    loki:
      endpoint: http://loki:3100/loki/api/v1/push

  service:
    pipelines:
      traces:
        receivers: [otlp]
        processors: [batch]
        exporters: [otlp/tempo]
      metrics:
        receivers: [otlp]
        processors: [batch]
        exporters: [prometheusremotewrite]
      logs:
        receivers: [otlp]
        processors: [batch]
        exporters: [loki]

Kubernetes Attributes

Enable k8sattributes processor to enrich telemetry with Kubernetes metadata:

config:
  processors:
    k8sattributes:
      auth_type: "serviceAccount"
      extract:
        metadata:
          - k8s.namespace.name
          - k8s.deployment.name
          - k8s.pod.name
          - k8s.node.name

  service:
    pipelines:
      traces:
        processors: [k8sattributes, batch]

Usage

Configure Applications

Set environment variables in your applications:

env:
  - name: OTEL_EXPORTER_OTLP_ENDPOINT
    value: "http://otel-collector.monitoring.svc.cluster.local:4317"
  - name: OTEL_SERVICE_NAME
    value: "my-service"

SDK Examples

Python:

from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter

exporter = OTLPSpanExporter(endpoint="otel-collector:4317", insecure=True)

Go:

import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"

exporter, _ := otlptracegrpc.New(ctx,
    otlptracegrpc.WithEndpoint("otel-collector:4317"),
    otlptracegrpc.WithInsecure(),
)

Node.js:

const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-grpc');

const exporter = new OTLPTraceExporter({
  url: 'http://otel-collector:4317',
});

Production Setup

# values-prod.yaml
replicaCount: 3

config:
  receivers:
    otlp:
      protocols:
        grpc:
          endpoint: 0.0.0.0:4317
        http:
          endpoint: 0.0.0.0:4318

  processors:
    batch:
      timeout: 5s
      send_batch_size: 10000
    memory_limiter:
      check_interval: 1s
      limit_percentage: 80
      spike_limit_percentage: 25
    k8sattributes:
      auth_type: "serviceAccount"

  exporters:
    prometheusremotewrite:
      endpoint: http://mimir:8080/api/v1/push
    otlp/tempo:
      endpoint: tempo:4317
    loki:
      endpoint: http://loki:3100/loki/api/v1/push

  service:
    pipelines:
      traces:
        receivers: [otlp]
        processors: [memory_limiter, k8sattributes, batch]
        exporters: [otlp/tempo]
      metrics:
        receivers: [otlp]
        processors: [memory_limiter, batch]
        exporters: [prometheusremotewrite]
      logs:
        receivers: [otlp]
        processors: [memory_limiter, k8sattributes, batch]
        exporters: [loki]

resources:
  limits:
    cpu: 2000m
    memory: 4Gi
  requests:
    cpu: 500m
    memory: 1Gi

serviceMonitor:
  enabled: true

podDisruptionBudget:
  enabled: true
  minAvailable: 2

autoscaling:
  enabled: true
  minReplicas: 3
  maxReplicas: 10

affinity:
  podAntiAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        podAffinityTerm:
          labelSelector:
            matchExpressions:
              - key: app.kubernetes.io/name
                operator: In
                values:
                  - opentelemetry-collector
          topologyKey: kubernetes.io/hostname

Troubleshooting

Check Collector Status

# Pod status
kubectl get pods -n monitoring -l app.kubernetes.io/name=opentelemetry-collector

# Logs
kubectl logs -n monitoring -l app.kubernetes.io/name=opentelemetry-collector -f

# Health check
kubectl exec -n monitoring deploy/otel-collector -- wget -qO- http://localhost:13133

View Configuration

kubectl get configmap -n monitoring otel-collector -o yaml

Common Issues

  1. No data received: Check receivers configuration and network connectivity
  2. Memory issues: Increase memory_limiter limits or add more replicas
  3. Permission errors: Ensure RBAC is enabled and ClusterRole is created
  4. Export failures: Verify exporter endpoints and credentials

Debug Mode

Enable debug exporter to see processed data:

config:
  exporters:
    debug:
      verbosity: detailed

  service:
    pipelines:
      traces:
        exporters: [debug, otlp/tempo]

Related Charts

  • prometheus - Metrics collection
  • loki - Log aggregation
  • tempo - Distributed tracing
  • mimir - Long-term metrics storage
  • grafana - Visualization

Resources

License

  • Chart: BSD 3-Clause License
  • OpenTelemetry Collector: Apache License 2.0

Maintained by: ScriptonBasestar Chart Version: 0.3.0 OpenTelemetry Collector Version: 0.96.0

Deploy opentelemetry-collector with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has opentelemetry-collector on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartopentelemetry-collector is pinned at v0.3.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply