MySQL InnoDB Cluster failed to start in LKS

464 Views Asked by At

Description:

  • I have been trying to set up MySQL InnoDB Cluster in K8S(Linode Kubernetes Service).
  • For first when I provision the InnoDB cluster with 3 instances and 1 router, It starts and creates dynamic pv and PVC claim with Linode volume and sidecars containers able to perform the function properly.
  • Also when the modified instance it also works perfectly.
  • But when I try to recreate the InnoDB Cluster after deletion, The MySQL containers under stateful sets start and attached to PVC claims already existed successfully.
  • But the sidecar failed to connect to MySQL admin and showed the following error continuously.
 Normal Logging 3s kopf Error executing mysqlsh.connect_dba, retrying after 4s: MySQL Error (1045): mysqlsh.connect_dba: Access denied for user 'mysqladmin'@'10.2.0.3' (using password: YES)
  • But I didn't change the root password and set the host value to "%"

How to repeat:

  • Create Innodb Cluster with the following secrets and Cluster values
  • secret.yml
apiVersion: v1
kind: Secret
metadata:
  name: mysql-cluster-secret
  namespace: default
stringData:
  rootUser: root
  rootHost: "%"
  rootPassword: password

-InnoDBCluster.yml

apiVersion: mysql.oracle.com/v2
kind: InnoDBCluster
metadata:
  name: mysql
  namespace: default
spec:
  instances: 3
  router:
    instances: 1
  secretName: mysql-cluster-secret
  imagePullPolicy : IfNotPresent
  baseServerId: 1000
  version: 8.0.33
  serviceAccountName: mysql-sa
  tlsUseSelfSigned: true
  • For the first time, I worked perfectly fine.

  • But after deleting the InnoDb cluster and creating them, It throws this error.

  • I tried to mount the existing pvc and pv with the new InnoDb Mysql Cluster.

  • But the sidecar container doesn't able to reach the steady state.

1

There are 1 best solutions below

0
Mohammed Ashraf On

you need to delete the old pvc for your db pod because it contains the old password for the user mysqladmin, and when you redeploy the db the operator change the password in the secrets but the old password is present in the old volume.