簡體   English   中英

無法在 EKS kubernetes 中使用 EBS 卷運行 mysql

[英]Can't run mysql with an EBS volume in EKS kubernetes

我正在嘗試在 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的 output 如下:

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

在 EKS 中運行以啟動存儲 (EBS) 時,您需要使用 storageClass object。

您可以在此處找到有關如何啟動它的更多信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM