kubectl-ice icon indicating copy to clipboard operation
kubectl-ice copied to clipboard

failed to create clientset

Open luciferhs opened this issue 3 years ago • 3 comments

[root@mexo-relay ~]# kubectl-ice cpu -A failed to create clientset: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

luciferhs avatar Jun 20 '22 06:06 luciferhs

that error happens when the code is unable to create a clientset config in memory, three questions spring to mind

  • what version of k8s are you running?
  • do you have anything special of different in your kube config?
  • do you have metrics set up and configured correctly?

NimbleArchitect avatar Jun 20 '22 08:06 NimbleArchitect

so I just faced the same issue by updating kubectl. It seems it is related:

✗  kubectl version                          
Client Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.6-eks-7d68063", GitCommit:"f24e667e49fb137336f7b064dba897beed639bad", GitTreeState:"clean", BuildDate:"2022-02-23T19:32:14Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.9-eks-a64ea69", GitCommit:"540410f9a2e24b7a2a870ebfacb3212744b5f878", GitTreeState:"clean", BuildDate:"2022-05-12T19:15:31Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}

➜ k ice cpu --match 'used>0' --sort '!USED'
failed to create clientset: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"

at the same time kubectl works as expected:

➜ kubectl get pods                                                                                                             
No resources found in default namespace.

to fix you need to update to latest aws cli

 curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install --update

➜ k ice cpu --match 'used>0' --sort '!USED'
no pods found in default namespace

dmitry-mightydevops avatar Jun 29 '22 05:06 dmitry-mightydevops

and don't forget to do after you update aws cli

✗  aws eks --region us-east-1 update-kubeconfig --name project-staging-eks
Updated context arn:aws:eks:us-east-1:xxxx:cluster/project-staging-eks in /home/dmitry/.kube/config

dmitry-mightydevops avatar Jun 29 '22 05:06 dmitry-mightydevops

moved answer to faq page also linked it back here

https://nimblearchitect.github.io/kubectl-ice/faq/#failed-to-create-clientset

NimbleArchitect avatar Aug 19 '22 18:08 NimbleArchitect