'"MountVolume.SetUp failed for volume" with EKS and EFS
I'm trying to set up EFS with EKS, but when I deploy my pod, I get errors like MountVolume.SetUp failed for volume "efs-pv3" : rpc error: code = DeadlineExceeded desc = context deadline exceeded
in my events.
What is the cause of this?
Solution 1:[1]
Here is an automated way to use Phyxx's answer.
At first, I was using the private subnets of my cluster, this led to the error mentioned by this thread. After seeing the answered mentioned, I noticed all my nodes were in the public subnet. Therefore I only had to switch "Private" to "Public" to make it work.
Here is script that worked for me :
CLUSTER_REGION=<YOUR_CLUSTER_REGION>
CLUSTER_NAME=<YOUR_CLUSTER_NAME>
EFS_SECURITY_GROUP_NAME=<YOUR_EFS_SECURITY_GROUP_NAME>
EFS_FILE_SYSTEM_NAME<YOUR_EFS_FILE_SYSTEM_NAME>
create_efs_mount_targets() {
file_system_id=$(aws efs describe-file-systems \
--region $CLUSTER_REGION \
--query "FileSystems[?Name=='$EFS_FILE_SYSTEM_NAME'].FileSystemId" \
--output text) \
&& security_group_id=$(aws ec2 describe-security-groups \
--region $CLUSTER_REGION \
--query 'SecurityGroups[*]' \
--output json \
| jq -r 'map(select(.GroupName=="'$EFS_SECURITY_GROUP_NAME'")) | .[].GroupId') \
&& public_cluster_subnets=$(aws ec2 describe-subnets \
--region $CLUSTER_REGION \
--output json \
--filters Name=tag:alpha.eksctl.io/cluster-name,Values=$CLUSTER_NAME Name=tag:aws:cloudformation:logical-id,Values=SubnetPublic* \
| jq -r '.Subnets[].SubnetId')
if [[ $? != 0 ]]; then
exit 1
fi
for subnet in ${public_cluster_subnets[@]}
do
echo "Attempting to create mount target in "$subnet"..."
aws efs create-mount-target \
--file-system-id $file_system_id \
--subnet-id $subnet \
--security-groups $security_group_id \
&> /dev/null \
&& echo "Mount target created!"
done
}
create_efs_mount_targets
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
