Statefulset MySQL with WordPress Error establishing a database connection

Cluster information:

Kubernetes version: v1.23.0
Cloud being used: Testing on KVM with three master and three worker
Installation method: offical installation
Host OS: CentOS 7
CNI and version: https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
CRI and version:

secret
https://paste.ubuntu.com/p/cWwY49bNRp/

configmaps
https://paste.ubuntu.com/p/DBFFtnn8H4/

service
https://paste.ubuntu.com/p/pWWX3F8JVH/

StatefulSet
https://paste.ubuntu.com/p/RyxKVmP2JN/

We are using ceph storage, this is PVC
https://paste.ubuntu.com/p/QNRYCZHHXd/

WordPress:
https://paste.ubuntu.com/p/4f6h6gzqsw/

The WordPress svc is:
apiVersion: v1
kind: Service
metadata:
name: wordpress-app-service
spec:
ports:

  • port: 80
    protocol: TCP
    targetPort: 80
    selector:
    app: wordpress-deployment
    type: LoadBalancer

After run WordPress yaml, the StatefulSet MySQL didn’t have create wordpress database:

mysql> show databases;
±-----------------------+
| Database |
±-----------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| xtrabackup_backupfiles |
±-----------------------+
5 rows in set (0.01 sec)

So the WordPress is Error establishing a database connection

The pod is running
wordpress-app-59f65f5c77-sg84m 1/1 Running 0 53m

WordPress log:
kubectl logs --tail 10 wordpress-app-59f65f5c77-sg84m
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 10.244.5.40. Set the ‘ServerName’ directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using 10.244.5.40. Set the ‘ServerName’ directive globally to suppress this message
[Tue Dec 14 06:54:21.298262 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.51 (Debian) PHP/7.4.26 configured – resuming normal operations
[Tue Dec 14 06:54:21.298440 2021] [core:notice] [pid 1] AH00094: Command line: ‘apache2 -D FOREGROUND’
10.244.5.1 - - [14/Dec/2021:06:54:39 +0000] “GET / HTTP/1.1” 500 2834 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36”
10.244.5.1 - - [14/Dec/2021:06:54:40 +0000] “GET /favicon.ico HTTP/1.1” 500 2834 “http://10.0.10.137/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36”
10.244.5.1 - - [14/Dec/2021:06:55:09 +0000] “GET / HTTP/1.1” 500 2834 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36”
10.244.5.1 - - [14/Dec/2021:06:55:09 +0000] “GET /favicon.ico HTTP/1.1” 500 2834 “http://10.0.10.137/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36”
10.244.5.1 - - [14/Dec/2021:07:26:51 +0000] “GET / HTTP/1.1” 500 2834 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36”
10.244.5.1 - - [14/Dec/2021:07:26:52 +0000] “GET /favicon.ico HTTP/1.1” 500 2834 “http://10.0.10.137/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36”

Describe WordPRess:
Events:
Type Reason Age From Message


Normal Scheduled 55m default-scheduler Successfully assigned default/wordpress-app-59f65f5c77-sg84m to sealos06
Normal SuccessfulAttachVolume 55m attachdetach-controller AttachVolume.Attach succeeded for volume “pvc-5481d500-b4da-4398-972d-aa2bb2ad00f9”
Normal Pulling 55m kubelet Pulling image “wordpress:latest”
Normal Pulled 54m kubelet Successfully pulled image “wordpress:latest” in 3.700672043s
Normal Created 54m kubelet Created container wordpress
Normal Started 54m kubelet Started container wordpress

But log showing:
[root@sealos01 wordpress]# kubectl logs --tail 10 mysql-0 mysql
2021-12-14T06:48:37.867571Z 12 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:48:38.015052Z 13 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:48:39.451850Z 14 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:48:39.578077Z 15 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:50:03.853208Z 16 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:50:04.120162Z 17 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:50:07.726058Z 18 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:50:08.326395Z 19 [Note] Access denied for user ‘example username’@‘10-244-5-38.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:53:02.220912Z 20 [Note] Access denied for user ‘example username’@‘10-244-5-39.wordpress-app-service.default.svc.cluster.local’ (using password: YES)
2021-12-14T06:53:02.434262Z 21 [Note] Access denied for user ‘example username’@‘10-244-5-39.wordpress-app-service.default.svc.cluster.local’ (using password: YES)

Thanks

Can someone help?

I can use phpmyadmin login, so the host and login information is correct.