Workload mutation on injection mode
When data ingest or OneAgent is enabled for application pods, webhook intercepts workload events and applies mutations to the resulting pods.
This guide outlines the specific mutations applied to application pods under two scenarios: data ingest mode and OneAgent injection mode.
Workload mutation on data ingest mode
In data ingest mode, Dynatrace Operator enhances pods with additional metadata, environment variables, volume mounts, and initiates an init container to inject the OneAgent into the application pod.
metadata
annotations
metadata.dynatrace.com/k8s.workload.kind
metadata.dynatrace.com/k8s.workload.name
metadata-enrichment.dynatrace.com/injected
true
spec.containers
env
DT_WORKLOAD_KIND
DT_WORKLOAD_NAME
METADATA_ENRICHMENT_INJECTED
true
volumeMounts
mountPath
name
/var/lib/dynatrace/enrichment/endpoint
metadata-enrichment-endpoint
/var/lib/dynatrace/enrichment
metadata-enrichment
spec.volumes
name
secret
metadata-enrichment-endpoint
secretName
: dynatrace-metadata-enrichment-endpoint
name
emptyDir
metadata-enrichment
initContainers
An init container named install-oneagent
is added to inject the OneAgent with specific environment variables related to the pod and cluster configuration, including the pod name, UID, and cluster ID, among others. This container also specifies resource limits and security context configurations.
initContainers:- args:- initenv:- name: FAILURE_POLICYvalue: silent- name: K8S_PODNAMEvalueFrom:fieldRef:apiVersion: v1fieldPath: metadata.name- name: K8S_PODUIDvalueFrom:fieldRef:apiVersion: v1fieldPath: metadata.uid- name: K8S_BASEPODNAMEvalue: alpine- name: K8S_CLUSTER_IDvalue: b9c38fb3-6c0f-45f6-8c25-9eb3b4b5af2a- name: K8S_NAMESPACEvalueFrom:fieldRef:apiVersion: v1fieldPath: metadata.namespace- name: K8S_NODE_NAMEvalueFrom:fieldRef:apiVersion: v1fieldPath: spec.nodeName- name: FLAVOR- name: TECHNOLOGIESvalue: all- name: INSTALLPATHvalue: /opt/dynatrace/oneagent-paas- name: INSTALLER_URL- name: VERSIONvalue: 1.289.0.20240313-145242- name: ONEAGENT_INJECTEDvalue: "true"- name: CONTAINER_1_NAMEvalue: alpine- name: CONTAINER_1_IMAGEvalue: alpine:3.2- name: CONTAINERS_COUNTvalue: "1"- name: DT_WORKLOAD_KINDvalue: Pod- name: DT_WORKLOAD_NAMEvalue: alpine- name: METADATA_ENRICHMENT_INJECTEDvalue: "true"image: quay.io/dynatrace/dynatrace-operator:snapshotimagePullPolicy: IfNotPresentname: install-oneagentresources:limits:cpu: 100mmemory: 60Mirequests:cpu: 30mmemory: 30MisecurityContext:allowPrivilegeEscalation: falsecapabilities:drop:- ALLprivileged: falsereadOnlyRootFilesystem: truerunAsGroup: 1001runAsNonRoot: truerunAsUser: 1001terminationMessagePath: /dev/termination-logterminationMessagePolicy: FilevolumeMounts:- mountPath: /mnt/binname: oneagent-bin- mountPath: /mnt/sharename: oneagent-share- mountPath: /mnt/configname: injection-config- mountPath: /var/lib/dynatrace/enrichmentname: metadata-enrichment- mountPath: /var/run/secrets/kubernetes.io/serviceaccountname: kube-api-access-r8mckreadOnly: true
Workload mutation on OneAgent injection mode
In OneAgent injection mode, the mutations focus on enabling full-stack monitoring through OneAgent.
metadata
annotations
dynakube.dynatrace.com/injected
true
oneagent.dynatrace.com/injected
true
spec.containers
env
name
value
DT_DEPLOYMENT_METADATA
orchestration_tech=Operator-cloud_native_fullstack;script_version=snapshot;orchestrator_id=b9c38fb3-6c0f-45f6-8c25-9eb3b4b5af2a
LD_PRELOAD
/opt/dynatrace/oneagent-paas/agent/lib64/liboneagentproc.so
volumeMounts
mountPath
name
subPath
/opt/dynatrace/oneagent-paas
oneagent-bin
/etc/ld.so.preload
oneagent-share
ld.so.preload
/etc/ld.so.preload
oneagent-share
container_alpine.conf
spec.volumes
name
secretName
injection-config
dynatrace-dynakube-config
name
emptyDir
oneagent-share
csi
driver
csi.oneagent.dynatrace.com