To deploy OneAgent on Kubernetes for application-only monitoring, read the instructions provided below.
Before you begin
You'll need to
- acquire Dynatrace environment credentials.
- review the list of supported applications and versions.
Generate PaaS token
The first step is to get your environment ID and PaaS token for your Dynatrace environment.
Login with your Dynatrace account.
Select Deploy Dynatrace from the navigation menu.
Click the Set up PaaS integration button.
Your environment ID appears in the Environment ID text box. You'll need this ID to link your Dynatrace account with your PaaS environment. Click Copy to copy the ID to the clipboard. You can do this at any time by revisiting this page.
To generate a PaaS token, click the Generate new token button. The PaaS token is essentially an API token that's used in combination with your environment ID to download Dynatrace OneAgent. As you'll see, there's also a default InstallerDownload token available that you can alternatively use. However, for security reasons, it's recommended that you create several discrete tokens for each environment you have.
Type in a meaningful name for your PaaS token. A meaningful token name might be the name of the PaaS platform you want to monitor (for example,
openshift). To view and manage your existing PaaS tokens, go to Settings -> Integration -> Platform as a Service.
Click Generate to create the PaaS token. The newly created PaaS token will appear in the list below. Click Copy to copy the generated token to the clipboard. You can do this at any time by revisiting this page and clicking Show token next to the relevant PaaS token.
Integrate OneAgent into application images
The following steps explain how to integrate OneAgent into a binary build with a Dockerfile.
Define variables with optional default values using
ARG DT_API_URL="https://<environmentID>.live.dynatrace.com/api" ARG DT_API_TOKEN="<token>" ARG DT_ONEAGENT_OPTIONS="flavor=default&include=<technology1>&include=<technology2>" ENV DT_HOME="/opt/dynatrace/oneagent"
<environmentID>with your Dynatrace environment ID. If you’re using Dynatrace Managed, you need to provide your Dynatrace Server URL (
<token>with the PaaS token mentioned above.
Technology support is enabled via
includeparameters. Valid options for
go. Including specific technology-support options, rather than support for all technology options, results in a smaller OneAgent package.
Dynatrace OneAgent supports the flavor
musl for Alpine Linux based environments. Valid options for
Add the following commands to your current Dockerfile to integrate OneAgent and activate instrumentation of your application.
ARG DT_API_URL="https://<environmentID>.live.dynatrace.com/api" ARG DT_API_TOKEN="<token>" ARG DT_ONEAGENT_OPTIONS="flavor=default&include=<technology1>&include=<technology2>" ENV DT_HOME="/opt/dynatrace/oneagent" RUN mkdir -p "$DT_HOME" && \ wget -O "$DT_HOME/oneagent.zip" "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_API_TOKEN&$DT_ONEAGENT_OPTIONS" && \ unzip -d "$DT_HOME" "$DT_HOME/oneagent.zip" && \ rm "$DT_HOME/oneagent.zip" ENTRYPOINT [ "/opt/dynatrace/oneagent/dynatrace-agent64.sh" ] CMD [ "executable", "param1", "param2" ] # the command of your application, e.g. java
Note: The commands above that use
unzip may fail if they aren't provided by the base image.
Build your application image
Build the Docker image from your Dockerfile to use it in your Kubernetes environment:
$ docker build -t yourapp .
Note: You can monitor your application containers with a different Dynatrace environment. To do this, read the instructions below:
For OneAgent v1.139 or higher, if you have an existing application image where you have already added the OneAgent code modules for a specific Dynatrace environment, you can have the OneAgent report to another Dynatrace environment without rebuilding your application image.
For this you need to make a call to the REST endpoint of your second Dynatrace environment. Don't forget to adapt the respective placeholders
$ curl "https://<environmentID>.live.dynatrace.com/api/v1/deployment/installer/agent/connectioninfo?Api-Token=<token>"
In return, you get a JSON object that covers the required information that needs to be passed as environment variable to the application container. Make sure you set the environment variables of the application container as described below:
DT_CONNECTION_POINT: semi-colon separated list of