Delete a Redis Cluster
Termination policy
note
The termination policy determines how a cluster is deleted.
terminationPolicy | Deleting Operation |
---|---|
DoNotTerminate | DoNotTerminate blocks delete operation. |
Halt | Halt deletes workload resources such as statefulset, deployment workloads but keep PVCs. |
Delete | Delete deletes workload resources and PVCs but keep backups. |
WipeOut | WipeOut deletes workload resources, PVCs and all relevant resources included backups. |
To check the termination policy, execute the following command.
- kbcli
- kubectl
kbcli cluster list redis-cluster
>
NAME NAMESPACE CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS CREATED-TIME
redis-cluster default redis redis-7.0.6 Delete Running Apr 10,2023 20:27 UTC+0800
kubectl -n demo get cluster redis
>
NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE
redis redis redis-7.0.6 Delete Running 10m
Step
Run the command below to delete a specified cluster.
- kbcli
- kubectl
kbcli cluster delete redis-cluster
If you want to delete a cluster and its all related resources, you can modify the termination policy to WipeOut
, then delete the cluster.
kubectl patch -n demo cluster redis -p '{"spec":{"terminationPolicy":"WipeOut"}}' --type="merge"
kubectl delete -n demo cluster redis