【问题标题】:Running multiple pods of go-ethereum with common EFS storage on AWS EKS/kubernetes在 AWS EKS/kubernetes 上使用通用 EFS 存储运行多个 go-ethereum pod
【发布时间】:2021-11-24 05:46:02
【问题描述】:

我正在尝试在 AWS EKS 上运行一个 go-ethereum 节点,因为我使用了具有以下配置的 statefulsets。 statefulset.yaml file

Runningkubectl apply -f statefulset.yaml 创建 2 个 Pod,其中 1 个正在运行,1 个处于 CrashLoopBackOff 状态。 Pods status 检查第二个 pod 的日志后,我得到的错误是 Fatal: Failed to create the protocol stack: datadir already used by another processError logs i am getting

问题主要是由于 Pod 使用同一目录在持久卷上写入(获取数据)(即 Pod 正在写入“/data”)。如果我使用子路径表达式并将 pod 的目录安装到具有 pod 名称的子目录(例如:'/data/geth-0'),它工作正常。 statefulset.yaml with volume mounting to a sub directory with podname 但我的要求是所有三个 pod 的数据都写在 '/data' 目录中。 下面是我的卷配置文件。 volume configuration

【问题讨论】:

  • 每个 pod 都有自己的链数据,这会消耗大量存储空间。我需要的是 Pod 在它们之间共享链数据

标签: kubernetes ethereum amazon-eks amazon-efs go-ethereum


【解决方案1】:

您需要为每个有状态的 pod 动态配置访问点。首先创建一个支持动态配置的 EFS 存储类:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-dyn-sc
provisioner: efs.csi.aws.com
reclaimPolicy: Retain
parameters:
  provisioningMode: efs-ap
  directoryPerms: "700"
  fileSystemId: <get the ID from the EFS console>

更新您的规范以支持声明模板:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: geth
...
spec:
  ...
  template:
  ...
  spec:
    containers:
    - name: geth
      ...
      volumeMounts:
      - name: geth
        mountPath: /data
      ...
  volumeClaimTemplates:
  - metadata:
      name: geth
    spec:
      accessModes:
      - ReadWriteOnce
      storageClassName: efs-dyn-sc
      resources:
        requests:
          storage: 5Gi

所有 pod 现在都写入自己的 /data。

【讨论】:

  • 我认为这会将每个 pod 的数据存储在不同的位置。每个 pod 都有自己的链数据,这将消耗大量存储空间。我需要的是豆荚在它们之间共享链数据。有可能吗?
  • 您的应用不支持共享数据;鉴于它已经告诉你...datadir already used by another process.。如果可能的话,您首先需要查看您的申请手册。
【解决方案2】:

同一目录不能被多个 go-ethereum 实例重用,因此您有以下选择:

  1. 为每个 pod 使用相同的持久化卷,并为每个 pod 使用一个子目录

  2. 为每个 pod 使用单独的持久化卷,然后每个 pod 可以使用相同的/data 路径

【讨论】:

    猜你喜欢
    • 2019-07-29
    • 2020-04-29
    • 2018-04-03
    • 2021-01-22
    • 1970-01-01
    • 2019-07-09
    • 1970-01-01
    • 2021-01-24
    • 2020-08-06
    相关资源
    最近更新 更多