AWS announces preview of AWS Interconnect - multicloud
AWS announces AWS Interconnect – multicloud (preview), providing simple, resilient, high-speed private connections to other cloud service providers. AWS Interconnect - multicloud is easy to configure and provides high-speed, resilient connectivity with dedicated bandwidth, enabling customers to interconnect AWS networking services such as AWS Transit Gateway, AWS Cloud WAN, and Amazon VPC to other cloud service providers with ease.
如何對 Amazon EKS 中的 Amazon EFS 磁碟區掛載問題進行疑難排解?
當我嘗試在 Amazon Elastic Kubernetes Service (Amazon EKS) 叢集中掛載 Amazon Elastic File System (Amazon EFS) 磁碟區時,收到錯誤。
解決方法
先決條件:
- 確認您的 Amazon EFS 檔案系統,在每個工作節點子網路的可用區域中都有掛載目標。
- 確認您在 Amazon EFS 儲存類別定義中使用 efs.csi.aws.com。如需更多資訊,請參閱 GitHub 網站上的 EFS 儲存類別。
- 確認您使用了 PersistentVolumeClaim 和 PersistentVolume。如需更多資訊,請參閱 GitHub 網站上的 PersistentVolumeClaim 與 PersistentVolume。
**注意:**如果您使用動態佈建,則無需使用 PersistentVolumeClaim 與 PersistentVolume。如需相關資訊,請參閱 GitHub 網站上的動態佈建。 - 確認您已在 EKS 叢集中安裝 Amazon EFS CSI 驅動程式附加元件。
確認您已正確設定 EKS 工作節點至 Amazon EFS API 的網路
確保從 EFS 工作節點和 EFS 控制器 Pod 可以存取 Amazon EFS API。
如果您未設定網路以連線到 Amazon EFS API,可能會收到以下其中一則錯誤訊息:
- 「failed to provision volume with StorageClass "xxxx": rpc error: code = DeadlineExceeded desc = context deadline exceeded」
- 「Could not start amazon-efs-mount-watchdog, unrecognized init system "bash" Mount attempt x/3 failed due to timeout after 15 sec」
- 「Unable to attach or mount volumes: timed out waiting for the condition」
如果您使用沒有傳出網際網路存取的私有叢集,則必須在 VPC 中包含 com.amazonaws.region.elasticfilesystem 虛擬私有雲端 (VPC) 端點。為 VPC 端點的安全群組建立傳入規則,允許工作節點與 Pod 子網路對 443 連接埠的流量。確認附加於 VPC 端點的政策具有必要權限。
確認您已正確設定 Amazon EFS 掛載目標
確保在 EKS 節點所在的每個可用區域中建立 Amazon EFS 掛載目標。例如,如果您的工作節點分布在 us-east-1a 和 us-east-1b,則要在兩個可用區域中為要掛載的 EFS 檔案系統建立掛載目標。
如果未正確設定掛載目標,您可能會收到以下錯誤訊息:
「Output: Failed to resolve "fs-xxxxxx.efs.us-east-1.amazonaws.com" - The file system mount target ip address cannot be found」
確認與 Amazon EFS 檔案系統及工作節點關聯的安全群組允許 NFS 流量
如果安全群組不允許流量,您可能會收到以下其中一則錯誤訊息:
- 「Could not start amazon-efs-mount-watchdog, unrecognized init system "bash" Mount attempt x/3 failed due to timeout after 15 sec」
- 「failed to provision volume with StorageClass "xxxx": rpc error: code = DeadlineExceeded desc = context deadline exceeded」
- 「Unable to attach or mount volumes: timed out waiting for the condition」
Amazon EFS 檔案系統的安全群組 必須有傳入規則,允許來自叢集 VPC 之 無類別域間路由 (CIDR) 的網路檔案系統 (NFS) 流量。允許傳入流量使用 2049 連接埠。
與 Pod 無法掛接 EFS 磁碟區的工作者節點相關聯的安全群組必須具有輸出規則。傳出規則必須允許從 2049 連接埠到 EFS 檔案系統的 NFS 流量。
確認您已在 Amazon EFS 檔案系統中建立子目錄路徑
如果在持續性磁碟區中新增子目錄路徑,Amazon EFS CSI 區動程式不會自動在檔案系統中建立該路徑。您必須事先在檔案系統中建立子目錄,掛載作業才能成功。如果檔案系統中不存在子目錄,那麼您可能會收到以下錯誤訊息:
「Output: mount.nfs4: mounting fs-18xxxxxx.efs.us-east-1.amazonaws.com:/path-in-dir:/ failed, reason given by server: No such file or directory」
若要確認 EFS 檔案系統中是否存在子目錄,請在 EC2 執行個體上掛載 EFS 檔案系統並列出其內容。如果子目錄不存在,請使用 mkdir 命令建立子目錄。
確認叢集 VPC 使用 Amazon DNS 伺服器
當您使用 Amazon EFS CSI 驅動程式掛載 EFS 磁碟區時,必須為 VPC 使用 Amazon DNS 伺服器。
**注意:**只有 Amazon 提供的 DNS 可以解析 Amazon EFS 服務的檔案系統 DNS。
若要驗證 DNS 伺服器,請登入 Worker 節點並執行下列命令:
nslookup fs-4fxxxxxx.efs.region.amazonaws.com AMAZON_PROVIDED_DNS_IP
**注意:**將 region 替換為您的 AWS 區域。將 AMAZON_PROVIDED_DNS_IP 替換為您的 DNS IP 位址。
如果自訂 DNS 伺服器未轉發請求,可能會收到以下錯誤訊息:
「Output: Failed to resolve "fs-xxxxxx.efs.us-west-2.amazonaws.com" - The file system mount target ip address cannot be found」
如果叢集 VPC 使用自訂 DNS 伺服器,請將此 DNS 伺服器設定為將所有 *.amazonaws.com 請求轉發至 Amazon DNS 伺服器。
當使用限制性檔案系統政策時,請確認 PersistentVolume 定義中有 iam 掛載選項
如果未在限制性檔案系統政策中新增 iam 掛載選項,Pod 會失敗並出現以下錯誤訊息:
「mount.nfs4: access denied by server while mounting 127.0.0.1:/」
如果您已將 Amazon EFS 檔案系統設定為僅允許特定 AWS Identity and Access Management (IAM) 角色掛載,請使用 -o iam 掛載。加入 spec.mountOptions 屬性,以允許 CSI 驅動程式添加 IAM 掛載選項。
範例:
apiVersion: v1 kind: PersistentVolume metadata: name: efs-pv1 spec: mountOptions: - iam
確認已正確將 Amazon EFS CSI 驅動程式控制器服務帳戶註解為具有必要權限的 IAM 角色
若要確認 efs-csi-controller Pod 所使用的服務帳戶具有正確的註解,請執行下列命令:
kubectl describe sa efs-csi-controller-sa -n kube-system
輸出範例:
eks.amazonaws.com/role-arn: arn:aws:iam::111122223333:role/AmazonEKS_EFS_CSI_DriverRole
若要確認帳戶具有正確的 AWS Identity and Access Management (IAM) 角色與權限,請驗證叢集的 IAM OIDC 提供者。檢查與 efs-csi-controller-sa 服務帳戶關聯的 IAM 角色是否具有執行 EFS API 呼叫所需的權限。接著,確認 IAM 角色的信任政策信任服務帳戶 efs-csi-controller-sa。
IAM 角色信任政策範例:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Federated": "arn:aws:iam::111122223333:oidc-provider/oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE" }, "Action": "sts:AssumeRoleWithWebIdentity", "Condition": { "StringLike": { "oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:sub": "system:serviceaccount:kube-system:efs-csi-*", "oidc.eks.region-code.amazonaws.com/id/EXAMPLED539D4633E53DE1B71EXAMPLE:aud": "sts.amazonaws.com" } } } ] }
確認 EFS CSI 驅動程式 Pod 正在執行
執行以下命令,確認這些 Pod 在叢集中處於作用中:
kubectl get all -l app.kubernetes.io/name=aws-efs-csi-driver -n kube-system
檢查 Pod 無法掛載檔案系統的 EC2 工作節點的 EFS 掛載作業
登入 Pod 的 Amazon EKS 工作節點。然後,使用 EFS 掛載協助程式,手動將 EFS 檔案系統掛載到工作節點。若要測試掛載作業,請執行下列命令:
sudo mount -t efs -o tls file-system-dns-name efs-mount-point/
如果工作者節點可以掛載檔案系統,請檢閱 CSI 控制器和 CSI 節點 Pod 中的 efs-plugin 日誌。
檢查 EFS CSI 驅動程式 Pod 日誌,以確定掛載失敗的原因
如果磁碟區掛載失敗,請檢閱 efs-plugin 日誌。若要擷取 EFS 外掛程式容器日誌,請執行下列命令:
kubectl logs deployment/efs-csi-controller -n kube-system -c efs-plugin kubectl logs daemonset/efs-csi-node -n kube-system -c efs-plugin
- 語言
- 中文 (繁體)

相關內容
- 已提問 3 年前
- 已提問 1 年前
- 已提問 2 年前
- 已提問 1 年前