Re-adopt Member Clusters to Another Host Cluster
This section describes how to re-adopt a removed member cluster to another host cluster.
Unbinding a Cluster in Normal State
If a member cluster is removed while in a normal state, no additional operations are required. The member cluster can be directly adopted by another host cluster. For detailed steps, please refer to Add a Member Cluster.
Unbinding a Cluster in Abnormal State
If a member cluster is removed while in an abnormal state, execute the following command on the member cluster to clear its adoption information. After that, the cluster can be normally adopted by another host cluster.
kubectl patch ns kubesphere-system --type merge -p '{"metadata":{"annotations": null}}'
Cleaning Up Multi-cluster Configuration Data
After a cluster is unbound, the original resources and multi-cluster configuration data within the cluster are not automatically cleared. If the unbound cluster has workspace-related configurations, execute the following command to manually clean up the configuration data in the removed cluster before proceeding with adoption.
for ns in $(kubectl get ns --field-selector status.phase!=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl label ns $ns kubesphere.io/workspace- && kubectl patch ns $ns --type merge -p '{"metadata":{"ownerReferences":[]}}'; done