Git Product home page Git Product logo

tidb-pulumi's Introduction

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

tidb-pulumi's People

Contributors

luohy15 avatar

Watchers

 avatar

tidb-pulumi's Issues

tidb pulumi demo

Pulumi is an Infra as Code tool similar to Terraform, which supports the use of general programming languages to implement infrastructure management.
Please implement a single-node TiDB service deployment module (without starting pd/tikv) in the K8s environment. When calling this module externally, you can specify

name
namespace
imageVersion
storageClass
storageSize
password

to create a tidb service and obtain the tidb service endpoint. Among them, password is an optional parameter. If the user specifies it, it will be used to initialize the root password of tidb. If it is not specified, it will not be set.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.