在哪里可以查看“eksctl”创建的服务帐户?

Zha*_* Yi 8 amazon-web-services amazon-eks

我在 AWS 中创建 EKS 集群并使用此命令创建服务帐户eksctl create iamserviceaccount --name alb-ingress-controller --cluster $componentName --attach-policy-arn $serviceRoleArn --approve --override-existing-serviceaccounts。\n该命令的输出为:

\n
[\xe2\x84\xb9]  using region ap-southeast-2\n[\xe2\x84\xb9]  1 existing iamserviceaccount(s) (default/alb-ingress-controller) will be excluded\n[\xe2\x84\xb9]  1 iamserviceaccount (default/alb-ingress-controller) was excluded (based on the include/exclude rules)\n[!]  metadata of serviceaccounts that exist in Kubernetes will be updated, as --override-existing-serviceaccounts was set\n[\xe2\x84\xb9]  no tasks\n
Run Code Online (Sandbox Code Playgroud)\n

我不确定是否创建成功。

\n

我使用此命令eksctl get iamserviceaccount来验证结果,但收到错误响应:

\n

Error: getting iamserviceaccounts: no output "Role1" in stack "eksctl-monitor-addon-iamserviceaccount-default-alb-ingress-controller"

\n

我也尝试运行kubectl get serviceaccount,但出现错误:Error from server (NotFound): serviceaccounts "alb-ingress-controller" not found

\n

这是否意味着服务帐户创建失败?在 AWS 控制台中哪里可以查看服务账户?或者在哪里可以查看错误?

\n

sam*_*ler 5

根据错误,这意味着serviceaccount已经存在。

\n

要获取服务帐户,请使用kubectl

\n
kubectl get serviceaccount <SERVICE_ACCOUNT_NAME> -n kube-system -o yaml\n
Run Code Online (Sandbox Code Playgroud)\n

顺序是,创建 IAM 角色,然后创建 \xe2\x80\x93 RBAC 角色和绑定。\n如果您想要覆盖现有服务帐户,请使用以下命令

\n
eksctl --profile <PROFILE_NAME> \\\n       --region=ap-northeast-2 \\\n       create iamserviceaccount \\\n       --name alb-ingress-controller \\\n       --namespace kube-system \\\n       --override-existing-serviceaccounts \\\n       --approve --cluster <CLUSTER_NAME> \\\n       --attach-policy-arn \\\n       arn:aws:iam::ACCOUNT_ID:policy/ALBIngressControllerIAMPolicy\n
Run Code Online (Sandbox Code Playgroud)\n

我发现这个研讨会Amazon EKS Workshop在我进入 EKS 的过程中非常有帮助。

\n

有关 ALB 的更多信息可以在此处找到

\n

编辑

\n

从这个错误

\n
\n

[\xe2\x84\xb9] 将排除 1 个现有 iamserviceaccount(default/alb-ingress-controller)

\n
\n

服务帐户似乎是在默认命名空间内创建的。

\n

所以检查服务帐户的命令将是

\n
kubectl get serviceaccount <SERVICE_ACCOUNT_NAME> -n default-o yaml\n
Run Code Online (Sandbox Code Playgroud)\n