11

I'm trying to deploy bitnami/mysql chart inside my minikube. I'm using Kubernetes v1.19, Minikube v1.17.1 and Helm 3

I've created a PVC and PV as follow:

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

I've created the directory /var/lib/mysql by doing sudo mkdir -p /var/lib/mysql And this is how I create my PVC and PC:

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

Which seems to work:

NAME       STATUS   VOLUME     CAPACITY   ACCESS MODES   STORAGECLASS      AGE
mysql-pvc  Bound    mysql-pv   8Gi        RWO            standard          59s

I am deploying my mysql with: helm upgrade --install dev-mysql -f mysql-dev.yaml bitnami/mysql

Custom value file - 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

The deployement works:

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

the problem is that the pod never gets ready because:

  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 is running inside the pod but for some reasons the root password isn't properly set because when I exec to the pod and try to connect to mysql I get:

$ 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:/$

Instead it's using the default values so if I try: mysql -u root -p without password it works great.

Thanks

Jérémy Octeau
  • 689
  • 1
  • 10
  • 26
  • Were you ever able to get this to work? Could you provide your solution if you did, or perhaps look at this similar issue if your experience would allow an answer? Thanks! https://stackoverflow.com/q/70297296/658182 – user658182 Dec 10 '21 at 18:19

1 Answers1

4

A bitnami engineer here, I was able to reproduce the issue, I'm going to create an internal task to resolve this. We will update this thread when we have more information.

Ibone
  • 56
  • 2
  • 1
    We update the chat, the script `docker-entrypoint-initdb.d` no longer exists. You can use `initdbScripts` – Ibone Jun 09 '21 at 10:42
  • Could you please take a look at this issue and see if they are related or provide an answer? I'm trying to do the same thing, except I want to use mysql's default credentials, but I want to use my data instead of the default data, which I typically use the `docker-entrypoint-initdb.d` folder for. https://stackoverflow.com/q/70297296/658182 – user658182 Dec 10 '21 at 18:15