Kubectl 命令抛出错误:无法连接到服务器:获取凭据:exec:退出状态 2

Lou*_*III 15 amazon-web-services kubernetes kubectl amazon-eks

我正在进行 EKS/Kubectl 的实验室设置,在完成集群构建后,我运行以下命令:

> kubectl get node

And I get the following error:
Unable to connect to the server: getting credentials: exec: exit status 2
Run Code Online (Sandbox Code Playgroud)

此外,我确信这是一个配置问题,

kubectl version
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:

create-cluster                           | delete-cluster                          
describe-cluster                         | describe-update                         
list-clusters                            | list-updates                            
update-cluster-config                    | update-cluster-version                  
update-kubeconfig                        | wait                                    
help                                    
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.1", GitCommit:"d224476cd0730baca2b6e357d144171ed74192d6", GitTreeState:"clean", BuildDate:"2020-01-14T21:04:32Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"darwin/amd64"}
Unable to connect to the server: getting credentials: exec: exit status 2
Run Code Online (Sandbox Code Playgroud)

请告知后续故障排除步骤。

sel*_*t91 9

请删除缓存文件夹中存在的文件夹

〜/.aws/cli/缓存


小智 0

你能检查一下你的 ~/.kube/config 文件吗?

假设您已经使用 minikube 启动本地集群,并且您的配置可用,那么您不应该收到服务器错误。

示例配置文件

    api版本:v1
    集群:
    - 簇:
        证书颁发机构:/Users/singhvi/.minikube/ca.crt
        服务器:https://127.0.0.1:32772
      名称:迷你库贝
    上下文:
    - 语境:
        集群:minikube
        用户: minikube
      名称:迷你库贝
    当前上下文:minikube
    种类:配置
    优先: {}
    用户:
    - 名称:minikube
      用户:
        客户端证书:/Users/singhvi/.minikube/profiles/minikube/client.crt
        客户端密钥:/Users/singhvi/.minikube/profiles/minikube/client.key