How to set local NODE_NAME in backup.yaml?

I install Percona XtraDB Cluster on Minikube consisting of a single note
when I take a backup

kubectl apply -f deploy/backup/backup.yaml

the variable NODE_NAME takes on the value: cluster1-pxc-2

++ cut -d : -f 2
++ cut -d . -f 1
+ local NODE_NAME=cluster1-pxc-2
+ '[' -z cluster1-pxc-2 ']'
+ set +o errexit

the backup is fine, but if i install Percona XtraDB Cluster on three nodes

└$► kubectl get nodes -o wide
NAME           STATUS   ROLES                  AGE   VERSION   INTERNAL-IP      EXTERNAL-IP   OS-IMAGE               KERNEL-VERSION   CONTAINER-RUNTIME
minikube       Ready    control-plane,master   47h   v1.20.2   192.168.99.170   <none>        Buildroot 2020.02.12   4.19.182         docker://20.10.6
minikube-m02   Ready    <none>                 47h   v1.20.2   192.168.99.171   <none>        Buildroot 2020.02.12   4.19.182         docker://20.10.6
minikube-m03   Ready    <none>                 47h   v1.20.2   192.168.99.172   <none>        Buildroot 2020.02.12   4.19.182         docker://20.10.6

variable NODE_NAME empty, the backup breaks

++ cut -d . -f 1
++ tail -1
++ sort
+ local NODE_NAME=
+ '[' -z '' ']'
+ peer-list -on-start=/usr/bin/get-pxc-state -service=cluster1-pxc
2021/06/16 10:52:01 Peer finder enter
2021/06/16 10:52:01 Determined Domain to be default.svc.cluster.local
2021/06/16 10:52:01 Peer list updated
was []
now [cluster1-pxc-0.cluster1-pxc.default.svc.cluster.local cluster1-pxc-1.cluster1-pxc.default.svc.cluster.local cluster1-pxc-2.cluster1-pxc.default.svc.cluster.local]
2021/06/16 10:52:01 execing: /usr/bin/get-pxc-state with stdin: cluster1-pxc-0.cluster1-pxc.default.svc.cluster.local
cluster1-pxc-1.cluster1-pxc.default.svc.cluster.local
cluster1-pxc-2.cluster1-pxc.default.svc.cluster.local
2021/06/16 10:52:01 
cat: /etc/mysql/mysql-users-secret/xtrabackup: No such file or directory
cat: /etc/mysql/mysql-users-secret/xtrabackup: No such file or directory
node:cluster1-pxc-0.cluster1-pxc.default.svc.cluster.local:wsrep_ready:ON:wsrep_connected:ON:wsrep_local_state_comment:Synced:wsrep_cluster_status:Primary:wsrep_cluster_size:3
cat: /etc/mysql/mysql-users-secret/xtrabackup: No such file or directory
cat: /etc/mysql/mysql-users-secret/xtrabackup: No such file or directory
node:cluster1-pxc-1.cluster1-pxc.default.svc.cluster.local:wsrep_ready:ON:wsrep_connected:ON:wsrep_local_state_comment:Donor/Desynced:wsrep_cluster_status:Primary:wsrep_cluster_size:3
cat: /etc/mysql/mysql-users-secret/xtrabackup: No such file or directory
cat: /etc/mysql/mysql-users-secret/xtrabackup: No such file or directory
node:cluster1-pxc-2.cluster1-pxc.default.svc.cluster.local:wsrep_ready:ON:wsrep_connected:ON:wsrep_local_state_comment:Donor/Desynced:wsrep_cluster_status:Primary:wsrep_cluster_size:3
2021/06/16 10:52:02 Peer finder exiting
[ERROR] Cannot find node for backup
+ echo '[ERROR] Cannot find node for backup'
+ exit 1

my backup.yaml

apiVersion: pxc.percona.com/v1
kind: PerconaXtraDBClusterBackup
metadata:
#  finalizers:
#    - delete-s3-backup
  name: backup1
spec:
  pxcCluster: cluster1
  storageName: fs-pvc

a scheduled backup is not created for the same reason. Is possible to set a variable NODE_NAME?

1 Like