Skip to content

Instantly share code, notes, and snippets.

  • Save radoslav-stefanov/2f91f885c955d94d1854ac69ef178d5a to your computer and use it in GitHub Desktop.
Save radoslav-stefanov/2f91f885c955d94d1854ac69ef178d5a to your computer and use it in GitHub Desktop.
新版 v1.24.0 kubectl cli 在 aws eks 上使用失效的解决方法.md

Please update your awscli to 2.6.3

In v1.24.0, kubectl will report the following error when relying on the kubeconfig generated by aws-cli

> error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

The reason is that Kubernetes deprecated client.authentication.k8s.io/v1alpha1" from the exec plugin in PR108616

And the aws-cli update PR6476 has not been merged. There are two solutions

1. Roll back kubectl to any version less than v1.24.0 2. Take MacOS + HomeBrew as an example: 1. Modify "client.authentication.k8s.io/v1alpha1" in your kubeconfig to "client.authentication.k8s.io/v1beta1" 2. Put "client.authentication.k8s.io/ in /usr/local/Cellar/awscli/{awscliVersion}/libexec/lib/python3.9/site-packages/awscli/customizations/eks/get_token.py v1alpha1" changed to "client.authentication.k8s.io/v1beta1"

升级 awscli 到 2.6.3

在 v1.24.0 中,kubectl 在依赖 aws-cli 生成的 kubeconfig 的时候会报错如下

> error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

原因是,Kubernetes 在 PR108616 中将 client.authentication.k8s.io/v1alpha1"exec plugin 中废弃

而 aws-cli 的更新 PR6476 还没有合并。解决方法有两个

1. 将 kubectl 回退至任意小于 v1.24.0 的版本 2. 以 MacOS + HomeBrew 为例: 1. 修改你 kubeconfig 中的 "client.authentication.k8s.io/v1alpha1" 为 "client.authentication.k8s.io/v1beta1" 2. 将 /usr/local/Cellar/awscli/{awscliVersion}/libexec/lib/python3.9/site-packages/awscli/customizations/eks/get_token.py 中的 "client.authentication.k8s.io/v1alpha1" 修改为 "client.authentication.k8s.io/v1beta1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment