canonical / mysql-k8s-operator

A Charmed Operator for running MySQL on Kubernetes
https://charmhub.io/mysql-k8s
Apache License 2.0
8 stars 15 forks source link

MySQL Error (1045): Shell.connect: Access denied #459

Closed cjohnston1158 closed 2 weeks ago

cjohnston1158 commented 3 months ago

Steps to reproduce

This is a deployment of Sunbeam with MAAS. I don't see the issue 100% of the time, and I'm not sure yet any specific steps to reproduce.

Expected behavior

No error

Actual behavior

juju status -m openstack placement-mysql
Model      Controller            Cloud/Region                Version  SLA          Timestamp
openstack  sunbeam01-controller  sunbeam-microk8s/localhost  3.4.4    unsupported  12:41:42Z

SAAS       Status  Store  URL
microceph  active  local  admin/openstack-machines.microceph

App              Version                  Status   Scale  Charm      Channel   Rev  Address         Exposed  Message
placement-mysql  8.0.37-0ubuntu0.22.04.3  waiting      3  mysql-k8s  8.0/edge  160  10.152.183.211  no       installing agent

Unit                Workload     Agent      Address      Ports  Message
placement-mysql/0   maintenance  idle       10.1.250.83         joining the cluster
placement-mysql/1   waiting      idle       10.1.230.20         waiting to get cluster primary from peers
placement-mysql/2*  maintenance  executing  10.1.51.149         Unable to get member state
2024-07-10T09:10:41.484Z [container-agent] 2024-07-10 09:10:41 ERROR juju-log Failed to flush [<MySQLTextLogs.ERROR: 'ERROR LOGS'>, <MySQLTextLogs.GENERAL: 'GENERAL LOGS'>, <MySQLTextLogs.SLOW: 'SLOW LOGS'>] logs.
2024-07-10T09:10:41.484Z [container-agent] Traceback (most recent call last):
2024-07-10T09:10:41.484Z [container-agent]   File "/var/lib/juju/agents/unit-placement-mysql-2/charm/src/mysql_k8s_helpers.py", line 611, in _run_mysqlsh_script
2024-07-10T09:10:41.484Z [container-agent]     stdout, _ = process.wait_output()
2024-07-10T09:10:41.484Z [container-agent]   File "/var/lib/juju/agents/unit-placement-mysql-2/charm/venv/ops/pebble.py", line 1635, in wait_output
2024-07-10T09:10:41.484Z [container-agent]     raise ExecError[AnyStr](self._command, exit_code, out_value, err_value)
2024-07-10T09:10:41.484Z [container-agent] ops.pebble.ExecError: non-zero exit code 1 executing ['/usr/bin/mysqlsh', '--no-wizard', '--python', '--verbose=1', '-f', '/tmp/script.py', ';', 'rm', '/tmp/script.py'], stdout='', stderr='Cannot set LC_ALL to locale en_US.UTF-8: No such file or directory\nverbose: 2024-07-10T09:10:10Z: Loading startup files...\nverbose: 2024-07-10T09:10:10Z: Loading plugins...\nverbose: 2024-07-10T09:10:11Z: Connecting to MySQL at: serverconfig@placement-mysql-2.placement-mysql-endpoints.openstack.svc.cluster.local\nTraceback (most recent call last):\n  File "<string>", line 1, in <module>\nmysqlsh.DBError: MySQL Error (1045): Shell.connect: Access denied for user \'serverconfig\'@\'placement-mysql-2.placement-mysql-endpoints.openstack.svc.cluste\' (using password: YES)\n'

Versions

Operating system: Ubuntu 22.04.4 LTS

Juju CLI: 3.4.4-genericlinux-amd64

Juju agent: 3.4.4

Charm revision: 8.0/edge 160

microk8s: MicroK8s v1.28.10 revision 6829

Log output

placement-mysql-0.log placement-mysql-1.log placement-mysql-2.log

github-actions[bot] commented 3 months ago

https://warthogs.atlassian.net/browse/DPE-4861

paulomach commented 3 months ago

Hi @cjohnston1158 , thanks for the report. I'll get back when I have updates

shayancanonical commented 1 month ago

@cjohnston1158 is it possible that two or more clusters are deployed in sunbeam with MAAS? both clusters have the same cluster-name config option?

shayancanonical commented 2 weeks ago

@cjohnston1158 we have merged a fix that ensures that traffic is directed correctly when there are 2 or more mysql applications with the same cluster-name config. we are also unable to reproduce the issue locally. please reopen if you encounter the issue again + please provide more steps to reproduce so we can diagnose the issue if it happens again