0

我为 AWS EKS 集群定义了我的 KUBECONFIG:

aws eks update-kubeconfig --region eu-west-1 --name yb-demo

但使用时出现以下错误kubectl

...
Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).
[opc@C eks]$ kubectl get sc
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.

To learn more about this feature, consult the documentation available at:
      https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins
4

2 回答 2

1

您还可以将自定义 aws cli 安装路径附加到~/.bash_profile:中的 $PATH 变量export PATH=$PATH:<path to aws cli program directory>。这样您就不需要sed每次添加 EKS 集群时都使用 kubeconfig 文件。此外,您将能够aws在命令提示符下使用命令,而无需为每次执行指定程序的完整路径。

于 2022-02-22T14:19:33.547 回答
0

似乎在~/.kube/configcommand: aws使用PATH环境并且没有找到它。以下是将其更改为完整路径的方法:

sed -e "/command: aws/s?aws?$(which aws)?" -i ~/.kube/config
于 2022-02-22T13:59:48.097 回答