尝试将加密的AWS EFS与EKS中的efs-csi-node连接时出现挂载错误

时间:2020-08-18 17:11:13

标签: kubernetes amazon-eks aws-eks efs aws-efs

我曾尝试连接未加密的EFS,但工作正常,但是使用加密的EFS,吊舱抛出以下错误:

  Normal   Scheduled    10m                    default-scheduler                                     Successfully assigned default/jenkins-efs-test-8ffb4dc86-xnjdj to ip-10-100-4-249.ap-south-1.compute.internal
  Warning  FailedMount  6m33s (x2 over 8m49s)  kubelet, ip-10-100-4-249.ap-south-1.compute.internal  Unable to attach or mount volumes: unmounted volumes=[jenkins-home], unattached volumes=[sc-config-volume tmp jenkins-home jenkins-config secrets-dir plugins plugin-dir jenkins-efs-test-token-7nmkz]: timed out waiting for the condition
  Warning  FailedMount  4m19s                  kubelet, ip-10-100-4-249.ap-south-1.compute.internal  Unable to attach or mount volumes: unmounted volumes=[jenkins-home], unattached volumes=[plugins plugin-dir jenkins-efs-test-token-7nmkz sc-config-volume tmp jenkins-home jenkins-config secrets-dir]: timed out waiting for the condition
  Warning  FailedMount  2m2s                   kubelet, ip-10-100-4-249.ap-south-1.compute.internal  Unable to attach or mount volumes: unmounted volumes=[jenkins-home], unattached volumes=[tmp jenkins-home jenkins-config secrets-dir plugins plugin-dir jenkins-efs-test-token-7nmkz sc-config-volume]: timed out waiting for the condition
  Warning  FailedMount  35s (x13 over 10m)     kubelet, ip-10-100-4-249.ap-south-1.compute.internal  MountVolume.SetUp failed for volume "efs-pv" : kubernetes.io/csi: mounter.SetupAt failed: rpc error: code = Internal desc = Could not mount "" at "/var/lib/kubelet/pods/354800a1-dcf5-4812-aa91-0e84ca6fba59/volumes/kubernetes.io~csi/efs-pv/mount": mount failed: exit status 1
Mounting command: mount
Mounting arguments: -t efs /var/lib/kubelet/pods/354800a1-dcf5-4812-aa91-0e84ca6fba59/volumes/kubernetes.io~csi/efs-pv/mount
Output: mount: /var/lib/kubelet/pods/354800a1-dcf5-4812-aa91-0e84ca6fba59/volumes/kubernetes.io~csi/efs-pv/mount: can't find in /etc/fstab.

我在这里想念什么?

2 个答案:

答案 0 :(得分:1)

您没有指定K8s清单是什么或任何配置。 There shouldn't be any difference between encrypted and non-encrypted volumes when it comes to mounting from the client-side。本质上,AWS使用KMS为您管理加密密钥。

您看到的错误基本上是由于the mount command is not specifying the mount point,因此在使用未加密的EFS卷时,您必须更改K8s方面的其他默认配置。另外,您要尝试挂载EFS卷的Kubernetes节点上的EFS Mount helper是否可用?

✌️<​​/ p>

答案 1 :(得分:0)

如果EFS文件系统安装未按预期工作,请检查云初始化代理(/var/logs/cloud-init.log/var/logs/cloud-init-output.log)的日志。检查/etc/fstab文件。

尝试将efs-csi-node守护程序集从amazon/aws-efs-csi-driver:v0.3.0映像更新为amazon/aws-efs-csi-driver:latest

这里是示例安装EFS script。与您的比较,并注意:

此脚本的依赖性:

  • 默认ECS集群配置(Amazon Linux ECS AMI)。
  • ECS实例必须具有一个IAM角色,该角色至少使其具有对EFS的读取访问权限(以便找到EFS文件系统ID)。
  • ECS实例必须位于允许端口tcp / 2049(NFS)入站/出站的安全组中。
  • ECS实例所属的安全组必须与目标EFS文件系统关联。

此脚本的注意事项:

  • 由于EFS端点根据启动实例的区域和可用性区域而变化,因此EFS装入路径是按实例计算的。
  • 将EFS挂载添加到/etc/fstab,以便重新启动ECS实例时,将重新创建挂载点。
  • 重新启动Docker以确保其正确检测到EFS文件系统安装。

使用命令$ service docker restart挂载EFS后重新启动docker。最后,尝试重新启动EKS工作节点。

看看:mounting-efs-in-eks-cluster-example-deployment-failsefs-provisionerdynamic-ip-in-etc-fstab