我正在尝试在AWS EKS上运行go-ethereum节点,为此,我使用了具有以下配置的statefulsets。statefulset.yaml file
运行kubectl apply -f statefulset.yaml将创建2个pod,其中1个正在运行,1个处于CrashLoopBackOff状态。Pods status在检查第二个pod的日志后,我得到的错误是Fatal: Failed to create the protocol stack: datadir already used by another process。Error logs i am getting
该问题主要是由于pod使用相同的目录在持久卷上写入(Geth data) (即pod正在写入'/data')。如果我使用子路径表达式并将pod的目录挂载到具有pod名称的子目录(例如:'/data/geth-0'),它就可以正常工作。数据,但我的要求是所有三个pod的数据都写入‘/ statefulset.yaml with volume mounting to a sub directory with podname ’目录。下面是我的卷配置文件。volume configuration
发布于 2021-11-24 09:28:52
您需要为每个有状态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。
发布于 2021-11-24 08:29:28
同一目录不能由多个go-ethereum实例重用,因此您有以下选项:
使用一个子目录
/data pathhttps://stackoverflow.com/questions/70091242
复制相似问题