Deploy OneAgent on OpenShift for application-only monitoring

Dynatrace supports Full-Stack Monitoring for OpenShift, from the application down to the infrastructure layer. However, if you don't have access to the infrastructure layer, Dynatrace also provides the option of application-only monitoring. See below for instructions on how to set up Dynatrace to monitor your applications running on OpenShift.

Note: 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.

Prerequisites

Note: This deployment strategy requires extra ephemeral storage:

  • ~325 MB for glibc
  • ~290 MB for musl
  • ~650 MB for glibc and musl combined

Integrate OneAgent into your application

The following options explain how you can integrate OneAgent with OpenShift applications.

The application-only injection strategy uses OneAgent Operator. Support for using Dynatrace Operator to handle application-only injection is in development.

Update OneAgent

Each time a new version of Dynatrace OneAgent becomes available, you need to rebuild your applications’ Docker image. Following restart, your OpenShift applications will be monitored with the latest version of OneAgent.

If you've specified a default OneAgent installation version for new hosts and applications using OneAgent updates settings, your OpenShift applications will be automatically monitored by the defined default version of Dynatrace OneAgent.

For the automated application-only injection, recreate your pods to get the latest OneAgent version available.

Uninstall OneAgent

To uninstall OneAgent from application-only monitoring, simply remove references from your application or Docker image and redeploy the application.

Container build-time injection

  1. Remove these two lines of code from the application image.
COPY --from=<ACTIVEGATE-ADDRESS>/linux/oneagent-codemodules:<TECHNOLOGY> / /
ENV LD_PRELOAD /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so
  1. Rebuild the application image.
docker build -t yourapp .

Pod runtime injection

Remove the install-oneagent YAML from your deployment template.

k8s-app-only-run-time.yaml
Download
# your application containers
      containers:
      - name: customer-app
        image: tomcat
        env:
        - name: LD_PRELOAD
          value: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so
        volumeMounts:
        - mountPath: /opt/dynatrace/oneagent
          name: oneagent

# initContainer to download OneAgent
      initContainers:
      - name: install-oneagent
        image: alpine:3.8
        command:
        - /bin/sh
        args:
        - -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 $ARCHIVE
        env:
        - name: DT_API_URL
          value: https://<Your-environment-ID>.live.dynatrace.com/api
        - name: DT_PAAS_TOKEN
          value: <paastoken>
        - name: DT_ONEAGENT_OPTIONS
          value: flavor=<FLAVOR>&include=<TECHNOLOGY>
        volumeMounts:
        - mountPath: /opt/dynatrace/oneagent
          name: oneagent

# Make OneAgent available as a volume
      volumes:
      - name: oneagent
        emptyDir: {}

Automated application-only injection

  1. Uninstall OneAgent Operator.
oc delete -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yaml
  1. Delete the dynatrace namespace. This will also delete OneAgentAPM objects.
  2. Optional Remove the corresponding labels and annotations from namespaces/pods.
  3. Redeploy your pods.