Issues with Setting Time Zone When Deploying TiDB on k8s

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: k8s部署tidb 设置时区问题

| username: TiDBer_NEw0xuKK

Yes, you can modify the timezone in the above configuration. If you want to set it to UTC+8, you can configure it as follows:

apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
  name: advanced-tidb
  namespace: default

spec:
  #######################
  # Basic Configuration #
  #######################

  ## TiDB cluster version
  version: "v5.4.0"

  ## Time zone of TiDB cluster Pods
  timezone: UTC+8
| username: songxuecheng | Original post link

Directly modify the YAML file.

| username: TiDBer_NEw0xuKK | Original post link

I followed your instructions and made the changes, but they didn’t take effect. If I create a new cluster, the changes do take effect. Is the configuration stored in the PV or somewhere else?

| username: TiDBer_NEw0xuKK | Original post link

Edit tc found it also took effect, but executing select now; in the MySQL client still shows UTC time.

| username: songxuecheng | Original post link

Have all the pods been rebuilt?

| username: TiDBer_NEw0xuKK | Original post link

Rebuilt it, deleting and recreating it is the same.

| username: songxuecheng | Original post link

Directly enter the pod and take a look.

| username: TiDBer_NEw0xuKK | Original post link

Which pod should I enter? How do I check it?

| username: Hi70KG | Original post link

Try running kubectl get pod --show-labels to check.
Change both PD and server, and give it a try.

| username: yiduoyunQ | Original post link

The time zone is configured when the cluster is first created. Subsequent adjustments can be made using SET GLOBAL time_zone = timezone;

| username: system | Original post link

This topic will be automatically closed 60 days after the last reply. No new replies are allowed.