「EKS」- Use Amazon EFS storage | Amazon EFS CSI driver

相关文档

Store an elastic file system with Amazon EFS
https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html

服务部署

Step 1: Create an IAM role

Step 2: Get the Amazon EFS CSI driver

Add add-ons ⇒ Amazon EFS CSI Driver
选择对应的 Role 参数

Step 3: Create an Amazon EFS file system

Dynamic Provisioning
https://github.com/kubernetes-sigs/aws-efs-csi-driver/tree/master/examples/kubernetes/dynamic_provisioning

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: efs-sc
provisioner: efs.csi.aws.com
parameters:
  provisioningMode: efs-ap
  fileSystemId: fs-92107410
  directoryPerms: "700"
  gidRangeStart: "1000" # optional
  gidRangeEnd: "2000" # optional
  basePath: "/dynamic_provisioning" # optional
  subPathPattern: "${.PVC.namespace}/${.PVC.name}" # optional
  ensureUniqueDirectory: "true" # optional
  reuseAccessPoint: "false" # optional

ensureUniqueDirectory | 我们将其修改为 false 值,以放置某些 PVE 名字过长而产生 … exceeds EFS limit of 100 characters … 错误。

Step 4: Deploy a sample application

常见问题

… failed to provision volume with StorageClass “efs-sc”: rpc error: code = Unauthenticated desc = Access Denied. Please ensure you have the right AWS permissions: Access denied …

原因可能为:(1)或,检查 Role 权限;(2)或,修改权限后,需要重启相关 Pod 实例;