Skip to content

[BUG] backup restore cluster delete hang #9841

@JashBook

Description

@JashBook

Describe the bug
A clear and concise description of what the bug is.

kbcli version
Kubernetes: v1.30.4-vke.10
KubeBlocks: 1.1.0-alpha.3
kbcli: 1.0.1

wait for the workloads to be deleted: map[{workloads.kubeblocks.io/v1, Kind=InstanceSet default/mysql-bk-mysql}:0xc003928708]

To Reproduce
Steps to reproduce the behavior:

  1. create cluster
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
  name: mysql-ccxdow
  namespace: default
spec:
  clusterDef: mysql
  topology: semisync
  terminationPolicy: WipeOut
  componentSpecs:
    - name: mysql
      serviceVersion: 8.0.30
      
      disableExporter: true
      replicas: 2
      resources:
        limits:
          cpu: 100m
          memory: 0.5Gi
        requests:
          cpu: 100m
          memory: 0.5Gi
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName: 
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 20Gi
kubectl get cluster mysql-ccxdow -w
NAME           CLUSTER-DEFINITION   TERMINATION-POLICY   STATUS     AGE
mysql-ccxdow   mysql                WipeOut              Running    4m20s
  1. backup
kbcli cluster backup mysql-ccxdow  --method xtrabackup 
Backup backup-default-mysql-ccxdow-20251104152833 created successfully, you can view the progress:
	kbcli cluster list-backups --names=backup-default-mysql-ccxdow-20251104152833 -n default
  1. restore
kbcli cluster restore mysql-bk --backup backup-default-mysql-ccxdow-20251104152833
Cluster mysql-bk created

kubectl get cluster mysql-bk
NAME       CLUSTER-DEFINITION   TERMINATION-POLICY   STATUS    AGE
mysql-bk   mysql                WipeOut              Running   4m55s
  1. delete restore cluster
kbcli cluster delete mysql-bk --auto-approve 
Cluster mysql-bk deleted
  1. See error
kubectl get cluster mysql-bk 
NAME       CLUSTER-DEFINITION   TERMINATION-POLICY   STATUS     AGE
mysql-bk   mysql                WipeOut              Deleting   10m
➜  ~ 
➜  ~ kubectl get pod -l app.kubernetes.io/instance=mysql-bk                                 
No resources found in default namespace.
➜  ~ 
➜  ~ kubectl get cmp -l app.kubernetes.io/instance=mysql-bk           
NAME             DEFINITION                SERVICE-VERSION   STATUS     AGE
mysql-bk-mysql   mysql-8.0-1.1.0-alpha.0   8.0.30            Deleting   11m
➜  ~ 
➜  ~ kubectl get its -l app.kubernetes.io/instance=mysql-bk                                
NAME             DESIRED   UP-TO-DATE   READY   AVAILABLE   AGE
mysql-bk-mysql   2                      2       2           10m
➜  ~ 
➜  ~ kubectl get svc -l app.kubernetes.io/instance=mysql-bk
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
mysql-bk-mysql   ClusterIP   10.225.218.96   <none>        3306/TCP   11m
➜  ~ 
➜  ~ kubectl get cm -l app.kubernetes.io/instance=mysql-bk
NAME                                           DATA   AGE
mysql-bk-mysql-env                             5      11m
mysql-bk-mysql-haconfig                        0      9m1s
mysql-bk-mysql-hahistory                       1      6m27s
mysql-bk-mysql-leader                          0      9m1s
mysql-bk-mysql-mysql-scripts                   6      11m
sidecar-mysql-bk-mysql-config-manager-config   1      11m
➜  ~ 
➜  ~ kubectl get secret -l app.kubernetes.io/instance=mysql-bk
NAME                                      TYPE     DATA   AGE
mysql-bk-mysql-account-kbadmin            Opaque   2      11m
mysql-bk-mysql-account-kbdataprotection   Opaque   2      11m
mysql-bk-mysql-account-kbmonitoring       Opaque   2      11m
mysql-bk-mysql-account-kbprobe            Opaque   2      11m
mysql-bk-mysql-account-kbreplicator       Opaque   2      11m
mysql-bk-mysql-account-proxysql           Opaque   2      11m
mysql-bk-mysql-account-root               Opaque   2      11m

describe cluster

kubectl describe cluster mysql-bk 
Name:         mysql-bk
Namespace:    default
Labels:       clusterdefinition.kubeblocks.io/name=mysql
Annotations:  kubeblocks.io/crd-api-version: apps.kubeblocks.io/v1
API Version:  apps.kubeblocks.io/v1
Kind:         Cluster
Metadata:
  Creation Timestamp:             2025-11-04T07:30:39Z
  Deletion Grace Period Seconds:  0
  Deletion Timestamp:             2025-11-04T07:35:41Z
  Finalizers:
    cluster.kubeblocks.io/finalizer
  Generation:        2
  Resource Version:  86704
  UID:               740ad715-4abf-4a84-96dc-ed8bddedaeec
