[英]Not able to connect to mysql server running in kubernetes deployment expose as loadbalancer
following steps have been done:- 1. I have created a persistent volume claim and used that in my deployment for mysql 2. created a generic secret in configuration and set that in env for deployment已完成以下步骤:- 1. 我创建了一个持久卷声明,并在我的 mysql 部署中使用了它 2. 在配置中创建了一个通用密钥并将其设置在 env 中以进行部署
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: my-db-pass
key: password
3. using following cmd to connect to my instance mysql --host= --user=root -p after which the following error occurred- 3.使用以下 cmd 连接到我的实例 mysql --host= --user=root -p 之后发生以下错误-
ERROR 1045 (28000): Access denied for user 'root'@'10.128.0.18' (using password: YES)
kubectl pod logs for mysql are - mysql 的 kubectl pod 日志是 -
2020-04-05 19:49:47+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
2020-04-05 19:49:47+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-04-05 19:49:47+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.19-1debian10 started.
2020-04-05T19:49:48.139557Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-04-05T19:49:48.139759Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 1
2020-04-05T19:49:50.599641Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-04-05T19:49:50.606508Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-04-05T19:49:50.850478Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.19' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
2020-04-05T19:49:50.894674Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2020-04-05T20:01:09.664184Z 17 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
yaml file for mysql-deployment is also provided还提供了用于 mysql-deployment 的 yaml 文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
labels:
app: mysql
spec:
replicas: 1
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:8
args:
- "--default-authentication-plugin=mysql_native_password"
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: my-db-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-volumeclaim
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.