因此,我创建了我的第一个 EKS 集群(此 URL 仅用于说明):
https://us-east-1.console.aws.amazon.com/eks/home?region=us-east-1#/clusters/MyEksClusterName?selectedTab=cluster-overview-tab
我想用它来练习通过 EKS 进行 Docker
容器部署。
我寻找了有关如何仅使用 AWS 控制台操作来完成此操作的分步说明(即没有 kubctl
、没有 aws
CLI),但我拥有的所有说明能够找到涉及一些必要的 CLI 交互。例如:
https://towardsdatascience.com/kubernetes-application-deployment-with-aws-eks-and-ecr-4600e11b2d3c
我确实设法create a kubeconfig file (包括role-arn
)和
set KUBECONFIG=C:\Users\Me\mydockercontainer\kubeconfig
但是当我尝试运行 kubectl get componentstatuses
时,我收到:
Unable to connect to the server: getting credentials: exec: executable aws not found
It looks like you are trying to use a client-go credential plugin that is not installed.
我没有在我的环境中使用与 Go
相关的任何内容...我研究了此错误消息并发现:"Make sure you have installed AWS CLI."
因此,我继续安装了 AWS CLI:
aws --version
aws-cli/2.11.22 Python/3.11.3 Windows/10 exe/AMD64 prompt/off
但是当我现在尝试运行 kubectl get componentstatuses
时,我收到了:
Unable to locate credentials. You can configure credentials by running "aws configure".
Unable to locate credentials. You can configure credentials by running "aws configure".
Unable to locate credentials. You can configure credentials by running "aws configure".
Unable to locate credentials. You can configure credentials by running "aws configure".
Unable to locate credentials. You can configure credentials by running "aws configure".
Unable to connect to the server: getting credentials: exec: executable aws failed with exit code 253
我确实找到了有关aws configure
的说明:https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
但在这一点上,我觉得我把事情变得过于复杂了,而且我对一个本来会简单得多的程序研究得太深了。也就是说,与只需点击 AWS 控制台上的各种选项相比(就像创建 IAM 角色、用户、EC2 实例等时一样)。
所以我的问题是:
- 是否可以仅使用 AWS 控制台通过 EKS 部署现有容器?
- 在哪里可以找到有关如何实现这一目标的分步说明?
最佳答案
我认为这是不可能的。您需要了解有关 how kubernetes and iam roles works, rather how EKS works
的更多信息。 EKS 只是一种在云上拥有自己的 K8s 集群及其所需的所有底层基础设施(网络、存储、计算等)的方法。您看到的 EKS 控制台页面只是一个 UI,用于检查部署的资源以及作为 api 端点的集群信息。
任何 K8s 集群(无论本地,在 AWS/Azure/GCP/ect 上)的入口点都是 api 服务器,它是一个实际端点(在 eks 上,您可以在 overview
选项卡中的 API server endpoint
参数下找到)您可以执行任何 API 请求。 为此,您需要经过身份验证和授权。
在 AWS EKS 中,集群基于 IAM 角色进行身份验证。因此,在 link you provided for the kubeconfig 的 users
定义中,kubectl 通过运行 aws eks get-token
进行身份验证。为了能够运行此命令,您需要具有附加到 shell 中使用的 aws 配置文件的正确权限才能运行上一个命令。请引用How to configure aws-cli
在 shell 中配置 aws 配置文件后,手动运行 aws eks get-token --cluster-name <<name>> --region <<region>>
,看看它是否有效。如果是这样,那么 kubectl 也可以工作。
关于amazon-web-services - 是否可以仅使用 AWS 控制台通过 EKS 部署现有容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76330907/