Upgrade TiDB Operator and Kubernetes
This document describes how to upgrade TiDB Operator and Kubernetes.
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.comGet 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 -n tidb-adminIn 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.yamlAfter 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
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.yamlDownload the
tidb-operator
chart package file.wget http://charts.pingcap.org/tidb-operator-v1.1.15.tgzDownload 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.yamlUnpack 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.yamlInstall 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.yamlAfter 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
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.