Spec:
  Cluster Def:  mysql
  Component Specs:
    Component Def:          mysql-8.0-1.1.0-alpha.0
    Disable Exporter:       true
    Flat Instance Ordinal:  false
    Name:                   mysql
    Pod Update Policy:      PreferInPlace
    Replicas:               2
    Resources:
      Limits:
        Cpu:     100m
        Memory:  512Mi
      Requests:
        Cpu:          100m
        Memory:       512Mi
    Service Version:  8.0.30
    Volume Claim Templates:
      Name:  data
      Spec:
        Access Modes:
          ReadWriteOnce
        Resources:
          Requests:
            Storage:   20Gi
  Termination Policy:  WipeOut
  Topology:            semisync
Status:
  Components:
    Mysql:
      Observed Generation:  1
      Phase:                Running
      Up To Date:           true
  Conditions:
    Last Transition Time:  2025-11-04T07:30:39Z
    Message:               The operator has started the provisioning of Cluster: mysql-bk
    Observed Generation:   1
    Reason:                PreCheckSucceed
    Status:                True
    Type:                  ProvisioningStarted
    Last Transition Time:  2025-11-04T07:30:39Z
    Message:               Successfully applied for resources
    Observed Generation:   1
    Reason:                ApplyResourcesSucceed
    Status:                True
    Type:                  ApplyResources
    Last Transition Time:  2025-11-04T07:35:30Z
    Message:               cluster mysql-bk is ready
    Reason:                ClusterReady
    Status:                True
    Type:                  Ready
  Observed Generation:     1
  Phase:                   Deleting
Events:
  Type    Reason                           Age                    From                Message
  ----    ------                           ----                   ----                -------
  Normal  PreCheckSucceed                  11m                    cluster-controller  The operator has started the provisioning of Cluster: mysql-bk
  Normal  ApplyResourcesSucceed            11m                    cluster-controller  Successfully applied for resources
  Normal  ClusterComponentPhaseTransition  11m (x2 over 11m)      cluster-controller  cluster component mysql is Creating
  Normal  ClusterReady                     7m5s                   cluster-controller  cluster mysql-bk is ready
  Normal  Running                          7m5s                   cluster-controller  Cluster: mysql-bk is ready, current phase is Running
  Normal  ClusterComponentPhaseTransition  6m58s (x6 over 7m5s)   cluster-controller  cluster component mysql is Running
  Normal  DeletingCR                       6m54s (x3 over 6m54s)  cluster-controller  Deleting : mysql-bk

logs kubeblocks

➜  ~ kubectl logs -n kb-system kubeblocks-85864d9c7-cql5g|grep "wait for the workloads"|grep mysql-bk-mysql
Defaulted container "manager" out of: manager, tools (init)
2025-11-04T07:35:41.702Z	INFO	wait for the workloads to be deleted: map[{workloads.kubeblocks.io/v1, Kind=InstanceSet default/mysql-bk-mysql}:0xc003928708]	{"controller": "component", "controllerGroup": "apps.kubeblocks.io", "controllerKind": "Component", "Component": {"name":"mysql-bk-mysql","namespace":"default"}, "namespace": "default", "name": "mysql-bk-mysql", "reconcileID": "beac1f2e-9b30-4d4d-9ce9-8256dd31b099", "component": {"name":"mysql-bk-mysql","namespace":"default"}}
2025-11-04T07:35:41.787Z	INFO	wait for the workloads to be deleted: map[{workloads.kubeblocks.io/v1, Kind=InstanceSet default/mysql-bk-mysql}:0xc003c95108]	{"controller": "component", "controllerGroup": "apps.kubeblocks.io", "controllerKind": "Component", "Component": {"name":"mysql-bk-mysql","namespace":"default"}, "namespace": "default", "name": "mysql-bk-mysql", "reconcileID": "d5227335-f03a-4a2f-9a39-1b638f9fff39", "component": {"name":"mysql-bk-mysql","namespace":"default"}}
2025-11-04T07:35:41.860Z	INFO	wait for the workloads to be deleted: map[{workloads.kubeblocks.io/v1, Kind=InstanceSet default/mysql-bk-mysql}:0xc003fe8708]	{"controller": "component", "controllerGroup": "apps.kubeblocks.io", "controllerKind": "Component", "Component": {"name":"mysql-bk-mysql","namespace":"default"}, "namespace": "default", "name": "mysql-bk-mysql", "reconcileID": "5cb551b2-6f6f-4fdb-98c1-796666f41ca4", "component": {"name":"mysql-bk-mysql","namespace":"default"}}

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions