Uninstalling the Instana agent on Kubernetes
To uninstall the Instana agent from Kubernetes deployments, use the following methods:
Uninstalling agents installed by using the operator
To uninstall the Instana agent that is installed by using the operator, follow the steps:
-
Uninstall the Instana agent by removing the custom resource YAML file:
kubectl delete -f instana-agent.customresource.yaml
-
Uninstall the operator by running the following command:
kubectl delete -f https://github.com/instana/instana-agent-operator/releases/latest/download/instana-agent-operator.yaml
Uninstalling agents installed by using the Helm Chart
To uninstall the Instana agent that is installed by using the Helm Chart, run the following commands:
NAMESPACE=instana-agent
# delete agent custom resource, the operator will remove the agent artifacts it is owning
kubectl 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
kubectl delete crd agents.instana.io
# remove the entire namespace
kubectl delete namespace ${NAMESPACE}
Instana agent Helm chart installations before version 2.0.0 do not install agent custom resources and custom resource definitions. For these installations, you might get notifications about resources that could not be found. This behavior is expected.
All the resources that are related to the host agent are removed.
The Instana Helm chart version 2 or later installs the instana-operator in the background. During uninstallation, Helm does not remove the custom resource definitions or custom resources automatically. Therefore, running only the helm uninstall
command is not sufficient.
Make sure to delete your agent custom resource (CR) before running the helm uninstall
command. Otherwise, the CR is not deleted from your cluster.
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
kubectl patch agents.instana.io instana-agent -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE}
# remove the cluster-wide objects
kubectl 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
kubectl delete ns ${NAMESPACE} --wait || true
To uninstall Instana AutoTrace WebHook, see Uninstalling the Instana AutoTrace WebHook.
Uninstalling agents installed by using a static YAML file
To uninstall the Instana agent that is installed by using a static YAML file, run the following command:
kubectl delete -f deployment.yaml