github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/kubeblocks-for-kafka/cluster-management/delete-kafka-cluster.md (about) 1 --- 2 title: Delete a kafka Cluster 3 description: How to delete a kafka Cluster 4 keywords: [kafka, 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 Kafka 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 kafka 37 ``` 38 39 </TabItem> 40 41 <TabItem value="kubectl" label="kubectl"> 42 43 ```bash 44 ~ kubectl -n default get cluster kafka 45 NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE 46 kafka kafka kafka-3.3.2 Delete Running 19m 47 ``` 48 49 </TabItem> 50 51 </Tabs> 52 53 ## Steps 54 55 Run the command below to delete a specified cluster. 56 57 <Tabs> 58 59 <TabItem value="kbcli" label="kbcli" default> 60 61 ```bash 62 kbcli cluster delete kafka 63 ``` 64 65 </TabItem> 66 67 <TabItem value="kubectl" label="kubectl"> 68 69 If you want to delete a cluster and its all related resources, you can modify the termination policy to `WipeOut`, then delete the cluster. 70 71 ```bash 72 kubectl patch -n demo cluster kafka -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge" 73 74 kubectl delete -n demo cluster kafka 75 ``` 76 77 </TabItem> 78 79 </Tabs>