I recently spin up a new AWS EKS cluster (version 1.23) and tried to manage it with a newly downloaded kubectl cli (version 1.24).
When i tried to get the namespaces with the kubectl cli and faced this error:
~# kubectl get ns
error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
Initially I thought it was due to the incorrect api version used in the kubeconfig, thus I referred to https://kubernetes.io/docs/reference/config-api/client-authentication.v1beta1/ and changed to "client.authentication.k8s.io/v1beta1" and was also faced with the same error.
A little googling brings me to this github's issue on AWS cli (https://github.com/aws/aws-cli/issues/6920) which perfectly sums up the error I'm facing.
I downloaded the kubectl cli (version 1.23.6) and everything went fine there after.
~# curl -LO "https://dl.k8s.io/release/v1.23.6/bin/darwin/arm64/kubectl"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 138 100 138 0 0 515 0 --:--:-- --:--:-- --:--:-- 530
100 52.8M 100 52.8M 0 0 16.9M 0 0:00:03 0:00:03 --:--:-- 18.6M
~# chmod +x kubectl
~# sudo mv kubectl /usr/local/bin
~# kubectl version --client
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6", GitCommit:"ad3338546da947756e8a88aa6822e9c11e7eac22", GitTreeState:"clean", BuildDate:"2022-04-14T08:49:13Z", GoVersion:"go1.17.9", Compiler:"gc", Platform:"darwin/arm64"}
~# kubectl get ns
NAME STATUS AGE
default Active 51m
kube-node-lease Active 51m
kube-public Active 51m
kube-system Active 51m