Upgrade TiDB Operator and Kubernetes

This document describes how to upgrade TiDB Operator and Kubernetes.

Upgrade TiDB Operator

  1. Update CRD (Custom Resource Definition):

    kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/<version>/manifests/crd.yaml && \ kubectl get crd tidbclusters.pingcap.com
  2. Get the values.yaml file of the tidb-operator chart that you want to install:

    mkdir -p /home/tidb/tidb-operator/<version> && \ helm inspect values pingcap/tidb-operator --version=<version> > /home/tidb/tidb-operator/<version>/values-tidb-operator.yaml
  3. Modify the operatorImage image in the /home/tidb/tidb-operator/<version>/values-tidb-operator.yaml file. Merge the customized configuration in the old values.yaml file with the /home/tidb/tidb-operator/<version>/values-tidb-operator.yaml file, and execute helm upgrade:

    helm upgrade tidb-operator pingcap/tidb-operator --version=<version> -f /home/tidb/tidb-operator/<version>/values-tidb-operator.yaml

Upgrade Kubernetes

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.