Created
October 30, 2018 16:57
-
-
Save hossainemruz/76adcfdaf51adf2ab7ab8e9b2d5d3d87 to your computer and use it in GitHub Desktop.
Sample MySQL deployment to initialize from *.sql file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here, I am using a gcePersistentDisk disk to store my init.sql file. | |
# You can you any Kubernetes volume such as hostPath,nfs etc. | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mysql-init-demo | |
spec: | |
selector: | |
matchLabels: | |
app: mysql | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: mysql | |
spec: | |
containers: | |
- image: mysql:5.6 | |
name: mysql | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
value: password | |
ports: | |
- containerPort: 3306 | |
name: mysql | |
volumeMounts: | |
- name: data | |
mountPath: /var/lib/mysql | |
- name: init-script | |
mountPath: /docker-entrypoint-initdb.d # we are mounting init-script volume in this directory. so init.sql file will be available here. | |
volumes: | |
- name: data # this volume will be used for database storage. | |
persistentVolumeClaim: | |
claimName: mysql-data-pvc | |
- name: init-script # this volume holds init.sql file. | |
gcePersistentDisk: | |
pdName: mysql-dump-storage | |
fsType: ext4 |
amenaafreen
commented
Jan 14, 2020
Could you please help me out with this
I don't see any reason why you are getting this error. Perhaps more context will help to debug.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment