参考
https://docs.pingcap.com/zh/tidb-in-kubernetes/v1.5/prerequisites
镜像列表
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| alpine:3.16.0 bitnami/kubectl:latest busybox:1.26.2 grafana/grafana:6.0.1 grafana/grafana:7.5.7 k8s.gcr.io/kube-scheduler:v1.24.13 pingcap/advanced-statefulset:v0.3.3 pingcap/advanced-statefulset:v0.4.0 pingcap/ng-monitoring:v6.5.0 pingcap/pd:v6.5.0 pingcap/ticdc:v6.5.0 pingcap/tidb-backup-manager:v1.5.0-beta.1 pingcap/tidb-binlog:v6.5.0 pingcap/tidb-dashboard:v6.5.0 pingcap/tidb-monitor-initializer:v6.5.0 pingcap/tidb-monitor-reloader:v1.0.1 pingcap/tidb-operator:v1.5.0-beta.1 pingcap/tidb:v6.5.0 pingcap/tiflash:v6.5.0 pingcap/tikv:v6.5.0 prom/prometheus:v2.18.1 quay.io/prometheus-operator/prometheus-config-reloader:v0.49.0 tnir/mysqlclient:latest
|
注意手工处理一下kube-scheduler镜像,将其移动到默认库中。并同时修改TidbOperator的values.yaml:
1 2
| nerdctl tag harbor.dubhe:30002/k8s.gcr.io/kube-scheduler:v1.24.13 harbor.dubhe:30002/library/kube-scheduler:v1.24.13 nerdctl push harbor.dubhe:30002/library/kube-scheduler:v1.24.13
|
使用Helm安装tidb-operator
1 2 3 4
| wget http://charts.pingcap.org/tidb-operator-v1.5.0-beta.1.tgz tar -zxvf tidb-operator-v1.5.0-beta.1.tgz
helm install tidb-operator ./tidb-operator --namespace=tidb-admin --create-namespace
|
部署
yaml示例:
https://github.com/pingcap/tidb-operator/blob/master/examples/advanced/tidb-cluster.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| kubectl create -f ./crd.yaml
name: tidb-dubhe namespace: default requests: storageClassName: externalTrafficPolicy: mysqlNodePort: 30550
kubectl create namespace tidb kubectl apply -f tidb-cluster.yaml -n tidb
|
初始化
yaml示例:
https://github.com/pingcap/tidb-operator/blob/master/manifests/initializer/tidb-initializer.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| apiVersion: pingcap.com/v1alpha1 kind: TidbInitializer metadata: name: tidb-dubhe-init spec: image: tnir/mysqlclient cluster: name: tidb-dubhe initSql: |- create database app; passwordSecret: tidb-secret
kubectl create secret generic tidb-secret --from-literal=root=yourpass --namespace=tidb
kubectl apply -f tidb-initializer.yaml -n tidb
kubectl get svc -n tidb mysql://10.193.35.11:300550 root/yourpass
|
安装monitoring
yaml示例:
1 2 3 4
| kubectl apply -f tidb-monitor.yaml -n tidb
http://10.193.35.11:30552
|
安装dashboard
1 2 3 4 5
| kubectl apply -f tidb-dashboard.yaml -n tidb kubectl apply -f tidb-ng-monitoring.yaml -n tidb
http://10.193.35.11:30551/dashboard
|