【发布时间】:2020-07-22 02:45:09
【问题描述】:
我正在尝试在 EKS (kubernetes v 1.15) 中运行 mysql。
起初我尝试使用本地卷运行它,它运行良好。
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/mysql"
当我移至 EBS 卷时,它停止工作。我尝试将 pvc 用于默认 StorageClass(以及我手动创建的自定义 StorageClass)
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
我尝试使用 awsBlockStore 直接将其附加到 pod
volumes:
- name: mysql-data
awsElasticBlockStore:
volumeID: "vol-09df5a8d4c0f2da62"
fsType: ext4
而且没有任何东西可以工作。 kubectl logs mysql-pod 的输出如下:
2020-04-09 11:23:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.29-1debian10 started.
2020-04-09 11:23:26+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-04-09 11:23:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.29-1debian10 started.
2020-04-09 11:23:26+00:00 [Note] [Entrypoint]: Initializing database files
2020-04-09T11:23:26.919072Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-04-09T11:23:26.920523Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2020-04-09T11:23:26.920548Z 0 [ERROR] Aborting
【问题讨论】:
标签: mysql kubernetes amazon-eks