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"
cd
mv kubectl kubectl_1.24
mv bin bin_1.24
curl -O https://s3.us-west-2.amazonaws.com/amazon-eks/1.23.15/2023-01-11/bin/linux/amd64/kubectl
chmod +x ./kubectl
mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin
kubectl version
This helped!