简体   繁体   English

无法连接到在 kubernetes 部署中运行的 mysql 服务器公开为负载均衡器

[英]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

While connecting to the mysql service, pLease specify the same port on which you have exposed the service.在连接到 mysql 服务时,请指定您公开该服务的相同端口。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法连接在 docker 容器上运行的 mysql 服务器 - Not Able to connect mysql server running on docker container 无法使用 Node-Red 容器连接在 docker 上运行的 MySQL 服务器 - Not able to connect MySQL server running on docker with Node-Red container 部署后 MVC 应用程序无法连接到 MySQL - MVC application not able to connect to MySQL after deployment 无法连接到MySQL数据库,但可以连接到服务器 - Unable to connect to MySQL database but able to connect to server mysql shell无法连接到mysql服务器 - mysql shell is not able to connect to mysql server 不允许 Kubernetes pod 主机连接到此 mysql 服务器 - Kubernetes pod host not allowed to connect to this mysql server 无法从应用程序连接到在容器中运行的 mysql - Not able to connect to mysql running in a container from application 在 docker 上运行的 Springboot 微服务无法连接到 mysql - Springboot Microservice running on docker not able to connect to mysql Docker 容器无法连接到在主机上运行的 mysql - Docker container not able to connect to mysql running on host 我无法使用内部 IP 从另一个实例连接到在 Google Compute 引擎上运行的 mysql 服务器 - I am not able to connect to mysql server running on Google Compute engine from another instance using internal IP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM