'pod mysql mount azure files failed
wanna deploy a mysql in cluster, and pod need a persistent storage, here are yaml & pictures:
The pod:
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- image: mysql:5.7
name: mypod
ports:
- containerPort: 3306
protocol: TCP
env:
- name: MYSQL_ROOT_PASSWORD
value: THEROODPWD
volumeMounts:
- name: azure
mountPath: /var/lib/mysql/
volumes:
- name: azure
csi:
driver: file.csi.azure.com
volumeAttributes:
secretName: williamstoragekey
shareName: mysql
mountOptions: "dir_mode=0777,file_mode=0777,cache=strict,actimeo=30"
The secret:
kind: Secret
apiVersion: v1
metadata:
name: williamstoragekey
namespace: default
uid: 0e164956-2e2c-47ef-adc3-ffed8089a4a7
resourceVersion: '20976434'
creationTimestamp: '2022-03-14T07:13:38Z'
managedFields:
- manager: kubectl-create
operation: Update
apiVersion: v1
time: '2022-03-14T07:13:38Z'
fieldsType: FieldsV1
fieldsV1:
f:data:
.: {}
f:azurestorageaccountkey: {}
f:azurestorageaccountname: {}
f:type: {}
data:
azurestorageaccountkey: >-
TWYrMFRaQ0ZLQVIxcEtVMFJGNUdCSEFGcXVnREdYZDZ5V2JMd2hFeGJFeTd0Z1pmNWNFQjM2d3FQM1EwY0VkeExRckhKWVZMZnJvYlN0QlIzcEJOeHc9PQ==
azurestorageaccountname: a3ViZXRlc3RpbmcwMDk=
type: Opaque
Pod logs: 2022-03-15 01:07:34+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.37-1debian10 started. 2022-03-15 01:07:34+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2022-03-15 01:07:34+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.37-1debian10 started. 2022-03-15 01:07:35+00:00 [Note] [Entrypoint]: Initializing database files 2022-03-15T01:07:35.308618Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2022-03-15T01:07:35.321413Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2022-03-15T01:07:35.321452Z 0 [ERROR] Aborting
It's obviously the files inside mysql file share are created by mysql, and the file share is new created and is empty. But the pod seems crashed many times to start and terminated.
Solution 1:[1]
https://docs.microsoft.com/en-us/answers/questions/770819/pod-mount-azure-files-failed.html
Posting the Microsoft Q&A thread(answered) discussion here, which can benefits other community reading this thread.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SumanthMarigowda-MSFT |


