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.
Review the list of supported applications and versions.
Create an access token with PaaS Integration - InstallerDownload
scope.
Storage requirements:
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.
# your application containerscontainers:- name: customer-appimage: tomcatenv:- name: LD_PRELOADvalue: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so- name: DT_NETWORK_ZONEvalue: <your_network_zone>volumeMounts:- mountPath: /opt/dynatrace/oneagentname: oneagent# initcontainer to download OneAgentinitContainers:- name: install-oneagentimage: alpine:latestcommand:- /bin/shargs:- -c- 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 $ARCHIVEenv:- name: DT_API_URLvalue: https://<your-environment-id>.live.dynatrace.com/api- name: DT_PAAS_TOKENvalue: <Access token with PaaS integration scopes (Dynatrace -> Access tokens)>- name: DT_ONEAGENT_OPTIONSvalue: flavor=<FLAVOR>&include=<TECHNOLOGY>volumeMounts:- mountPath: /opt/dynatrace/oneagentname: oneagent# Make OneAgent available as a volumevolumes:- name: oneagentemptyDir: {}
In the # initContainer to download OneAgent
and # Make OneAgent available as a volume
sections, add the initContainer
, 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
).
flavor
are default
, musl
, or multidistro
. Set default
to download glibc
binaries or set musl
to download musl
binaries. Set multidistro
to download both the musl
and glibc
binaries and subsequently autodetect which binaries to use. Note that image size will be larger in this case, as it includes both flavors.technology
are all
, java
, apache
, nginx
, nodejs
, dotnet
, php
, go
, and sdk
.flavor=default&arch=arm&include=<TECHNOLOGY>
. For other architectures, see the list of valid values (scroll down to the arch
parameter).&include=technology1&include=technology2
.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 the LD_PRELOAD
environment variable.
optional In the # your application containers
section, configure network zones:
containers:env:- name: DT_NETWORK_ZONEvalue: <your_network_zone>
See network zones for more information.
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.
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.
To uninstall OneAgent from application-only monitoring
Remove the install-oneagent YAML from your deployment template.
# your application containerscontainers:- name: customer-appimage: tomcatenv:- name: LD_PRELOADvalue: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.sovolumeMounts:- mountPath: /opt/dynatrace/oneagentname: oneagent# initContainer to download OneAgentinitContainers:- name: install-oneagentimage: alpine:3.8command:- /bin/shargs:- -c- 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 $ARCHIVEenv:- name: DT_API_URLvalue: https://<Your-environment-ID>.live.dynatrace.com/api- name: DT_PAAS_TOKENvalue: <paastoken>- name: DT_ONEAGENT_OPTIONSvalue: flavor=<FLAVOR>&include=<TECHNOLOGY>volumeMounts:- mountPath: /opt/dynatrace/oneagentname: oneagent# Make OneAgent available as a volumevolumes:- name: oneagentemptyDir: {}
Redeploy your application.