aws eks update-kubeconfig invalid apiVersion
Problem
Describe the bug Update kubectl from v1.23.6 to 1.24.0 and run commands [code block] I get the following error and exit status 1 [code block] Kubectl must need an updated apiVersion in kubeconfig file. Not sure if this is on aws side or kubectl side. https://github.com/kubernetes/kubectl/issues/1210 Expected Behavior No error message when using `kubectl` and `aws eks update-kubeconfig` Current Behavior error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1" Reproduction Steps Update kubectl from v1.23.6 to 1.24.0 and run commands [code block] Possible Solution _No response_ Additional Information/Context _No response_ CLI version used whatever is running in aws/codebuild/standard:5.0 Environment details (OS name and version, etc.) aws/codebuild/standard:5.0
Error Output
error and exit status 1
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Update kubeconfig apiVersion for kubectl compatibility
The error occurs because the kubeconfig file generated by AWS EKS is using an outdated apiVersion for the exec plugin. Specifically, it is set to 'client.authentication.k8s.io/v1alpha1', which is not supported in kubectl v1.24.0. The newer versions of kubectl require the apiVersion to be updated to 'client.authentication.k8s.io/v1beta1'.
Awaiting Verification
Be the first to verify this fix
- 1
Backup existing kubeconfig
Before making any changes, back up your existing kubeconfig file to prevent data loss.
bashcp ~/.kube/config ~/.kube/config.bak - 2
Update kubeconfig using aws eks update-kubeconfig
Run the command to update your kubeconfig file with the latest configuration from AWS EKS.
bashaws eks update-kubeconfig --name <your-cluster-name> - 3
Manually edit kubeconfig file
Open the kubeconfig file located at ~/.kube/config and locate the exec section. Change the apiVersion from 'client.authentication.k8s.io/v1alpha1' to 'client.authentication.k8s.io/v1beta1'.
bashnano ~/.kube/config - 4
Verify the changes
After editing the kubeconfig file, verify that the apiVersion has been updated correctly and that there are no syntax errors.
bashkubectl config view - 5
Test kubectl commands
Run a simple kubectl command to ensure that the configuration is working correctly and that the error no longer appears.
bashkubectl get nodes
Validation
Confirm that running 'kubectl get nodes' returns the expected output without any errors. Additionally, check that the apiVersion in the kubeconfig file is now set to 'client.authentication.k8s.io/v1beta1'.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep