Deploy TiDB Operator on Kubernetes
This document describes how to deploy TiDB Operator on Kubernetes.
Prerequisites
Before deploying TiDB Operator, make sure your environment meets the following software requirements:
Deploy a Kubernetes cluster
TiDB Operator runs in a Kubernetes cluster. You can set up a Kubernetes cluster using one of the following options:
- Self-managed cluster: set up a self-managed Kubernetes cluster using any method described in the Kubernetes official documentation.
- Cloud provider: use a Kubernetes service provided by a Kubernetes certified cloud provider.
Whichever option you choose, make sure your Kubernetes version is v1.30 or later. To quickly create a simple cluster for testing, see Get Started.
Deploy TiDB Operator CRDs
Run the following command to install the Custom Resource Definitions (CRDs) required by TiDB Operator:
kubectl apply -f https://github.com/pingcap/tidb-operator/releases/download/v2.0.0-beta.0/tidb-operator.crds.yaml --server-side
Deploy TiDB Operator
You can deploy TiDB Operator using either of the following methods:
Method 1: Deploy using kubectl apply
All resources required to install TiDB Operator (except CRDs), including RBAC and Deployment objects, are packaged in the tidb-operator.yaml
file. You can deploy everything with a single command:
kubectl apply -f https://github.com/pingcap/tidb-operator/releases/download/v2.0.0-beta.0/tidb-operator.yaml --server-side
TiDB Operator will be deployed in the tidb-admin
namespace. To verify the deployment, run:
kubectl get pods -n tidb-admin
Expected output:
NAME READY STATUS RESTARTS AGE
tidb-operator-6c98b57cc8-ldbnr 1/1 Running 0 2m
Method 2: Deploy using Helm
Use Helm to deploy all resources except CRDs:
helm install tidb-operator oci://ghcr.io/pingcap/charts/tidb-operator --version v2.0.0-beta.0 --namespace tidb-admin --create-namespace
TiDB Operator will be deployed in the tidb-admin
namespace. To verify the deployment, run:
kubectl get pods -n tidb-admin
Expected output:
NAME READY STATUS RESTARTS AGE
tidb-operator-6c98b57cc8-ldbnr 1/1 Running 0 2m
Customize the deployment
To customize deployment parameters, first export the default values.yaml
file:
helm show values oci://ghcr.io/pingcap/charts/tidb-operator --version v2.0.0-beta.0 > values.yaml
Edit the values.yaml
file as needed, then install TiDB Operator with the customized settings:
helm install tidb-operator oci://ghcr.io/pingcap/charts/tidb-operator --version v2.0.0-beta.0 -f values.yaml