使用现有的持久性卷声明部署bitnami/MySQL舵图

我正在尝试在我的minikube内部署bitnami/mysql图表。 我使用的是Kubernetes v1.19、Minikube v1.17.1和Helm 3

我已经创建了一个PVC和PV,如下所示:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mysql-pvc
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
  selector:
    matchLabels:
      id: mysql-pv
----
kind: PersistentVolume
apiVersion: v1
metadata:
  name: mysql-pv
  labels:
    type: local
    id: mysql-pv
spec:
  storageClassName: standard
  capacity:
    storage: 8Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: /var/lib/mysql
我已通过执行sudo mkdir -p /var/lib/mysql创建了目录<[2-0 我是这样创建我的PVC和PC的:

kubectl apply -f mysql-pv-dev.yaml
kubectl apply -f mysql-pvc-dev.yaml

这似乎起作用了:

NAME       STATUS   VOLUME     CAPACITY   ACCESS MODES   STORAGECLASS      AGE
mysql-pvc  Bound    mysql-pv   8Gi        RWO            standard          59s
我正在使用以下选项部署我的mysqlhelm upgrade --install dev-mysql -f mysql-dev.yaml bitnami/mysql

自定义值文件-mysql-dev.yaml

auth:
  database: dev_db
  username: dev_user
  password: passworddev
  rootPassword: rootpass
image:
  debug: true
primary:
  persistence:
    existingClaim: mysql-pvc
  extraVolumeMounts: |
      - name: init
        mountPath: /docker-entrypoint-initdb.d
  extraVolumes: |
      - name: init
        hostPath:
          path: /home/dev/init_db_scripts/
          type: Directory
volumePermissions:
  enabled: true

部署工作正常:

NAME         READY   STATUS    RESTARTS   AGE
dev-mysql-0  0/1     Running   0          8s 

问题是吊舱从未准备好,因为:

  Warning  Unhealthy  0s (x2 over 10s)  kubelet            Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'

mysqld正在Pod内运行,但由于某些原因未正确设置根密码,因为当我执行Pod并尝试连接到mysql时,我收到:

$ kubectl exec -ti dev-mysql bash
I have no name!@dev-mysql-0:/$ mysql -u root -prootpass
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
I have no name!@dev-mysql-0:/$
相反,它使用default values,因此如果我尝试: mysql -u root -p无需密码即可正常工作。

谢谢


解决方案

这里是Bitnami工程师, 我能够重现这个问题,我将创建一个内部任务来解决这个问题。当我们有更多信息时,我们将更新此帖子。

相关文章