Use OpenTelemetry AutoInstrumentation when you want to collect application traces from Kubernetes workloads without changing application code. The Coralogix OpenTelemetry Integration Helm chart can deploy a webhook that injects OpenTelemetry AutoInstrumentation into annotated pods and sends traces to the node-local `opentelemetry-agent` DaemonSet.

This mode does not require `Instrumentation` Custom Resource Definitions (CRDs). The instrumentation settings are configured once in Helm values and reused for all annotated workloads in the release.

## Prerequisites

- [Install Kubernetes Observability using OpenTelemetry](https://coralogix.com/docs/opentelemetry/kubernetes-observability/kubernetes-complete-observability-basic-configuration/index.md) with the OpenTelemetry Integration Helm chart v0.0.320 or later
- Linux worker nodes for the webhook and supported auto-instrumentation images

Supported languages are Java, Python, and .NET.

Warning

Do not enable `opentelemetry-autoinstrumentation` in a cluster that already has an OpenTelemetry Operator admission webhook installed, unless webhook names and selectors are configured to avoid collisions.

## Enable OpenTelemetry AutoInstrumentation

Add the following values to your Helm values file:

```yaml
opentelemetry-autoinstrumentation:
  enabled: true
```

Install or upgrade the chart:

```bash
helm upgrade --install otel-coralogix-integration \
  coralogix-charts-virtual/otel-integration \
  -f values.yaml \
  --set global.clusterName=<cluster_name> \
  --set global.domain=<domain>
```

## Annotate workloads

Add one of these annotations to the pod template of the workload you want to instrument:

```yaml
instrumentation.opentelemetry.io/inject-java: "true"
instrumentation.opentelemetry.io/inject-python: "true"
instrumentation.opentelemetry.io/inject-dotnet: "true"
```

Example deployment:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout
spec:
  replicas: 1
  selector:
    matchLabels:
      app: checkout
  template:
    metadata:
      labels:
        app: checkout
      annotations:
        instrumentation.opentelemetry.io/inject-java: "true"
    spec:
      containers:
        - name: checkout
          image: "<your_app_image>"
```

Restart existing pods after adding the annotation. The webhook only mutates pods during creation.

## Default trace export path

Injected workloads export traces to the OpenTelemetry Agent running on the same Kubernetes node:

- Java and .NET: OTLP/gRPC to `http://$(OTEL_NODE_IP):4317`
- Python: OTLP HTTP/protobuf to `http://$(OTEL_NODE_IP):4318`

The chart sets `OTEL_NODE_IP` from the pod `status.hostIP` field, so each instrumented workload sends telemetry to its local node agent.

## Configure instrumentation settings

The chart uses a static instrumentation configuration under:

```yaml
opentelemetry-autoinstrumentation:
  manager:
    config:
      instrumentations:
        spec:
```

Use this section to override exporter settings, propagators, sampler settings, resource attributes, or language-specific environment variables.

Example:

```yaml
opentelemetry-autoinstrumentation:
  enabled: true
  manager:
    config:
      instrumentations:
        spec:
          propagators:
            - tracecontext
            - baggage
          sampler:
            type: parentbased_traceidratio
            argument: "1.0"
          env:
            - name: OTEL_RESOURCE_ATTRIBUTES
              value: deployment.environment=production
          java:
            env:
              - name: OTEL_SERVICE_NAME
                value: checkout
          python:
            env:
              - name: OTEL_SERVICE_NAME
                value: checkout
          dotnet:
            env:
              - name: OTEL_SERVICE_NAME
                value: checkout
```

## Limitations

- One static instrumentation configuration is used per Helm release.
- .NET auto-instrumentation requires x64 Linux runtime support.
- The webhook creates cluster-scoped RBAC and admission webhook resources.
- This chart option does not install OpenTelemetry Operator CRDs and does not support per-namespace `Instrumentation` CRs.

## Validate the setup

Check that the webhook manager is running:

```bash
kubectl get pods -l app.kubernetes.io/name=otel-autoinstrumentation
```

Check that an annotated pod has an injected init container:

```bash
kubectl get pod <pod_name> -o jsonpath='{.spec.initContainers[*].name}'
```

Expected init container names include:

- `opentelemetry-auto-instrumentation-java`
- `opentelemetry-auto-instrumentation-python`
- `opentelemetry-auto-instrumentation-dotnet`

Then generate traffic to the application and verify traces in Coralogix APM.
