| title | Upgrade TiDB Operator and Kubernetes |
|---|---|
| summary | Learn how to upgrade TiDB Operator and Kubernetes. |
| category | how-to |
This document describes how to upgrade TiDB Operator and Kubernetes.
-
Update CRD (Custom Resource Definition):
{{< copyable "shell-regular" >}}
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/${version}/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com
Note:
The
${version}in this document represents the version of TiDB Operator, such asv1.1.0. You can check the currently supported version using thehelm search -l tidb-operatorcommand. -
Get the
values.yamlfile of thetidb-operatorchart that you want to install:{{< copyable "shell-regular" >}}
mkdir -p /home/tidb/tidb-operator/${version} && \ helm inspect values pingcap/tidb-operator --version=${version} > /home/tidb/tidb-operator/${version}/values-tidb-operator.yaml
-
Modify the
operatorImageimage in the/home/tidb/tidb-operator/${version}/values-tidb-operator.yamlfile. Merge the customized configuration in the oldvalues.yamlfile with the/home/tidb/tidb-operator/${version}/values-tidb-operator.yamlfile, and executehelm upgrade:{{< copyable "shell-regular" >}}
helm upgrade tidb-operator pingcap/tidb-operator --version=${version} -f /home/tidb/tidb-operator/${version}/values-tidb-operator.yaml
Note:
After TiDB Operator is upgraded, the
discoverydeployment in all TiDB clusters will automatically upgrade to the specified version of TiDB Operator.
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.
When there is a major version upgrade of Kubernetes, you need to make sure that kubeSchedulerImageTag matches the version. By default, this value is generated by Helm during the installation or upgrade process. To reset this value, execute helm upgrade.