tidb-operator/examples/basic-random-password
..
README.md
tidb-cluster.yaml

README.md

A Basic TiDB cluster with random password initialized

Note:

This setup is for test or demo purpose only and IS NOT applicable for critical environment.

The following steps will create a TiDB cluster with random password initialized.

Install

The following commands is assumed to be executed in this directory.

Install the cluster:

kubectl -n <namespace> apply -f ./

Wait for cluster Pods ready:

watch kubectl -n <namespace> get pod

Explore

Get the password from secret:

kubectl get secret basic-init -o=jsonpath='{.data.root}' -n <namespace>  | base64 --decode

Explore the TiDB SQL interface:

kubectl -n <namespace> port-forward svc/basic-tidb 4000:4000

Test connection successfully:

mysql -h 127.0.0.1 -P 4000 -u root -p <password> --comments

Destroy

kubectl -n <namespace> delete -f ./

The PVCs used by TiDB cluster will not be deleted in the above process, therefore, the PVs will be not be released neither. You can delete PVCs and release the PVs by the following command:

kubectl -n <namespace> delete pvc -l app.kubernetes.io/instance=basic,app.kubernetes.io/managed-by=tidb-operator