Bug #118450 mysqlrouter account not created, and the replicas of router deployment is 0
Submitted: 16 Jun 7:15 Modified: 19 Jun 16:39
Reporter: Bing Ma (OCA) Email Updates:
Status: Need Feedback Impact on me:
None 
Category:MySQL Operator Severity:S1 (Critical)
Version:8.2.0-2.1.1 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[16 Jun 7:15] Bing Ma
Description:
The InnoDB Cluster initially failed to become ready due to issues with the underlying Kubernetes (K8s) cluster. After I resolved the K8s problems and the InnoDB Cluster became operational, I discovered that the MySQL Router account had not been created, and the replica count for the Router's Deployment remained at 0.

How to repeat:
I don't knwo how to reproduce it
[16 Jun 12:35] MySQL Verification Team
Hi,

I am sorry but I need more details in how to reproduce this problem

Thanks
[18 Jun 10:08] Bing Ma
like this, in mysql, no mysqlrouter user exist
 MySQL  localhost:33060+ ssl  SQL > select user,host from mysql.user;
+---------------------------+-----------+
| user                      | host      |
+---------------------------+-----------+
| kpanda                    | %         |
| mysql_innodb_cluster_1000 | %         |
| mysql_innodb_cluster_1001 | %         |
| mysql_innodb_cluster_1002 | %         |
| mysqladmin                | %         |
| root                      | %         |
| localroot                 | localhost |
| mysql.infoschema          | localhost |
| mysql.session             | localhost |
| mysql.sys                 | localhost |
| mysqlhealthchecker        | localhost |
| mysqlmetrics              | localhost |
+---------------------------+-----------+

and router pod is crash:

mcamel-common-kpanda-mgr-router-79774795b6-bmccr             0/1     CrashLoopBackOff   21 (4m13s ago)   86m
mcamel-common-kpanda-mgr-router-dd8bb46c-4jpkf               0/1     CrashLoopBackOff   45 (57s ago)     3h26m

the mysqlrouter secret exists:

k get secret |grep router
mcamel-common-kpanda-mgr-router                               Opaque               2      2d2h

the logs of router pod:

k logs mcamel-common-kpanda-mgr-router-79774795b6-bmccr
[Entrypoint] MYSQL_CREATE_ROUTER_USER is 0, Router will reuse mysqlrouter account at runtime
[Entrypoint] Succesfully contacted mysql server at mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306. Checking for cluster state.
[Entrypoint] ERROR: Can not connect to database. Exiting
[18 Jun 10:09] Bing Ma
and the cluster status is ok

k exec -it mcamel-common-kpanda-mgr-0 -c mysql -- bash
bash-5.1$ mysqlsh -uroot -p0sozA3jjzb
Cannot set LC_ALL to locale en_US.UTF-8: No such file or directory
MySQL Shell 8.0.37

Copyright (c) 2016, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.

Type '\help' or '\?' for help; '\quit' to exit.
WARNING: Using a password on the command line interface can be insecure.
Creating a session to 'root@localhost'
Fetching schema names for auto-completion... Press ^C to stop.
Your MySQL connection id is 18815 (X protocol)
Server version: 8.0.37 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.
 MySQL  localhost:33060+ ssl  JS > cluster=dba.getCluster()
<Cluster:mcamel_common_kpanda_mgr>
 MySQL  localhost:33060+ ssl  JS > cluster.status()
{
    "clusterName": "mcamel_common_kpanda_mgr",
    "defaultReplicaSet": {
        "name": "default",
        "primary": "mcamel-common-kpanda-mgr-2.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306",
        "ssl": "REQUIRED",
        "status": "OK",
        "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
        "topology": {
            "mcamel-common-kpanda-mgr-0.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306": {
                "address": "mcamel-common-kpanda-mgr-0.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306",
                "memberRole": "SECONDARY",
                "mode": "R/O",
                "readReplicas": {},
                "replicationLag": "applier_queue_applied",
                "role": "HA",
                "status": "ONLINE",
                "version": "8.0.37"
            },
            "mcamel-common-kpanda-mgr-1.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306": {
                "address": "mcamel-common-kpanda-mgr-1.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306",
                "memberRole": "SECONDARY",
                "mode": "R/O",
                "readReplicas": {},
                "replicationLag": "applier_queue_applied",
                "role": "HA",
                "status": "ONLINE",
                "version": "8.0.37"
            },
            "mcamel-common-kpanda-mgr-2.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306": {
                "address": "mcamel-common-kpanda-mgr-2.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306",
                "memberRole": "PRIMARY",
                "mode": "R/W",
                "readReplicas": {},
                "replicationLag": "applier_queue_applied",
                "role": "HA",
                "status": "ONLINE",
                "version": "8.0.37"
            }
        },
        "topologyMode": "Single-Primary"
    },
    "groupInformationSourceMember": "mcamel-common-kpanda-mgr-2.mcamel-common-kpanda-mgr-instances.mcamel-system.svc.cluster.local:3306"
}
 MySQL  localhost:33060+ ssl  JS >
[19 Jun 16:39] MySQL Verification Team
Hi,

I have issues reproducing this with 8.0.42 (server, shell, operator).