This procedure is deprecated.
Dynatrace offers the option to inject OneAgent into OpenShift pods. OneAgent Operator runs an admission controller that can modify pods to inject OneAgent by adding an init container. This init container will download the OneAgent package and configure the other containers to be monitored.
When deployed in application-only mode, OneAgent monitors the memory, disk, CPU, and networking of processes within the container only. Host metrics aren't monitored.
This deployment strategy requires extra ephemeral storage:
Add a new project called dynatrace
.
oc adm new-project --node-selector="" dynatrace
Install OneAgent Operator.
OneAgent Operator acts on its dynatrace
namespace. You can also observe the logs of OneAgent Operator.
oc apply -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yamloc -n dynatrace logs -f deployment/dynatrace-oneagent-operator
Create the secret holding the PaaS token for authentication to the Dynatrace Cluster.
kubectl -n dynatrace create secret generic oneagent --from-literal="paasToken=PAAS_TOKEN"
Save the OneAgent custom resource definition. The rollout of Dynatrace OneAgent for application-only installations is governed by a custom resource of type OneAgentAPM
. Retrieve the cr-apm.yaml
file from the GitHub repository.
curl -o cr-apm.yaml https://raw.githubusercontent.com/Dynatrace/dynatrace-oneagent-operator/master/deploy/cr-apm.yaml
Adapt the values of the custom resource as follows:
required Specify the spec.apiUrl
parameter, which is the URL of your Dynatrace environment, for your SaaS, Managed, or ActiveGate instance.
optional Configure spec.useImmutableImage
to true
to pull a OneAgent Docker image from your Dynatrace environment. Use this parameter together with the agentVersion
parameter to control the version of OneAgent.
optional Configure spec.agentVersion
using semantic versioning (major.minor.patch
- example: 1.203.0
). If no version is specified, the OneAgent defaults to the latest version available.
optional Configure network zones by setting the spec.networkZone
parameter to your network zone.
spec:networkZone: <your_network_zone>
See network zones for more information.
Label your namespaces.
OneAgent Operator will inject into all pods that belong to namespaces labeled oneagent.dynatrace.com/instance
. The value for this label must be the name of the OneAgentAPM instance that you want to use for the configuration of the corresponding namespaces. You must label all namespaces you want to monitor. Note that the namespaces can point to
different OneAgentAPM instances.
oc label namespace default oneagent.dynatrace.com/instance=oneagentapm
Configure the injection.
You can configure the injection through OpenShift annotations.
These settings apply to all containers running on the corresponding pods.
Create the custom resource
kubectl apply -f cr-apm.yaml
Deploy your applications.
All deployed pods will then be monitored.
For troubleshooting purposes, you can view OneAgent logs, which by default are on /opt/dynatrace/oneagent-paas/log
inside the instrumented containers.
oc delete -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yaml
dynatrace
namespace. This will also delete OneAgentAPM objects.