Delete vSphere Cluster
Prepare to delete a self-managed workload cluster
A self-managed workload cluster cannot delete itself. If your workload cluster is self-managed, you must create a bootstrap cluster and move the cluster lifecycle services to the bootstrap cluster before deleting the workload cluster.
If you did not make your workload cluster self-managed, as described in Make New Cluster Self-Managed, see Delete the workload cluster.
Create a bootstrap cluster:
The bootstrap cluster will host the Cluster API controllers that reconcile the cluster objects marked for deletion. To avoid using the wrong kubeconfig, the following steps use explicit kubeconfig paths and contexts.
CODEdkp create bootstrap --kubeconfig $HOME/.kube/config
The output resembles this example:
CODE✓ Creating a bootstrap cluster ✓ Initializing new CAPI components
Move the Cluster API objects from the workload to the bootstrap cluster: The cluster lifecycle services on the bootstrap cluster are ready, but the workload cluster configuration is on the workload cluster. The
move
command moves the configuration, which takes the form of Cluster API Custom Resource objects, from the workload to the bootstrap cluster. This process is also called a Pivot.CODEdkp move \ --from-kubeconfig ${CLUSTER_NAME}.conf \ --from-context konvoy-${CLUSTER_NAME}-admin@konvoy-${CLUSTER_NAME} \ --to-kubeconfig $HOME/.kube/config \ --to-context kind-konvoy-capi-bootstrapper
CODEINFO[2021-06-09T11:47:11-07:00] Running pivot command fromClusterKubeconfig=aws-example.conf fromClusterContext= src="move/move.go:83" toClusterKubeconfig=/home/clusteradmin/.kube/config toClusterContext= INFO[2021-06-09T11:47:36-07:00] Pivot operation complete. src="move/move.go:108" INFO[2021-06-09T11:47:36-07:00] You can now view resources in the moved cluster by using the --kubeconfig flag with kubectl. For example: kubectl --kubeconfig=/home/clusteradmin/.kube/config get nodes src="move/move.go:155"
Use the cluster lifecycle services on the workload cluster to check the workload cluster status:
CODEdkp describe cluster --kubeconfig $HOME/.kube/config -c ${CLUSTER_NAME}
CODENAME READY SEVERITY REASON SINCE MESSAGE Cluster/d2iq-e2e-cluster_name-1 True 13h ├─ClusterInfrastructure - VSphereCluster/d2iq-e2e-cluster_name-1 True 13h ├─ControlPlane - KubeadmControlPlane/d2iq-control-plane True 13h │ ├─Machine/d2iq--control-plane-7llgd True 13h │ ├─Machine/d2iq--control-plane-vncbl True 13h │ └─Machine/d2iq--control-plane-wbgrm True 13h └─Workers └─MachineDeployment/d2iq--md-0 True 13h ├─Machine/d2iq--md-0-74c849dc8c-67rv4 True 13h ├─Machine/d2iq--md-0-74c849dc8c-n2skc True 13h ├─Machine/d2iq--md-0-74c849dc8c-nkftv True 13h └─Machine/d2iq--md-0-74c849dc8c-sqklv True 13h
After moving the cluster lifecycle services to the workload cluster, remember to use dkp with the workload cluster kubeconfig. Use DKP with the bootstrap cluster to delete the workload cluster.
Wait for the cluster control-plane to be ready:
CODEkubectl --kubeconfig $HOME/.kube/config wait --for=condition=controlplaneready "clusters/${CLUSTER_NAME}" --timeout=60m
The output should be similar to this example:
CODEd2iq-e2e-cluster-1-control-plane/vsphere-example condition met
Persistent Volumes (PVs) are not deleted automatically by design in order to preserve your data. However, they take up storage space if not deleted. You must delete PVs manually. Information for backup of a cluster and PVs is on the page in documentation called Back up your Cluster's Applications and Persistent Volumes .
With Vsphere clusters, dkp delete
doesn't delete the virtual disks backing the PVs for DKP add ons. Therefore internal VMware cluster runs out of storage eventually. Theses PVs are only visible if VSAN is installed which gives users a Container Native Storage tab.
Delete the Workload Cluster
Make sure your vSphere credentials are up-to-date. Refresh the credentials using this command:
CODEdkp update bootstrap credentials vsphere --kubeconfig $HOME/.kube/config
To delete a cluster, you would use
dkp delete cluster
and pass in the name of the cluster you are trying to delete with--cluster-name
flag. You would usekubectl get clusters
to get those details (--cluster-name
and--namespace
) of the Kubernetes cluster to delete it.
NOTE: Do not usedkp get clusters
since that gets you Kommander cluster details rather than Konvoy kubernetes cluster details.CODEkubectl get clusters
Delete the Kubernetes cluster and wait a few minutes:
Before deleting the cluster, DKP deletes all Services of type LoadBalancer on the cluster.
To skip this step, use the flag
--delete-kubernetes-resources=false
.CODEdkp delete cluster --cluster-name=${CLUSTER_NAME} --kubeconfig $HOME/.kube/config
CODEINFO[2022-03-30T11:53:42-07:00] Running cluster delete command clusterName=d2iq-e2e-cluster-1 managementClusterKubeconfig= namespace=default src="cluster/delete.go:95" INFO[2022-03-30T11:53:42-07:00] Waiting for cluster to be fully deleted src="cluster/delete.go:123" INFO[2022-03-30T12:14:03-07:00] Deleted default/d2iq-e2e-cluster-1 cluster src="cluster/delete.go:129"
Delete the Bootstrap Cluster
After the workload cluster is deleted, delete the bootstrap cluster with the following command.
dkp delete bootstrap --kubeconfig $HOME/.kube/config
INFO[2021-06-09T12:15:20-07:00] Deleting bootstrap cluster src="bootstrap/bootstrap.go:182"
Next Step:
Once your cluster is built in the Konvoy component of DKP for your infrastructure/environment, you will install the Kommander component of DKP to see your dashboard and continue customization.
Known limitations
Be aware of these limitations in the current release of DKP Konvoy.
The DKP Konvoy version used to create the workload cluster must match the DKP Konvoy version used to delete the workload cluster.