# OpenTelemetry on Kubernetes — OpenTelemetry

Source: https://www.skillbyai.com/en/opentelemetry/b-k8s

> The operator and Helm charts.

## Manage Collectors and auto-instrumentation

The **OpenTelemetry Operator** manages Collectors through an `OpenTelemetryCollector` custom resource (deployed as a Deployment, DaemonSet, StatefulSet or sidecar) and can inject zero-code instrumentation into pods via an `Instrumentation` resource and pod annotations. Official Helm charts are another way to deploy the Collector. Combine the k8sattributes processor with resource attributes so every signal shows which pod, namespace and deployment produced it.

## Enabling Java auto-instrumentation with the operator

Resources follow the operator documentation; check field names for your operator version.

```yaml
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
  name: default
spec:
  exporter:
    endpoint: http://otel-collector:4318
  propagators: [tracecontext, baggage]
  sampler:
    type: parentbased_traceidratio
    argument: "0.25"
---
# in the Deployment's pod template:
metadata:
  annotations:
    instrumentation.opentelemetry.io/inject-java: "true"
```

## Roll out instrumentation per namespace

Enable injection for one team's namespace first and watch overhead before expanding.

**Quiz:** What can the OpenTelemetry Operator inject into pods?

- [ ] Database schemas
- [x] Zero-code instrumentation, enabled by annotations
- [ ] TLS certificates for users
- [ ] Grafana dashboards

*Answer:* Zero-code instrumentation, enabled by annotations. Via the Instrumentation resource.
