- Introduction
- Get Started
- Deploy
- Deploy TiDB Cluster
- Deploy Heterogeneous Cluster
- Deploy TiFlash
- Deploy TiCDC
- Deploy TiDB Binlog
- Deploy Multiple Sets of TiDB Operator
- Deploy Monitoring
- Secure
- Operate
- Upgrade TiDB Cluster
- Upgrade TiDB Operator
- Perform a Canary Upgrade
- Pause Sync of TiDB Cluster
- Scale TiDB Cluster
- Backup and Restore
- Overview
- Grant Permissions to Remote Storage
- Backup and Restore with S3-Compatible Storage
- Backup and Restore with GCS
- Backup and Restore with Persistent Volumes
- Restart a TiDB Cluster
- Maintain a Kubernetes Node
- View TiDB Logs
- Configure Automatic Failover
- Destroy a TiDB Cluster
- Migrate from Helm 2 to Helm 3
- Disaster Recovery
- Import Data
- Troubleshoot
- FAQs
- Reference
- Architecture
- Sysbench Performance Test
- API References
- Cheat Sheet
- Tools
- Configure
- Log Collection
- Monitoring and Alert on Kubernetes
- Release Notes
- v1.1
- v1.0
- v0
Upgrade TiDB Operator and Kubernetes
This document describes how to upgrade TiDB Operator and Kubernetes.
You can check the currently supported versions of TiDB Operator using the helm search repo -l tidb-operator
command.
If the command output does not include the latest version, update the repo using the helm repo update
command. For details, refer to Configure the Help repo.
Upgrade TiDB Operator online
Update CustomResourceDefinition (CRD) for Kubernetes. For more information about CRD, see CustomResourceDefinition.
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.1.15/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com
Get the
values.yaml
file of thetidb-operator
chart for the new TiDB Operator version.mkdir -p ${HOME}/tidb-operator/v1.1.15 && \ helm inspect values pingcap/tidb-operator --version=v1.1.15 > ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
In the
${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
file, modify theoperatorImage
version to the new TiDB Operator version. Merge the customized configuration in the oldvalues.yaml
file to the${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
file, and then executehelm upgrade
:helm upgrade tidb-operator pingcap/tidb-operator --version=v1.1.15 -f ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
After all the Pods start normally, execute the following command to check the image of TiDB Operator:
kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:'
If TiDB Operator is successfully upgraded, the expected output is as follows.
v1.1.15
represents the desired version of TiDB Operator.image: pingcap/tidb-operator:v1.1.15 image: docker.io/pingcap/tidb-operator:v1.1.15 image: pingcap/tidb-operator:v1.1.15 image: docker.io/pingcap/tidb-operator:v1.1.15
NoteAfter TiDB Operator is upgraded, the
discovery
deployment in all TiDB clusters will be automatically upgraded to the corresponding version of TiDB Operator.
Upgrade TiDB Operator offline
If your server cannot access the Internet, you can take the following steps to upgrade TiDB Operator offline:
Download the files and images required for the upgrade using a machine with the Internet access:
Download the
crd.yaml
file for the new TiDB Operator version. For more information about CRD, see CustomResourceDefinition.wget https://raw.githubusercontent.com/pingcap/tidb-operator/v1.1.15/manifests/crd.yaml
Download the
tidb-operator
chart package file.wget http://charts.pingcap.org/tidb-operator-v1.1.15.tgz
Download the Docker images required for the new TiDB Operator version:
docker pull pingcap/tidb-operator:v1.1.15 docker pull pingcap/tidb-backup-manager:v1.1.15 docker save -o tidb-operator-v1.1.15.tar pingcap/tidb-operator:v1.1.15 docker save -o tidb-backup-manager-v1.1.15.tar pingcap/tidb-backup-manager:v1.1.15
Upload the downloaded files and images to the server that needs to be upgraded, and then take the following steps for installation:
Install the
crd.yaml
file for TiDB Operator:kubectl apply -f . /crd.yaml
Unpack the
tidb-operator
chart package file, and then copy thevalues.yaml
file:tar zxvf tidb-operator-v1.1.15.tgz && \ mkdir -p ${HOME}/tidb-operator/v1.1.15 && cp tidb-operator/values.yaml ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
Install the Docker images on the server:
docker load -i tidb-operator-v1.1.15.tar docker load -i tidb-backup-manager-v1.1.15.tar
In the
${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
file, modify theoperatorImage
version to the new TiDB Operator version. Merge the customized configuration in the oldvalues.yaml
file to the${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
file, and then executehelm upgrade
:helm upgrade tidb-operator ./tidb-operator --version=v1.1.15 -f ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml
After all the Pods start normally, execute the following command to check the image version of TiDB Operator:
kubectl get po -n tidb-admin -l app.kubernetes.io/instance=tidb-operator -o yaml | grep 'image:.*operator:'
If TiDB Operator is successfully upgraded, the expected output is as follows.
v1.1.15
represents the new version of TiDB Operator.image: pingcap/tidb-operator:v1.1.15 image: docker.io/pingcap/tidb-operator:v1.1.15 image: pingcap/tidb-operator:v1.1.15 image: docker.io/pingcap/tidb-operator:v1.1.15
NoteAfter TiDB Operator is upgraded, the
discovery
deployment in all TiDB clusters will be automatically upgraded to the specified version of TiDB Operator.
Upgrade TiDB Operator from v1.0 to v1.1 or later releases
Since TiDB Operator v1.1.0, PingCAP no longer updates or maintains the tidb-cluster chart. The components and features that have been managed using the tidb-cluster chart will be managed by CR (Custom Resource) or dedicated charts in v1.1. For more details, refer to TiDB Operator v1.1 Notes.