Skip to content

Remove Operator

Simply Deleting/Removing an imported cluster in the Web Console (i.e. Controller) does not automatically remove all artifacts associated with the Kubernetes Mgmt Operator on imported clusters. We provide a tool that can be used to force remove/delete all remaining resources provisioned on imported clusters.


This utility will not delete user deployed resources because these are managed by the customer.


Run the utility provided below with the imported cluster's "bootstrap yaml" that was generated by the controller during the import process.

./ my-cluster-bootstrap.yaml

Force Remove Script

if [ $# -lt 1 ]; then
    echo "please specify the cluster bootstrap file location as an argument"
    echo  "Usage: ./ my-cluster-bootstrap.yaml" && exit -1
kubectl delete ValidatingWebhookConfiguration rafay-drift-validate
kubectl scale deployment rafay-connector -n rafay-system --replicas=0
kubectl delete rt v1-logging-infra -n rafay-infra
kubectl delete rt v2-prometheus -n rafay-infra
kubectl delete rt v2-alertmanager -n rafay-infra
kubectl delete rt v1-debug-infra -n rafay-system
kubectl delete rt v1-edge-client -n rafay-system
kubectl delete rt v2-ingress -n rafay-system
kubectl delete rt v2-relay-agent -n rafay-system
kubectl delete rt rafay-restricted-psp -n rafay-system
kubectl delete rt rafay-privileged-psp -n rafay-system
kubectl delete rt v2-infra -n rafay-system
kubectl delete rtl v2-infra -n rafay-system
sleep 30
kubectl delete rns rafay-infra --timeout=10s
kubectl delete rns rafay-system --timeout=10s
kubectl proxy &
for NAMESPACE in rafay-system rafay-infra
kubectl get rns $NAMESPACE -o json |jq '.metadata.finalizers = []' > temp.json
curl -ks -H "Content-Type: application/json" -X PUT --data-binary @temp.json$NAMESPACE/ > /dev/null 2>&1
kubectl delete namespace rafay-infra --timeout=10s
kubectl delete namespace rafay-system --timeout=10s
for NAMESPACE in rafay-system rafay-infra
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' > temp.json
curl -ks -H "Content-Type: application/json" -X PUT --data-binary @temp.json$NAMESPACE/finalize > /dev/null 2>&1
sleep 30
kubectl delete -f $1
killall -9 kubectl