# Not able to create PerconaXtraDBClusterRestore resource on kubernetes

**URL:** <https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [March 14, 2023, 12:56pm UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564 "2023-03-14T12:56:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sai\_Shashank\_Bandela](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sai_shashank_bandela/32/9724_2.png) [@Sai\_Shashank\_Bandela](https://forums.percona.com/u/Sai_Shashank_Bandela)\
**Post date:** [March 14, 2023, 12:56pm UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564/1 "2023-03-14T12:56:13Z")

</div>

Hi all,

Using the following restore.yaml to create PerconaXtraDBClusterRestore

```auto
apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBClusterRestore
metadata:
  name: restore
  namespace: dkube-infra
spec:
  pxcCluster: mysql-db-pxc-db
  backupSource:
    destination: s3://dkube/backup/mysql-pxc-cluster/manual/
    s3:
      region: us-east-1
      credentialsSecret: mysql-pxc-backup-secret
      endpointUrl: http://dkube-minio-server:9000

```

It fails with the following error.

```auto
status:
  comments: 'run restore: s3: create job: Job.batch "restore-job-restore-mysql-db-pxc-db-mysql-db-pxc-db"
    is invalid: [spec.template.metadata.labels[controller-uid]: Invalid value: map[string]string{"controller-uid":"2bc05a56-6491-4598-8295-040d55d6f62c",
    "job-name":"restore-job-restore-mysql-db-pxc-db-mysql-db-pxc-db"}: must be ''3c7aca1d-f905-406b-9bd7-702bf5592dcd'',
    spec.template.metadata.labels: Invalid value: map[string]string{"controller-uid":"2bc05a56-6491-4598-8295-040d55d6f62c",
    "job-name":"restore-job-restore-mysql-db-pxc-db-mysql-db-pxc-db"}: selector
    does not match template labels]'
  state: Failed

```

Any idea why is the coming?  
The 1st time when I restore, it works fine.  
But the 2nd time when I try to restore it gives this error.

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [March 15, 2023, 12:42pm UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564/2 "2023-03-15T12:42:58Z")

</div>

Hello @Sai_Shashank_Bandela ,

can you please share both restore CRs that you create? I assume they have different names, but anything else is different?

Also which version of the operator is it?

---

<div class="post-metadata">

**Author:** ![Sai\_Shashank\_Bandela](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sai_shashank_bandela/32/9724_2.png) [@Sai\_Shashank\_Bandela](https://forums.percona.com/u/Sai_Shashank_Bandela)\
**Post date:** [March 17, 2023, 6:06am UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564/3 "2023-03-17T06:06:47Z")

</div>

Hi @Sergey_Pronin ,

We use the same name as, at the end of each restore, we delete the restore Resource.

```auto
kind: PerconaXtraDBClusterRestore
metadata:
  name: restore-mysql-db-pxc-db
  namespace: dkube-infra
spec:
  PXCCluster: mysql-db-pxc-db
  backupSource:
    destination: s3://dkube/backup/mysql-pxc-cluster/manual/mysql-db-pxc-db-2023-03-13-11:27:35-full
    s3:
      credentialsSecret: mysql-pxc-backup-secret
      endpointUrl: http://dkube-minio-server:9000
      region: us-east-1

```

The operator version we use is 1.8.0

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [March 17, 2023, 7:33am UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564/4 "2023-03-17T07:33:56Z")

</div>

So the steps to reproduce are:

1. Deploy the cluster using operator 1.8.0
2. Backup
3. Restore
4. Delete restore object
5. Restore again using the same backup and restore manifest

Is it correct?

BTW, why 1.8.0? It is extremely old.

---

<div class="post-metadata">

**Author:** ![Sai\_Shashank\_Bandela](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sai_shashank_bandela/32/9724_2.png) [@Sai\_Shashank\_Bandela](https://forums.percona.com/u/Sai_Shashank_Bandela)\
**Post date:** [March 17, 2023, 8:50am UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564/5 "2023-03-17T08:50:24Z")

</div>

Yes, those steps are correct.

Yeah… 1.8.0 I’m guessing is because that was the latest available version when this functionality was added our product.

I’m planning to try out with the latest operator 1.12.0.

---

<div class="post-metadata">

**Author:** ![Sai\_Shashank\_Bandela](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sai_shashank_bandela/32/9724_2.png) [@Sai\_Shashank\_Bandela](https://forums.percona.com/u/Sai_Shashank_Bandela)\
**Post date:** [March 30, 2023, 6:56am UTC](https://forums.percona.com/t/not-able-to-create-perconaxtradbclusterrestore-resource-on-kubernetes/20564/6 "2023-03-30T06:56:45Z")

</div>

Hi Team,

This issue is now fixed with upgrading the PXC Operator to 1.12.0

Thanks!
