Amazon EKS — EFS CSI Driver
EFS CSI Driver
Amazon EFS (Elastic File System) provides shared file storage that multiple pods can read and write simultaneously, across all AZs.
EBS vs EFS
| Feature | EBS | EFS |
|---|---|---|
| Access mode | ReadWriteOnce (single node) | ReadWriteMany (multi-node) |
| AZ | Single AZ | Multi-AZ |
| Performance | High IOPS | Moderate (burstable/provisioned) |
| Cost | $0.08/GB/mo (gp3) | $0.30/GB/mo (standard) |
| Use case | Databases, single-pod storage | Shared data, CMS, ML datasets |
| Fargate support | ❌ No | ✅ Yes |
Install EFS CSI Driver
# EKS managed addon
$ aws eks create-addon \
--cluster-name demo \
--addon-name aws-efs-csi-driver \
--service-account-role-arn arn:aws:iam::123456789012:role/AmazonEKS_EFS_CSI_DriverRole
Create EFS File System
# Create file system
$ aws efs create-file-system \
--performance-mode generalPurpose \
--throughput-mode bursting \
--encrypted \
--tags Key=Name,Value=eks-efs
# Create mount targets in each subnet
$ aws efs create-mount-target \
--file-system-id fs-0abc123 \
--subnet-id subnet-0def456 \
--security-groups sg-0ghi789
Use EFS in Pods
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: efs-sc
provisioner: efs.csi.aws.com
parameters:
provisioningMode: efs-ap
fileSystemId: fs-0abc123
directoryPerms: "700"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-data
spec:
accessModes:
- ReadWriteMany # Multiple pods can write!
storageClassName: efs-sc
resources:
requests:
storage: 5Gi
Multiple pods can mount the same PVC:
# Pod 1 and Pod 2 both mount the same EFS volume
volumes:
- name: shared
persistentVolumeClaim:
claimName: shared-data
Common Mistakes
| Mistake | Impact |
|---|---|
| Security group not allowing NFS (2049) | Mount fails |
| No mount targets in node subnets | Timeout on mount |
| Using EFS for high-IOPS workloads | Poor performance (use EBS) |
What’s Next?
Dynamic provisioning: Storage Classes.