Application observability with pod runtime injection
Inject OneAgent code modules into a container during its deployment.
This method of application instrumentation may not fully link Kubernetes workloads with monitored containers/processes. For comprehensive relationships and linking, consider using the automatic application-only injection.
Prerequisites
-
Review the list of supported applications and versions.
-
Create an access token with
PaaS Integration - InstallerDownload
scope. -
Storage requirements:
~325 MB for glibc
~290 MB for musl
~650 MB for glibc and musl combined
Deploy
To integrate OneAgent into your application at runtime, select one of the options below based on your platform.
OneAgent is made available to the application container via an initContainer
—your application image remains unaffected.
To integrate OneAgent into your application at runtime, extend your deployment template as follows.
1# your application containers2 containers:3 - name: customer-app4 image: tomcat5 env:6 - name: LD_PRELOAD7 value: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so8 - name: DT_NETWORK_ZONE9 value: <your_network_zone>10 volumeMounts:11 - mountPath: /opt/dynatrace/oneagent12 name: oneagent1314# initcontainer to download OneAgent15 initContainers:16 - name: install-oneagent17 image: alpine:latest18 command:19 - /bin/sh20 args:21 - -c22 - ARCHIVE=$(mktemp) && wget -O $ARCHIVE "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&$DT_ONEAGENT_OPTIONS" && unzip -o -d /opt/dynatrace/oneagent $ARCHIVE && rm -f $ARCHIVE23 env:24 - name: DT_API_URL25 value: https://<Your-environment-ID>.live.dynatrace.com/api26 - name: DT_PAAS_TOKEN27 value: <paastoken>28 - name: DT_ONEAGENT_OPTIONS29 value: flavor=<FLAVOR>&include=<TECHNOLOGY>30 volumeMounts:31 - mountPath: /opt/dynatrace/oneagent32 name: oneagent3334# Make OneAgent available as a volume35 volumes:36 - name: oneagent37 emptyDir: {}
-
In the
# initContainer to download OneAgent
and# Make OneAgent available as a volume
sections, add theinitContainer
, which will download OneAgent and make it available as a volume. -
In the
DT_ONEAGENT_OPTIONS
section, set the OneAgent code module required for your compiler flavor (FLAVOR
) and application (TECHNOLOGY
).- Valid options for
flavor
aredefault
,musl
, ormultidistro
. Setdefault
to downloadglibc
binaries or setmusl
to downloadmusl
binaries. Setmultidistro
to download both themusl
andglibc
binaries and subsequently autodetect which binaries to use. Note that image size will be larger in this case, as it includes both flavors. - Valid options for
technology
areall
,java
,apache
,nginx
,nodejs
,dotnet
,php
,go
, andsdk
. - For ARM, use the following value:
flavor=default&arch=arm&include=<TECHNOLOGY>
. For other architectures, see the list of valid values (scroll down to thearch
parameter). - If you want to specify several code modules, use the following syntax:
&include=technology1&include=technology2
.
- Valid options for
If you include specific technology-support options rather than 'support for all technologies' options, you'll get a smaller OneAgent package.
Dynatrace OneAgent supports the flavor musl
for Alpine Linux based environments.
Valid options for technology
are all
, dotnet
, go
, php
, java
, apache
, nginx
, and nodejs
.
-
In the
# your application containers
section, add the newly created volume to the container of your application. Also add theLD_PRELOAD
environment variable. -
optional In the
# your application containers
section, configure network zones:
1containers:2 env:3 - name: DT_NETWORK_ZONE4 value: <your_network_zone>
See network zones for more information.
- optional Configure a proxy address.
In case you run an environment with proxy, you need to set the DT_PROXY
environment variable in the application container to pass the proxy credentials to OneAgent.
For Alpine Linux-based containers, you might need to update the wget
shipped with the Alpine image to allow for proxy authentication for the download of OneAgent.
Update
Each time you want to leverage a new OneAgent version, you only need to redeploy your pods. In runtime injections, OneAgent is downloaded and injected within an initContainer. By default, the latest version of OneAgent is downloaded, but you can control which OneAgent version is downloaded by specifying it in the download URL.
Uninstall
To uninstall OneAgent from application-only monitoring
-
Remove the install-oneagent YAML from your deployment template.
1# your application containers2containers:3 - name: customer-app4 image: tomcat5 env:6 - name: LD_PRELOAD7 value: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so8 volumeMounts:9 - mountPath: /opt/dynatrace/oneagent10 name: oneagent1112# initContainer to download OneAgent13initContainers:14 - name: install-oneagent15 image: alpine:3.816 command:17 - /bin/sh18 args:19 - -c20 - ARCHIVE=$(mktemp) && wget -O $ARCHIVE "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&$DT_ONEAGENT_OPTIONS" && unzip -o -d /opt/dynatrace/oneagent $ARCHIVE && rm -f $ARCHIVE21 env:22 - name: DT_API_URL23 value: https://<Your-environment-ID>.live.dynatrace.com/api24 - name: DT_PAAS_TOKEN25 value: <paastoken>26 - name: DT_ONEAGENT_OPTIONS27 value: flavor=<FLAVOR>&include=<TECHNOLOGY>28 volumeMounts:29 - mountPath: /opt/dynatrace/oneagent30 name: oneagent3132# Make OneAgent available as a volume33volumes:34 - name: oneagent35 emptyDir: {} -
Redeploy your application.