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