github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/tidb/README.md (about)

     1  # Overview
     2  
     3  This image chooses OpenEBS LocalPV as its persistence storage engine.
     4  
     5  Components included in this image:
     6  
     7  * 1 TiDB operator deployment resource.
     8  * 3 TiDB pd replicas which requests "20Gi" storage.
     9  * 3 TiDB tikv replicas which requests "50Gi" storage.
    10  * 2 tidb server using ClusterIP to expose service.
    11  * deploy TiDB monitor using grafana and prometheus which requests "50Gi" storage.
    12  
    13  ## How to use it
    14  
    15  ### Access the database
    16  
    17  By default, we use Cluster IP to expose the console service outside the k8s cluster.
    18  
    19  Get the tidb Cluster IP:
    20  
    21  ```shell
    22  kubectl get svc -n tidb-system | grep basic-tidb-cluster-tidb
    23  basic-tidb-cluster-tidb        ClusterIP   10.96.3.124   <none>        4000/TCP,10080/TCP    15h
    24  ```
    25  
    26  Access tidb database:
    27  
    28  `mysql -h ${tidb_lb_ip} -p 4000 -u root`
    29  
    30  `tidb_lb_ip` is the cluster IP of the TiDB service.
    31  
    32  ### Monitor
    33  
    34  Access the Grafana monitoring dashboard,you can run the kubectl port-forward command to access the Grafana monitoring
    35  dashboard,then open [http://localhost:3000](http://localhost:3000) in your browser and log on with the default username and password admin.
    36  
    37  `kubectl port-forward -n tidb-system svc/basic-tidb-cluster-grafana 3000:3000 &>/tmp/portforward-grafana.log &`
    38  
    39  Or access grafana dashboard with node port.
    40  
    41  ```shell
    42  kubectl get svc -n tidb-system basic-tidb-cluster-grafana
    43  
    44  NAME                         TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
    45  basic-tidb-cluster-grafana   NodePort   10.96.0.225   <none>        3000:31180/TCP   18m
    46  ```
    47  
    48  Access the prometheus monitoring data, run the kubectl port-forward command to access it.open [http://localhost:9090](http://localhost:9000) in
    49  your browser or access this address via a client tool.
    50  
    51  `kubectl port-forward -n tidb-system svc/basic-tidb-cluster-prometheus 9090:9090 &>/tmp/portforward-prometheus.log &`
    52  
    53  Or access prometheus server with node port.
    54  
    55  ```shell
    56  kubectl get svc -n tidb-system basic-tidb-cluster-prometheus
    57  
    58  NAME                            TYPE       CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
    59  basic-tidb-cluster-prometheus   NodePort   10.96.0.142   <none>        9090:31772/TCP   18m
    60  ```
    61  
    62  ## How to rebuild it
    63  
    64  Modify manifest yaml file according to your needs, then run below command to rebuild it.
    65  
    66  ```shell
    67  sealer build -t {Your Image Name} -f Kubefile -m cloud .
    68  ```
    69  
    70  More parameters see [official document here](https://docs.pingcap.com/zh/tidb-in-kubernetes/stable).