Disconnect or Delete Clusters
Disconnect or delete a cluster
Disconnect vs. Delete
When you attach a cluster to Kommander that was not created with Kommander, you can later detach it. This does not alter the running state of the cluster, but simply removes it from the DKP UI. User workloads, platform services, and other Kubernetes resources are not cleaned up at detach.
After successfully detaching the cluster, manually disconnect the attached cluster's Flux installation from the management Git repository. Otherwise, changes to apps in the managed cluster's workspace will still be reflected on the cluster you just detached. Ensure your dkp
configuration references the target cluster. You can do this by setting the KUBECONFIG
environment variable to the appropriate kubeconfig file location. An alternative to initializing the KUBECONFIG
environment variable is to use the –kubeconfig=cluster_name.conf
flag. Then, run kubectl -n kommander-flux patch gitrepo management -p '{"spec":{"suspend":true}}' --type merge
to make the cluster's workloads not managed by Kommander, anymore.
If you created a managed cluster with Kommander, you cannot disconnect the cluster, but you can delete the cluster. This completely removes the cluster and all of its cloud assets.
We recommend deleting a managed cluster via the DKP UI.
If you delete the Management (Konvoy) cluster, you can not use Kommander to delete any Managed clusters created by Kommander. If you want to delete all clusters, ensure you delete any Managed clusters before finally deleting the Management cluster.
Statuses
See Statuses for a list of possible states a cluster can have when it is getting disconnected or deleted.
Troubleshooting
I cannot detach an attached cluster that is “Pending”
OR
The cluster I deleted via CLI still appears in the UI with “Error” state
Sometimes detaching or deleting a Kubernetes cluster causes that cluster to get stuck in a “Pending” or “Error” state. This can happen because the wrong kubeconfig
file is used, or the cluster is just not reachable. In order to detach the cluster, so it does not show in the UI, follow these steps:
Determine the
KommanderCluster
resource backing the cluster you tried to attach/detach:CODEkubectl -n WORKSPACE_NAMESPACE get kommandercluster
Replace
WORKSPACE_NAMESPACE
with the actual current workspace name. You can find this name by going tohttps://YOUR_CLUSTER_DOMAIN_OR_IP_ADDRESS/dkp/kommander/dashboard/workspaces
in your browser.Delete the cluster:
CODEkubectl -n WORKSPACE_NAMESPACE delete kommandercluster CLUSTER_NAME
If the resource does not go after a short time, remove its finalizers:
CODEkubectl -n WORKSPACE_NAMESPACE patch kommandercluster CLUSTER_NAME --type json -p '[{"op":"remove", "path":"/metadata/finalizers"}]'
This removes the cluster from the DKP UI.