如何解决AWS EKS fargate coredns ImagePullBackOff
我正在尝试将一个简单的教程应用部署到一个新的基于 Fargate 的 Kubernetes 集群。
不幸的是,我被 coredns pod 困在 ImagePullBackOff 上:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning LoggingDisabled 5m51s fargate-scheduler Disabled logging because aws-logging configmap was not found. configmap "aws-logging" not found
Normal Scheduled 4m11s fargate-scheduler Successfully assigned kube-system/coredns-86cb968586-mcdpj to fargate-ip-172-31-55-205.eu-central-1.compute.internal
Warning Failed 100s kubelet Failed to pull image "602401143452.dkr.ecr.eu-central-1.amazonaws.com/eks/coredns:v1.8.0-eksbuild.1": rpc error: code = Unknown desc = failed to pull and unpack image "602
401143452.dkr.ecr.eu-central-1.amazonaws.com/eks/coredns:v1.8.0-eksbuild.1": failed to resolve reference "602401143452.dkr.ecr.eu-central-1.amazonaws.com/eks/coredns:v1.8.0-eksbuild.1": failed to do request: Head "https://602401143452.dkr.
ecr.eu-central-1.amazonaws.com/v2/eks/coredns/manifests/v1.8.0-eksbuild.1": dial tcp 3.122.9.124:443: i/o timeout
Warning Failed 100s kubelet Error: ErrImagePull
Normal BackOff 99s kubelet Back-off pulling image "602401143452.dkr.ecr.eu-central-1.amazonaws.com/eks/coredns:v1.8.0-eksbuild.1"
Warning Failed 99s kubelet Error: ImagePullBackOff
Normal Pulling 87s (x2 over 4m10s) kubelet Pulling image "602401143452.dkr.ecr.eu-central-1.amazonaws.com/eks/coredns:v1.8.0-eksbuild.1"
在谷歌搜索时我发现 https://aws.amazon.com/premiumsupport/knowledge-center/eks-ecr-troubleshooting/ 它包含以下列表:
To resolve this error,confirm the following:
- The subnet for your worker node has a route to the internet. Check the route table associated with your subnet.
- The security group associated with your worker node allows outbound internet traffic.
- The ingress and egress rule for your network access control lists (ACLs) allows access to the internet.
由于我手动创建了我的私有子网和它们的 NAT 网关,所以我试图在这里找到一个问题,但找不到任何东西。它们以及安全组和 ACL 对我来说都很好。
我什至将 AmazonEC2ContainerRegistryReadOnly 添加到我的 EKS 角色中,但在发出命令 kubectl rollout restart -n kube-system deployment coredns
后,不幸的是结果是一样的:ImagePullBackOff
不幸的是,我的想法已经用完了,我被卡住了。任何可以帮助我解决此问题的帮助将不胜感激。 ~谢谢
编辑>
按照@mreferre 在他的评论中的建议,通过 *eksctl 创建新集群后,我收到 RBAC 错误链接:https://docs.aws.amazon.com/eks/latest/userguide/troubleshooting_iam.html#security-iam-troubleshoot-cannot-view-nodes-or-workloads
编辑>>
通过 AWS 控制台(网络界面)创建的集群没有 configmap aws-auth 我已经使用命令 kubectl edit configmap aws-auth -n kube-system
apiVersion: v1
data:
mapRoles: |
- groups:
- system:bootstrappers
- system:nodes
- system:node-proxier
rolearn: arn:aws:iam::370179080679:role/eksctl-tutorial-cluster-FargatePodExecutionRole-1J605HWNTGS2Q
username: system:node:{{SessionName}}
kind: ConfigMap
metadata:
creationTimestamp: "2021-04-08T18:42:59Z"
name: aws-auth
namespace: kube-system
resourceVersion: "918"
selfLink: /api/v1/namespaces/kube-system/configmaps/aws-auth
uid: d9a21964-a8bf-49e9-800f-650320b7444e
解决方法
创建一个答案来总结评论中认为可以接受的讨论。设置支持 Fargate 的 EKS 集群的最常见(并且可以说是更简单)的方法是使用 EKSCTL 并使用 eksctl create cluster --fargate
设置集群。这将为您构建所有管道,您将获得一个没有 EC2 实例或托管节点组的集群,其中两个 CoreDNS
Pod 部署在两个 Fargate 实例上。请注意,当您通过命令行部署 EKSCTL 时,您最终可能会在 CLI 和控制台之间使用不同的角色/用户。这可能会导致访问被拒绝问题。最佳做法是使用非 root 用户登录 AWS 控制台并使用 CloudShell 使用 EKSCTL 进行部署(CloudShell 将继承相同的控制台用户身份)。 {评论中的更多信息}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。