Try it free

Kubernetes container workloads

  • Latest Dynatrace
  • How-to guide
  • 5-min read
  • Published Nov 15, 2026

License your Kubernetes workloads per container-hour with Container Application Monitoring. This works with OneAgent and OpenTelemetry on all supported distributions, with or without Dynatrace Operator.

Before you begin

  • Container application workloads. Instrument your workloads with OpenTelemetry or with OneAgent in application monitoring mode. Don't use a mode in which OneAgent monitors the host (classic full-stack, cloud-native full-stack, or host monitoring). The host is already licensed, so opting its containers in would license them twice. To switch from full-stack, see Migrate from classic full-stack or Migrate from cloud-native full-stack.
  • Dynatrace Operator is optional. Dynatrace Operator version 1.10+ makes setup easier: it adds the container identity attributes k8s.pod.uid and k8s.container.name to telemetry from the containers it injects. Without the Operator, you set them yourself.
AspectWith Dynatrace OperatorWithout Dynatrace Operator
Container identity attributesAdded automatically, except for sidecar containersYou set them in OTEL_RESOURCE_ATTRIBUTES
Opt-inTenant-wide setting (OneAgent), DynaKube, or pod annotationTenant-wide setting (OneAgent) or OTEL_RESOURCE_ATTRIBUTES
Setup guideKubernetes setup with Dynatrace OperatorWithout Dynatrace Operator

Sidecar containers

With OneAgent injection, Dynatrace Operator adds the container identity attributes only to the containers it injects. Sidecar containers in the same pod don't get them. To make an instrumented sidecar eligible, either use OTLP exporter auto-configuration, which covers sidecars too, or set the attributes yourself.

Opt in OneAgent workloads

OneAgent version 1.345+

All options require OneAgent version 1.345+. Use one of these options:

  • Tenant-wide setting: Enable builtin:billing.container-application-monitoring.optin to opt in all eligible OneAgent containers at once. A container is eligible if its telemetry carries the container identity attributes. The setting is enabled by default for new customers and takes effect without a restart. Once you enable it, you can't disable it.

  • Per DynaKube: Add the attribute under spec.resourceAttributes to opt in all components:

    spec:
    resourceAttributes:
    dt.has_container_application_monitoring: "true"

    To opt in only OneAgent, add it under spec.oneAgent.applicationMonitoring.additionalResourceAttributes instead:

    spec:
    oneAgent:
    applicationMonitoring:
    additionalResourceAttributes:
    dt.has_container_application_monitoring: "true"

    For OpenTelemetry only, use spec.otlpExporterConfiguration.additionalResourceAttributes. If you set the same key in both places, the per-component value overrides spec.resourceAttributes.

  • Per workload: Add the annotation to the pod template:

    spec:
    template:
    metadata:
    annotations:
    metadata.dynatrace.com/dt.has_container_application_monitoring: "true"

    Without the Operator, add dt.has_container_application_monitoring=true to OTEL_RESOURCE_ATTRIBUTES instead, together with the container identity attributes. See Without Dynatrace Operator.

The resource attribute options are reversible: remove the attribute and restart the workloads.

Opt in OpenTelemetry workloads

OpenTelemetry always requires an opt-in

The tenant-wide setting applies to OneAgent only. OpenTelemetry workloads are licensed as Container Application Monitoring only if their telemetry carries dt.has_container_application_monitoring=true.

With Dynatrace Operator

Enable OTLP exporter auto-configuration and add the opt-in. The Operator injects the endpoint, token, and container identity attributes into pods in the selected namespaces. Without a namespace selector, it configures and opts in pods in all namespaces:

spec:
otlpExporterConfiguration:
signals:
traces: {}
metrics: {}
additionalResourceAttributes:
dt.has_container_application_monitoring: "true"
namespaceSelector: # Optional. Limits the opt-in to these namespaces.
matchLabels:
container_application_monitoring-otlp: "true" # Adjust to target your namespaces.

Without Dynatrace Operator

Set the opt-in and the container identity attributes in OTEL_RESOURCE_ATTRIBUTES on each application container. Get the pod UID from the Kubernetes Downward API, and set the container name to the name in your pod spec:

spec:
containers:
- name: checkout
env:
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: OTEL_RESOURCE_ATTRIBUTES
value: "dt.has_container_application_monitoring=true,k8s.pod.uid=$(K8S_POD_UID),k8s.container.name=checkout"

Define K8S_POD_UID before OTEL_RESOURCE_ATTRIBUTES, so Kubernetes can expand it. This also works for OneAgent without the Operator. If the tenant-wide setting covers the workload, leave out the opt-in attribute.

If you route telemetry through an OpenTelemetry Collector, make sure it keeps these resource attributes.

Without k8s.pod.uid and k8s.container.name, Dynatrace can't attribute OpenTelemetry telemetry to a container. That telemetry is licensed as Traces and Metrics - Ingest & Process instead.

Roll out the change

Resource attributes are injected when a pod starts. After you change the DynaKube, an annotation, or OTEL_RESOURCE_ATTRIBUTES, restart the affected workloads:

kubectl rollout restart deployment -n <namespace>

The tenant-wide setting needs no restart.

Verify

In Account Management, go to Subscription > Overview > Cost and usage details, select Container Application Monitoring, and check that consumption increases. You can also query billing usage events, as described in Migrate to Container Application Monitoring.

Related topics

  • Monitor container workloads
  • Migrate to Container Application Monitoring
  • Container Application Monitoring consumption