Symptom
Reinstalling the Prometheus agent after an uninstall fails with the following error:
rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: kind: ClusterRole, namespace: , name: arms-pilot-prom-k8sCause
A manual uninstall of the Prometheus agent may leave behind Kubernetes resources such as ClusterRoles. These leftover resources conflict with the reinstallation.
Solution
Step 1: Find leftover ClusterRoles
List the ClusterRoles associated with the Prometheus agent:
kubectl get ClusterRoles --all-namespaces | grep promStep 2: Delete the leftover ClusterRoles
Delete each ClusterRole returned in Step 1:
kubectl delete ClusterRole <cluster-role-name> -n arms-promReplace <cluster-role-name> with a ClusterRole name from the Step 1 output. Repeat for each listed ClusterRole.
Step 3: Delete other leftover resources if the issue persists
If the error still appears after deleting all ClusterRoles, check the kind field in the error message. This value indicates the conflicting resource type.
Use the same approach to find and delete the remaining resources:
List resources of the conflicting type:
kubectl get <resource-type> --all-namespaces | grep promDelete the matching resources:
kubectl delete <resource-type> <resource-name> -n arms-prom
Repeat until no conflicting resources remain.
Step 4: Verify the fix
Reinstall the Prometheus agent. The installation should complete without the "resource that already exists" error.
Applicable scope
Application Real-Time Monitoring Service (ARMS)
Managed Service for Prometheus