github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-mongodb/cluster-management/delete-mongodb-cluster.md (about) 1 --- 2 title: Delete a MongoDB Cluster 3 description: How to delete a MongoDB Cluster 4 keywords: [mongodb, delete a cluster, delete protection] 5 sidebar_position: 7 6 sidebar_label: Delete protection 7 --- 8 9 import Tabs from '@theme/Tabs'; 10 import TabItem from '@theme/TabItem'; 11 12 # Delete a MongoDB cluster 13 14 ## Termination policy 15 16 :::note 17 18 The termination policy determines how a cluster is deleted. Set the policy when creating a cluster. 19 20 ::: 21 22 | **terminationPolicy** | **Deleting Operation** | 23 |:-- | :-- | 24 | `DoNotTerminate` | `DoNotTerminate` blocks delete operation. | 25 | `Halt` | `Halt` deletes workload resources such as statefulset, deployment workloads but keep PVCs. | 26 | `Delete` | `Delete` deletes workload resources and PVCs but keep backups. | 27 | `WipeOut` | `WipeOut` deletes workload resources, PVCs and all relevant resources included backups. | 28 29 To check the termination policy, execute the following command. 30 31 <Tabs> 32 33 <TabItem value="kbcli" label="kbcli" default> 34 35 ```bash 36 kbcli cluster list mongodb-cluster 37 ``` 38 39 </TabItem> 40 41 <TabItem value="kubectl" label="kubectl"> 42 43 ```bash 44 kubectl -n demo get cluster mongodb-cluster 45 > 46 NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE 47 mongodb-cluster mongodb mongodb-5.0 Delete Running 17m 48 ``` 49 50 </TabItem> 51 52 </Tabs> 53 54 ## Steps 55 56 Run the command below to delete a specified cluster. 57 58 <Tabs> 59 60 <TabItem value="kbcli" label="kbcli" default> 61 62 ```bash 63 kbcli cluster delete mongodb-cluster 64 ``` 65 66 </TabItem> 67 68 <TabItem value="kubectl" label="kubectl"> 69 70 If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster. 71 72 ```bash 73 kubectl patch -n demo cluster mongodb-cluster -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge" 74 75 kubectl delete -n demo cluster mongodb-cluster 76 ``` 77 78 </TabItem> 79 80 </Tabs>