Troubleshooting — MySQL
Broken replication (purged binlog)
Cause: the binary log (binlog) was purged on the primary before the replica could read it. This is a known issue with the MariaDB Operator when mariadbbackup is not yet used to initialize nodes.
Solution:
- Identify the desynchronized replica:
kubectl get pods -l app=mysql-<name> - Perform a dump from a working replica and restore it on the primary:
mysqldump -h <replica-host> -P 3306 -u<user> -p<password> --column-statistics=0 <database> <table> > fix-table.sql
mysql -h <primary-host> -P 3306 -u<user> -p<password> <database> < fix-table.sql - Verify that replication resumes correctly after the restore.
This issue is tracked in the MariaDB Operator. An automatic fix is planned for future versions of the operator.
Restic backup failed
Cause: S3 credentials are incorrect, the endpoint is unreachable, or the resticPassword does not match the one used when the repository was initialized.
Solution:
- Check the backup pod logs:
kubectl logs -l app=mysql-<name>-backup - Make sure the S3 parameters are correct in your manifest:
s3Bucket: the bucket exists and is accessibles3AccessKey/s3SecretKey: the keys are valids3Region: the region matches the bucket location
- Verify that the
resticPasswordis identical to the one used during the first backup. Changing the password makes old backups inaccessible. - Test connectivity to the S3 endpoint from the cluster.
Connection refused
Cause: MySQL pods are not running, the Secret name is incorrect, or the maxUserConnections limit has been reached.
Solution:
- Check that pods are in
Runningstate:kubectl get pods -l app=mysql-<name> - Get the credentials from the Secret. The pattern is
mysql-<name>-auth:kubectl get tenantsecret mysql-<name>-auth -o jsonpath='{.data.password}' | base64 -d - Check that the
maxUserConnectionslimit has not been reached for the concerned user. - Test the connection from a pod within the cluster:
kubectl run test-mysql --rm -it --image=mariadb:11 -- mysql -h mysql-<name> -P 3306 -u<user> -p
Pod in CrashLoopBackOff
Cause: the pod keeps restarting, usually due to memory issues (OOMKilled) or invalid configuration.
Solution:
- Check the previous pod logs to identify the error:
kubectl logs mysql-<name>-0 --previous - Check if the pod was killed due to memory overflow (OOMKilled):
kubectl describe pod mysql-<name>-0 | grep -i oom - If it is a memory issue, increase the
resourcesPresetor define explicitresources:mysql.yamlspec:
resourcesPreset: medium # Switch from nano/micro to medium or higher - Apply the change and wait for the restart:
kubectl apply -f mysql.yaml
Disk space full
Cause: the persistent volume is saturated by data, binary logs, or temporary files.
Solution:
- Check disk usage inside the pod:
kubectl exec mysql-<name>-0 -- df -h /var/lib/mysql - Increase the volume size in your manifest:
mysql.yaml
spec:
size: 20Gi # Increase from the current value - Apply the change:
kubectl apply -f mysql.yaml - If the issue is urgent, clean up obsolete data from a MySQL client.
Never reduce the size value. Volume expansion is supported, but shrinking is not.