Uninstalling the Instana agent on Red Hat OpenShift
You can uninstall the Instana agent on Red Hat OpenShift by using different methods, depending on how the agent was deployed.
Before you begin
Before uninstalling the Instana agent, you need to uninstall the tracers (or in-process collectors) that are installed in your application runtimes.
If your Red Hat OpenShift environment contains PHP runtimes and PHP tracing is enabled (by default) in the agent configuration in spec.agent.configuration_yaml (configuration.yaml), you need to uninstall PHP Tracer by following the steps that are described in Disabling PHP tracing.
After uninstalling the tracers, you can proceed to uninstall the Instana agent from Red Hat OpenShift using the following methods:
Uninstalling the agent that is installed by using operator
To uninstall the agent that is installed by using operator, complete the following steps:
-
Uninstall the Instana agent by removing the custom resource:
oc delete -f instana-agent.customresource.yaml -
Uninstall the operator by running the following command:
oc delete -f https://github.com/instana/instana-agent-operator/releases/latest/download/instana-agent-operator.yaml
Uninstalling the host agent that is installed by using Helm chart
helm uninstall command. Otherwise, the CR is not deleted from your cluster.To uninstall the Instana agent that is installed by using the Helm chart, run the following command:
NAMESPACE=instana-agent
# delete agent custom resource, the operator will remove the agent artifacts it is owning
oc delete agents.instana.io instana-agent -n ${NAMESPACE} --wait
# uninstall helm chart which removes the operator and RBAC artifacts
helm uninstall instana-agent -n ${NAMESPACE}
# manually uninstall the custom resource definition which is not uninstalled by helm
oc delete crd agents.instana.io
# remove the entire namespace
oc delete namespace ${NAMESPACE}
When you run the command, all the resources that are related to the agent are removed.
If you run the helm uninstall command first before deleting the CR, use the following commands to remove the entire agent installation on the cluster:
NAMESPACE=instana-agent
# remove the finalizer
oc patch agents.instana.io instana-agent -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE}
# remove the cluster-wide objects
oc delete crd/agents.instana.io clusterrole/leader-election-role clusterrole/instana-agent-clusterrole clusterrolebinding/leader-election-rolebinding clusterrolebinding/instana-agent-clusterrolebinding
# remove helm chart,if still present
helm uninstall instana-agent -n ${NAMESPACE} || true
# delete the entire namespace
oc delete ns ${NAMESPACE} --wait || true
To uninstall Instana AutoTrace WebHook, see Uninstalling the Instana AutoTrace WebHook.