Sign InTry Free

Destroy TiDB Clusters on Kubernetes

This document describes how to destroy TiDB clusters on Kubernetes.

Destroy a TiDB cluster managed by TidbCluster

To destroy a TiDB cluster managed by TidbCluster, run the following command:

kubectl delete tc ${cluster_name} -n ${namespace}

If you deploy the monitor in the cluster using TidbMonitor, run the following command to delete the monitor component:

kubectl delete tidbmonitor ${tidb_monitor_name} -n ${namespace}

Destroy a TiDB cluster managed by Helm

To destroy a TiDB cluster managed by Helm, run the following command:

helm uninstall ${cluster_name} -n ${namespace}

Delete data

The above commands that destroy the cluster only remove the running Pod, but the data is still retained. If you want to delete the data as well, use the following commands:

kubectl delete pvc -n ${namespace} -l app.kubernetes.io/instance=${cluster_name},app.kubernetes.io/managed-by=tidb-operator
kubectl get pv -l app.kubernetes.io/namespace=${namespace},app.kubernetes.io/managed-by=tidb-operator,app.kubernetes.io/instance=${cluster_name} -o name | xargs -I {} kubectl patch {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}'

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.