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.

Build time

  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 .

Runtime

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: {}