K8S部署TiDB

安装 TiDB Operator CRDs

kubectl -n tidb-cluster apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-monitor.yaml
#  kubectl get crd
NAME                                 CREATED AT
backups.pingcap.com                  2022-04-24T13:43:42Z
backupschedules.pingcap.com          2022-04-24T13:43:42Z
blockdeviceclaims.openebs.io         2022-04-21T12:04:27Z
blockdevices.openebs.io              2022-04-21T12:04:27Z
dmclusters.pingcap.com               2022-04-24T13:43:42Z
restores.pingcap.com                 2022-04-24T13:43:42Z
tidbclusterautoscalers.pingcap.com   2022-04-24T13:43:42Z
tidbclusters.pingcap.com             2022-04-24T13:43:43Z
tidbinitializers.pingcap.com         2022-04-24T13:43:43Z
tidbmonitors.pingcap.com             2022-04-24T13:43:43Z
tidbngmonitorings.pingcap.com        2022-04-24T13:43:43Z

安装 TiDB Operator

helm repo add pingcap https://charts.pingcap.org/
kubectl create namespace tidb-admin
helm install --namespace tidb-admin tidb-operator pingcap/tidb-operator --version v1.3.2 \
    --set operatorImage=registry.cn-beijing.aliyuncs.com/tidb/tidb-operator:v1.3.2 \
    --set tidbBackupManagerImage=registry.cn-beijing.aliyuncs.com/tidb/tidb-backup-manager:v1.3.2 \
    --set scheduler.kubeSchedulerImageName=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler
#  kubectl get po -n tidb-admin
NAME                                       READY   STATUS    RESTARTS   AGE
tidb-controller-manager-749c95569c-z8hzm   1/1     Running   0          71m
tidb-scheduler-5b96c9c6f8-r2772            2/2     Running   0          71m

部署 TiDB 集群和监控

kubectl create namespace tidb-cluster && \
    kubectl -n tidb-cluster apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-cluster.yaml
  
	
kubectl -n tidb-cluster apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-monitor.yaml
[root@master128 tidb]#  kubectl get po -n tidb-cluster
NAME                                 READY   STATUS    RESTARTS   AGE
basicoo-discovery-68546ccb4c-j9ddh   1/1     Running   0          57m
basicoo-monitor-0                    4/4     Running   0          52m
basicoo-pd-0                         1/1     Running   0          57m
basicoo-tidb-0                       2/2     Running   0          55m
basicoo-tikv-0                       1/1     Running   0          57m

直接连接无密码登录

mysql --comments -h 127.0.0.1 -P 14000 -u root

K8S部署TiDB_第1张图片

官网点击官网官网

你可能感兴趣的:(Kubernetes,存储,dba)