kubectl 版本错误:exec 插件配置为使用 API 版本 client.authentication.k8s.io/v1alpha1

Sar*_*ana 40 authentication plugins kubectl amazon-eks

我正在为我的 eks 环境设置我的新 Mac。安装 kubectl 后,aws-iam-authenticator 和 kubeconfig 文件放置在默认位置。我运行了命令 kubectl 命令并在命令块中收到了下面提到的错误。

我的集群使用 v1alpha1 客户端身份验证 api 版本,所以基本上我想在我的 Mac 中使用相同的版本。

我也尝试了最新版本(1.23.0)的 kubectl,仍然是同样的错误。然而,当我尝试使用 aws-iam-authenticator (版本 0.5.5)时,我无法下载较低版本。

有人可以帮我解决吗?

% kubectl version          
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.0", GitCommit:"af46c47ce925f4c4ad5cc8d1fca46c7b77d13b38", GitTreeState:"clean", BuildDate:"2020-12-08T17:59:43Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
Unable to connect to the server: getting credentials: exec plugin is configured to use API version client.authentication.k8s.io/v1alpha1, plugin returned version client.authentication.k8s.io/v1beta1
Run Code Online (Sandbox Code Playgroud)

谢谢和问候, 萨拉瓦娜

Boa*_*oaz 57

我也有同样的问题

您正在使用aws-iam-authenticator 0.5.5,AWS 将其行为方式更改0.5.4为 require v1beta1

这取决于您的配置,但您可以尝试v1beta1 通过检查 kubeconfig 文件(通常在 中~/.kube/config)从client.authentication.k8s.io/v1alpha1到 来更改您正在使用的 K8s 上下文client.authentication.k8s.io/v1beta1

否则切换回aws-iam-authenticator 0.5.3- 如果您使用 M1 架构,您可能需要从源代码构建它,因为没有darwin-arm64为其构建二进制文件

  • 有关一些附加信息,此处描述了更改:https://github.com/kubernetes-sigs/aws-iam-authenticator/pull/386 我能够通过更新我的 kubeconfig 并替换 `client 来解决我的问题.authentication.k8s.io/v1alpha1` 与 `client.authentication.k8s.io/v1beta1` (8认同)

Lyl*_*man 17

这对我使用 M1 芯片有用

sed -i .bak -e 's/v1alpha1/v1beta1/' ~/.kube/config
Run Code Online (Sandbox Code Playgroud)


Tig*_*eng 10

我用下面的命令解决了这个问题

aws eks update-kubeconfig --name mycluster 
Run Code Online (Sandbox Code Playgroud)


小智 6

另请确保 AWS CLI 版本是最新的。否则,AWS IAM Authenticator 可能无法与 v1beta1 配合使用:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
Run Code Online (Sandbox Code Playgroud)

如https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html所示


Aar*_*ron 5

我还通过更新apiVersionkube 配置文件 ( ~/.kube/config) 中的值解决了这个问题。

client.authentication.k8s.io/v1alpha1client.authentication.k8s.io/v1beta1