Skip to content

luohy15/tidb-pulumi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy

tidb-pulumi

This example deploys tidb instance onto a running Kubernetes cluster using Pulumi and @pulumi/kubernetes.

Pre-Requisites

  1. Install Pulumi
  2. Configure Kubernetes for Pulumi

Running the App

Install dependencies:

$ npm install

Create a new stack:

$ pulumi stack init

Preview the deployment of the application:

$ pulumi preview

(Optional) Prepare directory for local pv (refer to name, localStorage, storageNode and storagePath in index.ts):

# on k8s local pv node
$ mkdir -p /data/tidb

Perform the deployment:

$ pulumi up --skip-preview

This deployment is now running, and you can run commands like kubectl get pods to see the application's resources.

Use pulumi stack output to see the endpoint of the Service that we just deployed:

$ pulumi stack output

Forward this Service port:

$ kubectl port-forward svc/tidb 4000

Connect to tidb:

without password:

$ mysql -h 127.0.0.1 -P 4000 -u root

with password (mysql 5.7):

$ mysql -h 127.0.0.1 -P 4000 -u root -p

with password (mysql 8.0):

$ mysql -h 127.0.0.1 -P 4000 -u root -p --default-auth=mysql_native_password

When you're ready to be done with tidb, you can destroy the instance:

$ pulumi destroy --skip-preview

Configuration

index.ts

Parameter Default Default
name Name of pvc, deployment, service tidb
namespace Namespace of resources tidb
imageVersion Image tag latest
storageClass Type of persistent volume claim local-storage
storageSize Size of persistent volume claim 10Gi
localStorage Enable local storage false
storageNode Nodename of local storage pv node1
storagePath Parent path of local storage pv /data
password TiDB password, if not specified, there is no password pa55w0rd

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published