Dynatrace OneAgent and Kubernetes Operator: Resolving the Injection Boundary in Production
0 reputation · 06 Dec 2022, 13:44 UTC
0 reputation · 06 Dec 2022, 13:44 UTC
A Dynatrace OneAgent configuration that connects in a local Docker Compose setup may not connect when the same application runs under the Dynatrace Kubernetes Operator. The local path typically relies on manually set DT_API_URL and DT_API_TOKEN environment variables. The production path depends on the Operator's mutating webhook and pod annotations to inject connection variables such as DT_CONNECTION_POINT and DT_TENANT.
The unresolved decision is which injection mechanism should be authoritative when both are present or when the webhook is disabled. Operator versions around 0.9.0 changed required annotation keys, and older documentation may still reference dynatrace.com/inject. SaaS and Managed endpoints and token formats are not interchangeable, so a local token may be rejected in production even if injection succeeds. The exact annotation key and version compatibility require current verification against the deployed Operator release.
DT_API_URL and DT_API_TOKEN?30775 reputation · 07 Dec 2022, 01:23 UTC
When the Dynatrace Kubernetes Operator's mutating webhook is enabled and the pod carries the required injection annotation, the webhook is authoritative: it injects DT_CONNECTION_POINT, DT_TENANT, and DT_TENANT_TOKEN and overwrites any manually set DT_API_URL/DT_API_TOKEN. If the webhook is disabled or the pod lacks the annotation, you must supply DT_CONNECTION_POINT and DT_TENANT_TOKEN (or DT_API_TOKEN for older OneAgent versions) manually.
dynatrace.com/oneagent: \"true\" but may still accept dynatrace.com/inject: \"true\" for backward compatibility. The exact key must be verified against the deployed Operator's CRD.LD_PRELOAD/JAVA_TOOL_OPTIONS. Without the webhook, those mounts are absent and the application runs uninstrumented.kubectl get dynakube -n dynatrace -o yaml
kubectl get pods -n dynatrace -l app=dynatrace-webhookhttps://github.com/Dynatrace/dynatrace-operator/releases/tag/v<version>).kubectl exec <pod-name> -n <namespace> -- env | grep -E 'DT_'kubectl get secret <secret-name> -n dynatrace -o jsonpath='{.data.apiToken}' | base64 -dEnsure it matches your target environment (SaaS vs. Managed).DT_CONNECTION_POINT and DT_TENANT_TOKEN as env vars in the pod spec (or use a secret). Do not set DT_API_URL/DT_API_TOKEN alongside them.What is the exact Operator version (e.g., v0.12.0) running in your cluster? The required annotation key and any breaking changes depend on that version, and it changes whether dynatrace.com/inject or dynatrace.com/oneagent is authoritative.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.