PodStuck - ContainerCreating
このセクションでは、ContainerCreating状態で停止しているポッドのトラブルシューティング方法について学びます。まず、デプロイメントが作成されているかを確認して、トラブルシューティングのシナリオを開始しましょう。
NAME READY UP-TO-DATE AVAILABLE AGE
efs-app 0/1 1 0 18m
同じ出力が得られた場合、トラブルシューティングを開始する準備ができています。
このトラブルシューティングセクションでの課題は、デプロイメントefs-appが0/1レディ状態になっている原因を見つけ、それを修正してデプロイメントに1つのポッドが準備完了して実行されるようにすることです。
トラブルシューティングを始めましょう
ステップ1:ポッドの状態を確認する
まず、ポッドの状態を確認する必要があります。
NAME READY STATUS RESTARTS AGE
efs-app-5c4df89785-m4qz4 0/1 ContainerCreating 0 19m
ステップ2:ポッドを詳細に調べる
ポッドの状態がContainerCreatingと表示されています。イベントを確認するためにポッドを詳細に調べてみましょう。
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedMount 26m (x3 over 26m) kubelet MountVolume.SetUp failed for volume "pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0" : rpc error: code = Internal desc = Could not mount "fs-00a4069aec7924c8c:/" at "/var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount": mount failed: exit status 1
Mounting command: mount
Mounting arguments: -t efs -o accesspoint=fsap-0488d7b0bd9c26425,tls fs-00a4069aec7924c8c:/ /var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount
Output: Failed to resolve "fs-00a4069aec7924c8c.efs.us-west-2.amazonaws.com". The file system mount target ip address cannot be found, please pass mount target ip address via mount options.
No mount target created for the file system fs-00a4069aec7924c8c is in available state yet, please retry in 5 minutes.
Warning: config file does not have fips_mode_enabled item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [fips_mode_enabled = False].Warning: config file does not have fips_mode_enabled item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [fips_mode_enabled = False].
Warning FailedMount 26m (x3 over 26m) kubelet MountVolume.SetUp failed for volume "pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0" : rpc error: code = Internal desc = Could not mount "fs-00a4069aec7924c8c:/" at "/var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount": mount failed: exit status 1
Mounting command: mount
Mounting arguments: -t efs -o accesspoint=fsap-0488d7b0bd9c26425,tls fs-00a4069aec7924c8c:/ /var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount
Output: Failed to resolve "fs-00a4069aec7924c8c.efs.us-west-2.amazonaws.com". Cannot connect to file system mount target ip address 10.42.41.35.
Connection to the mount target IP address 10.42.41.35 timeout. Please retry in 5 minutes if the mount target is newly created. Otherwise check your VPC and security group configuration to ensure your file system is reachable via TCP port 2049 from your instance.
Warning: config file does not have fips_mode_enabled item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [fips_mode_enabled = False].Warning: config file does not have fips_mode_enabled item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [fips_mode_enabled = False].
Warning FailedMount 19m kubelet MountVolume.SetUp failed for volume "pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0" : rpc error: code = Internal desc = Could not mount "fs-00a4069aec7924c8c:/" at "/var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount": mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t efs -o accesspoint=fsap-0488d7b0bd9c26425,tls fs-00a4069aec7924c8c:/ /var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount
Output: Could not start amazon-efs-mount-watchdog, unrecognized init system "aws-efs-csi-dri"
Mount attempt 1/3 failed due to timeout after 15 sec, wait 0 sec before next attempt.
Mount attempt 2/3 failed due to timeout after 15 sec, wait 0 sec before next attempt.
b'mount.nfs4: mount point /var/lib/kubelet/pods/b2db07f9-0bae-4324-98e6-e4c978a0bef5/volumes/kubernetes.io~csi/pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0/mount does not exist'
Warning: config file does not have fips_mode_enabled item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [fips_mode_enabled = False].Warning: config file does not have retry_nfs_mount_command item in section mount.. You should be able to find a new config file in the same folder as current config file /etc/amazon/efs/efs-utils.conf. Consider update the new config file to latest config file. Use the default value [retry_nfs_mount_command = True].
Warning FailedMount 3m33s (x6 over 23m) kubelet MountVolume.SetUp failed for volume "pvc-719c8ef2-5bdb-4638-b4db-7d59b53d21f0" : rpc error: code = DeadlineExceeded desc = context deadline exceeded
「Cannot connect to file system mount target ip address x.x.x.x.」と「Connection to the mount target IP address x.x.x.x timeout」というメッセージが表示されています。これは、EFSファイルシステムがポッドにマウントできないことを示しています。
ステップ3:ノードのネットワーク設定を確認する
ポッドがスケジュールされているノードのネットワーク設定を確認してみましょう。
[
{"IpProtocol": "-1",
"UserIdGroupPairs": [],
"IpRanges": [
{"CidrIp": "0.0.0.0/0"
}
],
"Ipv6Ranges": [],
"PrefixListIds": []
}
]
出力ルールに制限はありません。IpProtocol -1はすべてのプロトコルを示し、CidrIpは宛先が0.0.0.0/0であることを示します。したがって、ワーカーノードからの通信に制限はなく、EFSマウントターゲットに到達できるはずです。
EKSコンソールでも確認できます。eks-workshopクラスターに移動し、efs-appポッドとノードのインスタンスIDを見つけます。このインスタンスのセキュリティグループはEC2コンソールで確認できます。
EKSコンソールタブを開くステップ4:EFSファイルシステムのネットワーク設定を確認する
次に、EFSファイルシステムのネットワーク設定を確認しましょう。
[
{"IpProtocol": "tcp",
"FromPort": 80,
"ToPort": 80,
"UserIdGroupPairs": [],
"IpRanges": [
{"CidrIp": "10.42.0.0/16"
}
],
"Ipv6Ranges": [],
"PrefixListIds": []
}
]
EFSのマウントターゲットに関連付けられたセキュリティグループは、VPC CIDRからのポート80のみの受信ルールを持っています。マウントターゲットのセキュリティグループはポート2049のトラフィックを許可する必要があります。
これはEFSコンソールでも確認できます。eks-workshop-efsという名前のEFSファイルシステムIDをクリックしてください。その後、「ネットワーク」をクリックして、すべてのアベイラビリティゾーンのマウントターゲットと各マウントターゲットに関連付けられたセキュリティグループを表示します。
EFSコンソールタブを開くステップ5:EFSマウントターゲットのセキュリティグループに受信ルールを追加する
EKSクラスターのVPC CIDRからポート2049でNFSトラフィックを許可するために、EFSマウントターゲットのセキュリティグループに受信ルールを追加しましょう。
{"Return": true,
"SecurityGroupRules": [
{"SecurityGroupRuleId": "sgr-05ae66b3cfafxxxxx",
"GroupId": "sg-0d69452207dbxxxxx",
"GroupOwnerId": "682844965773",
"IsEgress": false,
"IpProtocol": "tcp",
"FromPort": 2049,
"ToPort": 2049,
"CidrIpv4": "10.42.0.0/16"
}
]
}
3〜4分後、defaultネームスペースのポッドが実行状態になっていることに気付くでしょう。
NAME READY STATUS RESTARTS AGE
efs-app-5c4df89785-m4qz4 1/1 Running 0 102m
EFSマウントターゲットのセキュリティグループがポート2049のトラフィックを許可するようになったため、ワーカーノードはマウントターゲットと正常に通信し、EFSをポッドにマウントすることができました。