Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Zheaoli/335bba0ad0e49a214c61cbaaa1b20306 to your computer and use it in GitHub Desktop.
Save Zheaoli/335bba0ad0e49a214c61cbaaa1b20306 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"

@DawnSunshine
Copy link

For ubuntu:

1. kubectl Client Version: v1.28.2
2. aws-cli/1.29.50
3. client.authentication.k8s.io/v1alpha1 - > client.authentication.k8s.io/v1beta1

It worked for me.

@Strik3ria
Copy link

In case this would be helpful to anyone not having success with the above recommendations:

My issue ended up being that I had installed awscli with Python 2.7. I uninstalled that version then installed awscli with pip3 instead of just pip and then my problem went away.

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