本文介紹了使用現(xiàn)有的持久性卷聲明部署bitnami/MySQL舵圖的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
我正在嘗試在我的minikube內(nèi)部署bitnami/mysql圖表。
我使用的是Kubernetes v1.19、Minikube v1.17.1和Helm 3
我已經(jīng)創(chuàng)建了一個(gè)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
我已通過(guò)執(zhí)行sudo mkdir -p /var/lib/mysql
創(chuàng)建了目錄<[2-0
我是這樣創(chuàng)建我的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
我正在使用以下選項(xiàng)部署我的mysql
:
helm 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
問(wèn)題是吊艙從未準(zhǔn)備好,因?yàn)椋?/p>
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內(nèi)運(yùn)行,但由于某些原因未正確設(shè)置根密碼,因?yàn)楫?dāng)我執(zhí)行Pod并嘗試連接到mysql
時(shí),我收到:
$ 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
無(wú)需密碼即可正常工作。
謝謝
推薦答案
這里是Bitnami工程師,
我能夠重現(xiàn)這個(gè)問(wèn)題,我將創(chuàng)建一個(gè)內(nèi)部任務(wù)來(lái)解決這個(gè)問(wèn)題。當(dāng)我們有更多信息時(shí),我們將更新此帖子。
這篇關(guān)于使用現(xiàn)有的持久性卷聲明部署bitnami/MySQL舵圖的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,