This is unreleased documentation for Rancher Turtles v0.26-dev.

Rancher Cluster Deletion

Prerequisites

Delete the imported cluster from Rancher

The cluster-api.cattle.io/capi-cluster-owner and cluster-api.cattle.io/capi-cluster-owner-ns labels can be used to delete the Rancher Cluster:

kubectl delete clusters.management.cattle.io -l cluster-api.cattle.io/capi-cluster-owner=cluster1 -l cluster-api.cattle.io/capi-cluster-owner-ns=capi-clusters

Once the imported cluster is marked for deletion:

  1. Turtles controller will annotate the CAPI cluster with imported: true.

  2. This annotation prevents the cluster from being re-imported automatically by Rancher.

  3. Verify the annotation using the following command:

kubectl -n capi-clusters get clusters.cluster.x-k8s.io cluster1 -o json | jq .metadata.annotations
{
"imported": "true"
...
}
Deleting the Rancher cluster only removes the clusters.management.cattle.io resource and disables auto-import for the associated CAPI cluster. The underlying CAPI cluster iteself remains intact.

Re-import cluster

If you need to re-import the same CAPI cluster into Rancher:

Remove the imported: true annotation:

kubectl -n capi-clusters patch clusters.cluster.x-k8s.io <cluster-name> --type='json' -p='[{"op": "remove", "path": "/metadata/annotations/imported"}]'