Uninstall OneAgent from OpenShift

Find out below how to uninstall OneAgent according to your particular deployment strategy. For a clear view of all the deployment alternatives, see OpenShift deployment strategies.

Uninstall OneAgent Operator with oc

In order to uninstall OneAgent Operator for OpenShift version 3.9+, follow the steps below.

Remove OneAgent custom resources and clean-up all remaining OneAgent Operator specific objects.

$ oc delete -n dynatrace oneagent --all
$ oc delete -f https://github.com/Dynatrace/dynatrace-oneagent-operator/releases/latest/download/openshift.yaml

Optional After you delete OneAgent Operator, the OneAgent binary remains on the node in an inactive state. To uninstall it completely, execute the uninstall.sh script and delete logs and configuration files.
See Linux related information.

Uninstall OneAgent Operator with Helm

Remove OneAgent custom resources and clean-up all remaining OneAgent Operator specific objects:

$ helm uninstall dynatrace-oneagent-operator -n dynatrace

Uninstall OneAgent for application-only monitoring

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

Container build-time injection

  1. Remove the 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 run-time injection

Remove the install-oneagent YAML from your deployment template.

# your application containers
      - name: customer-app
        image: tomcat
        - name: LD_PRELOAD
          value: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so
        - mountPath: /opt/dynatrace/oneagent
          name: oneagent

# initContainer to download OneAgent
      - name: install-oneagent
        image: alpine:3.8
        - /bin/sh
        - -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
        - 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>
        - mountPath: /opt/dynatrace/oneagent
          name: oneagent

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

Automated application-only injection

  1. Remove the label from the namespace.
  2. Redeploy your application.