Sign InTry Free

Upgrade TiDB Operator and Kubernetes

This document describes how to upgrade TiDB Operator and Kubernetes.

Upgrade TiDB Operator online

  1. 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
  2. Get the values.yaml file of the tidb-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-admin
  3. In the ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml file, modify the operatorImage version to the new TiDB Operator version. Merge the customized configuration in the old values.yaml file to the ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml file, and then execute helm 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

Upgrade TiDB Operator offline

If your server cannot access the Internet, you can take the following steps to upgrade TiDB Operator offline:

  1. Download the files and images required for the upgrade using a machine with the Internet access:

    1. 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
    2. Download the tidb-operator chart package file.

      wget http://charts.pingcap.org/tidb-operator-v1.1.15.tgz
    3. 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
  2. Upload the downloaded files and images to the server that needs to be upgraded, and then take the following steps for installation:

    1. Install the crd.yaml file for TiDB Operator:

      kubectl apply -f . /crd.yaml
    2. Unpack the tidb-operator chart package file, and then copy the values.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
    3. 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
  3. In the ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml file, modify the operatorImage version to the new TiDB Operator version. Merge the customized configuration in the old values.yaml file to the ${HOME}/tidb-operator/v1.1.15/values-tidb-operator.yaml file, and then execute helm 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

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.

Download PDF
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.