Bks parameter logBackupTemplate

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

Original topic: bks参数logBackupTemplate

| username: liyuntang

[TiDB Usage Environment] Test environment Kubernetes environment, operator version 1.4.6
[TiDB Version] Enterprise Edition 7.1.0
[Reproduction Path] What operations were performed to cause the issue

[Encountered Issue: Problem Phenomenon and Impact]

  1. When creating bks and specifying logBackupTemplate as empty (multi-version, currently only version 7.1.0 supports log backup), a bk creation failure occurs after the cluster is created.
  2. When creating bks without specifying logBackupTemplate, the creation of bks fails with the following error message:
    BackupSchedule.pingcap.com “basic-backup-schedule” is invalid: spec.logBackupTemplate: Invalid value: “null”: spec.logBackupTemplate in body must be of type object: “null”

Questions:

  1. Can the logBackupTemplate parameter be omitted when creating bks?
  2. If the logBackupTemplate parameter must be specified, how can the bk creation failure issue be resolved?

bks configuration is as follows:

kubectl get bks -n $v5 -o yaml

apiVersion: v1
items:

  • apiVersion: pingcap.com/v1alpha1
    kind: BackupSchedule
    metadata:
    creationTimestamp: “2024-03-13T06:39:52Z”
    generation: 22
    name: basic-backup-schedule
    namespace: 9015e36d-9378-4637-9169-c71bf8d659fb
    resourceVersion: “641794849”
    selfLink: /apis/pingcap.com/v1alpha1/namespaces/9015e36d-9378-4637-9169-c71bf8d659fb/backupschedules/basic-backup-schedule
    uid: 6b6c9008-8fd6-4251-a7f8-f1a8f5341b95
    spec:
    backupTemplate:
    affinity:
    nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
    nodeSelectorTerms:
    - matchExpressions:
    - key: failure-domain.beta.kubernetes.io/zone
    operator: In
    values:
    - cn-qingyangtest-1a
    backoffRetryPolicy:
    maxRetryTimes: 2
    minRetryDuration: 300s
    retryTimeout: 30m
    backupMode: snapshot
    backupType: full
    br:
    cluster: basic
    clusterNamespace: 9015e36d-9378-4637-9169-c71bf8d659fb
    sendCredToTikv: true
    cleanPolicy: Retain
    resources: {}
    s3:
    bucket: tidb-ks3-bucket
    endpoint: http://ks.ksyun.com
    prefix: 20001/9fb/manual/
    provider: other
    region: BEIJING
    secretName: ks3-secret
    toolImage: hub.kce.ksyun/b/br:v5.4.1
    imagePullSecrets:
    • name: nosql-image
      logBackupTemplate:
      backoffRetryPolicy:
      maxRetryTimes: 2
      minRetryDuration: 300s
      retryTimeout: 30m
      backupMode: snapshot
      resources: {}
      maxBackups: 0
      schedule: ‘*/5 * * * *’
      storageClassName: openebs-hostpath
      status:
      lastBackup: basic-backup-schedule-2024-03-13t10-25-00
      lastBackupTime: “2024-03-13T10:25:00Z”
      logBackup: log-basic-backup-schedule
      kind: List
      metadata:
      resourceVersion: “”
      selfLink: “”
| username: TiDBer_5cwU0ltE | Original post link

Is deploying TiDB on K8S suitable for a production environment? Here, we only use physical machines…

| username: liyuntang | Original post link

Both production and testing are on Kubernetes.

| username: 小龙虾爱大龙虾 | Original post link

Are you saying that empty is written as logbackuptemplate: {}?

| username: yiduoyunQ | Original post link

1.4.4 introduced an issue (mistake) BR: Auto truncate log backup in backup schedule by WizardXiao · Pull Request #4904 · pingcap/tidb-operator · GitHub, and versions 1.4.4 to 1.4.6 all have problems.
Options:

  1. Roll back to 1.4.3
  2. Upgrade to 1.4.7 (only fixes this bug TiDB Operator 1.4. Release Notes | PingCAP 文档中心)

Note: Also update the corresponding CRD version (critical), 升级 TiDB Operator | PingCAP 文档中心

| username: liyuntang | Original post link

Yes, it is configured like this:

bks.Spec.LogBackupTemplate = &v1alpha1.BackupSpec{}

| username: 小龙虾爱大龙虾 | Original post link

This expert is right, upgrading the TiDB operator is the way to go. Here is the issue for reference: logBackupTemplate in backup schedule should be optional · Issue #4955 · pingcap/tidb-operator · GitHub