简体   繁体   English

AWS EKS Fargate - 无法使用 statefulset 挂载 EFS 卷

[英]AWS EKS Fargate - Unable to mount EFS volume with statefulset

I want to run a statefulSet in AWS EKS Fargate and attach a EFS volume with it, but I am getting errors in mounting a volume with pod.我想在 AWS EKS Fargate 中运行 statefulSet 并附加一个 EFS 卷,但在使用 pod 安装卷时出现错误。 These are the error I am getting from describe pod.这些是我从描述 pod 中得到的错误。

QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason          Age                From               Message
  ----     ------          ----               ----               -------
  Normal   LoggingEnabled  114s               fargate-scheduler  Successfully enabled logging for pod
  Normal   Scheduled       75s                fargate-scheduler  Successfully assigned default/app1 to fargate-10.0.2.123
  Warning  FailedMount     43s (x7 over 75s)  kubelet            MountVolume.SetUp failed for volume "efs-pv" : rpc error: code = Internal desc = Could not mount "fs-xxxxxxxxxxxxxxxxx:/" at "/var/lib/kubelet/pods/b799a6d6-fe9e-4f80-ac2d-8ccf8834d7c4/volumes/kubernetes.io~csi/efs-pv/mount": mount failed: exit status 1
Mounting command: mount
Mounting arguments: -t efs -o tls fs-xxxxxxxxxxxxxxxxx:/ /var/lib/kubelet/pods/b799a6d6-fe9e-4f80-ac2d-8ccf8834d7c4/volumes/kubernetes.io~csi/efs-pv/mount
Output: Failed to resolve "fs-xxxxxxxxxxxxxxxxx.efs.us-east-1.amazonaws.com" - check that your file system ID is correct, and ensure that the VPC has an EFS mount target for this file system ID.
See https://docs.aws.amazon.com/console/efs/mount-dns-name for more detail.
Attempting to lookup mount target ip address using botocore. Failed to import necessary dependency botocore, please install botocore first.
Warning: config file does not have fall_back_to_mount_target_ip_address_enabled item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [fall_back_to_mount_target_ip_address_enabled = True].

If anyone has setup efs volume with eks fargate cluster please have a look at it.如果有人使用 eks fargate 集群设置了 efs 卷,请查看它。 I am really stucked in from long time.我真的被困了很久。

What I have setup我有什么设置

  • Created a EFS Volume创建 EFS 卷
  • CSIDriver Object CSIDriver Object
apiVersion: storage.k8s.io/v1beta1
kind: CSIDriver
metadata:
  name: efs.csi.aws.com
spec:
  attachRequired: false

  • Storage Class存储 Class
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-sc
provisioner: efs.csi.aws.com
  • PersistentVolume持久卷
apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    volumeHandle: <EFS filesystem ID>
  • PersistentVolumeClaim PersistentVolumeClaim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: efs-claim
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: efs-sc
  resources:
    requests:
      storage: 5Gi
  • Pod Configuration吊舱配置
apiVersion: v1
kind: Pod
metadata:
  name: app1
spec:
  containers:
  - name: app1 
    image: busybox 
    command: ["/bin/sh"] 
    args: ["-c", "while true; do echo $(date -u) >> /data/out1.txt; sleep 5; done"]
    volumeMounts:
    - name: persistent-storage
      mountPath: /data
  volumes:
  - name: persistent-storage
    persistentVolumeClaim:
      claimName: efs-claim

I had the same question as you literally a day after and have been working on the error nonstop since then?一天后我和你有同样的问题,从那以后一直在不停地处理错误? Did you check to make sure your VPC had DNS hostnames enabled.您是否检查以确保您的 VPC 启用了 DNS 主机名。 That is what fixed it for me.这就是为我解决的问题。

Just an FYI, if you are using fargate and you want to change this--I had to go as far as deleting the entire cluster after changing the DNS hostnames flag in order for the change to propagate.仅供参考,如果您使用 Fargate 并且想要更改此设置 - 我必须 go 在更改 DNS 主机名标志后删除整个集群,以便传播更改。 I'm unsure if you're familiar with the DHCP options of a normal ec2 instance, but usually it takes something like renewing the ipconfig in order to force the flag to propagate, but since fargate is a managed system, I was unable to find a way to do so from the node itself.我不确定您是否熟悉普通 ec2 实例的 DHCP 选项,但通常需要更新 ipconfig 以强制标志传播,但由于 fargate 是托管系统,我无法找到一种从节点本身这样做的方法。 I have created another post here attempting to answer that question.我在这里创建了另一个帖子,试图回答这个问题。


Another quick FYI: if your pod execution role doesn't have access to EFS, you will need to add a policy that allows access (I just used the default AmazonElasticFileSystemFullAccess Role for the time being in order to try to get things working). 另一个快速的 FYI:如果您的 pod 执行角色无权访问 EFS,您将需要添加一个允许访问的策略(我暂时只是使用默认的 AmazonElasticFileSystemFullAccess 角色以尝试让事情正常工作)。 Once again, you will have to relaunch your whole cluster in order to get this role change to propagate if you haven't already done so! 再一次,您必须重新启动整个集群才能传播此角色更改(如果您还没有这样做的话)!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将 EFS 挂载到 Fargate 上的 ECS - Unable to mount EFS to ECS on fargate 无法在 kubernetes pod 中挂载只读卷(在 AWS EKS 中使用 EFS CSI 驱动程序) - cannot mount read-only volume in kubernetes pod (using EFS CSI driver in AWS EKS) 是否可以使用 AWS EFS 访问点在 EKS 中安装 kubernetes 持久卷? - Is it possible to use AWS EFS access points to mount a kubernetes persistent volume in EKS? 尝试使用 EFS 在 AWS EKS(仅限 Fargate)上运行 Prometheus 时出现权限错误 - Permissions error trying to run Prometheus on AWS EKS (Fargate only) with EFS AWS ECS (Fargate) 无法挂载 EFS 文件系统“无法解析” - AWS ECS (Fargate) is failing to mount EFS file system “Failed to resolve” 无法为 AWS EKS 集群创建 Fargate 配置文件 - Unable to create a fargate profile for the AWS EKS cluster 将 efs 卷添加到 ecs fargate - Add efs volume to ecs fargate AWS Batch:使用云形成将 efs 卷装载到容器中 - AWS Batch: mount an efs volume into a container using cloud formation 如何使用Chef nfs Cookbook挂载AWS EFS卷 - How to mount an AWS EFS volume using Chef nfs cookbook 如何在 aws EKS 上挂载 aws EC2 文件作为持久卷? - How to mount aws EC2 files on aws EKS as presistent volume?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM