'kubectl versions Error: exec plugin is configured to use API version client.authentication.k8s.io/v1alpha1
I was setting up my new Mac for my eks environment. After the installation of kubectl, aws-iam-authenticator and the kubeconfig file placement in default location. I ran the command kubectl command and got this error mentioned below in command block.
My cluster uses v1alpha1 client auth api version so basically i wanted to use the same one in my Mac as well.
I tried with latest version (1.23.0) of kubectl as well, still the same error. Whereas When i tried to do with aws-iam-authenticator (version 0.5.5) I was not able to download lower version.
Can someone help me to resolve it?
% 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
Thanks and Regards, Saravana
Solution 1:[1]
I have the same problem
You're using aws-iam-authenticator
0.5.5
, AWS changed the way it behaves in 0.5.4
to require v1beta1
.
It depends on your configuration, but you can try to change the K8s context you're using to v1beta1
by checking your kubeconfig file (usually in ~/.kube/config
) from client.authentication.k8s.io/v1alpha1
to client.authentication.k8s.io/v1beta1
Otherwise switch back to aws-iam-authenticator
0.5.3
- you might need to build it from source if you're using the M1 architecture as there's no darwin-arm64
binary built for it
Solution 2:[2]
This worked for me using M1 chip
sed -i .bak -e 's/v1alpha1/v1beta1/' ~/.kube/config
Solution 3:[3]
I also solved this by updating the apiVersion
value in my kube config file (~/.kube/config
).
client.authentication.k8s.io/v1alpha1
to client.authentication.k8s.io/v1beta1
Solution 4:[4]
I fixed the issue with command below
aws eks update-kubeconfig --name mycluster
Solution 5:[5]
This might be helpful to fix this issue for those who were using GitHub actions.
For my situation I was using kodermax/kubectl-aws-eks
with GitHub actions.
I added the KUBECTL_VERSION
and IAM_VERSION
environment variables for each steps using kodermax/kubectl-aws-eks
to keep them in fixed versions.
- name: deploy to cluster
uses: kodermax/kubectl-aws-eks@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA_STAGING }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: my-app
IMAGE_TAG: ${{ github.sha }
KUBECTL_VERSION: "v1.23.6"
IAM_VERSION: "0.5.3"
Solution 6:[6]
Using kubectl 1.21.9 fixed it for me, with asdf:
asdf plugin-add kubectl https://github.com/asdf-community/asdf-kubectl.git
asdf install kubectl 1.21.9
And I would recommend having a .tools-versions
file with:
kubectl 1.21.9
This question is a duplicate of error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1" CircleCI
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Lyle H |
Solution 3 | Aaron |
Solution 4 | Tiger peng |
Solution 5 | DileepNimantha |
Solution 6 | Dorian |