2

次の手順を実行しました:- 1. 永続的なボリューム クレームを作成し、それを mysql のデプロイで使用しました 2. 構成で汎用シークレットを作成し、デプロイ用に env に設定しました

        env:
      - name: MYSQL_ROOT_PASSWORD
        valueFrom:
            secretKeyRef:
              name: my-db-pass
              key: password

3. 次のコマンドを使用してインスタンスに接続します mysql --host= --user=root -p その後、次のエラーが発生しました-

ERROR 1045 (28000): Access denied for user 'root'@'10.128.0.18' (using password: YES)

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'

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
4

1 に答える 1