client-go
client-go copied to clipboard
Invalid apiVersion
Hello,
I'm trying to run the out of cluster example found here https://github.com/kubernetes/client-go/tree/master/examples/out-of-cluster-client-configuration . I made sure that 'kubectl get nodes' is working correctly when I run it from my terminal, and also made sure that my kube config if being picked up correctly from ~/.kube/config. But the example code is not running as expected and generating the following error 'exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"' when running kubernetes.NewForConfig(config).
Any help would be appreciated, I tried searching past issues but didn't find similar errors.
Thanks!
I've the identical issue.
I tried, as a test, to set 'apiVersion: client.authentication.k8s.io/v1beta1' in my .kube/config file, and while that got me past the error described above (exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1") with (kubernetes.NewForConfig(config) it lead me to this further error below in the next part of the code (clientset.CoreV1().Pods) listing pods.
Get "https://**********************.us-east-1.eks.amazonaws.com/api/v1/namespaces/kube-system/pods": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
I've the identical issue. use aws eks
I was facing the same problem with kubernetes server version is 1.20.x and client-go version 0.24.0 . I downgraded my client-go version to 0.20.4 and it worked. Please make sure that the client-go version is compatible with the version of your K8s server.
I was facing the same problem with kubernetes server version is 1.20.x and client-go version 0.24.0 . I downgraded my client-go version to 0.20.4 and it worked. Please make sure that the client-go version is compatible with the version of your K8s server.
Thanks alot @krriteshgupta - this fixed the issue downgrading the client-go to 0.20.4 (AWS EKS 1.21.x)
I can talk to EKS okay from v0.24.1. The most recent version of the AWS cli will generate a kubeconfig with client.authentication.k8s.io/v1beta1
. The newer AWS cli also include the correct version in the response from aws eks get-token --cluster-name
:
{
"kind": "ExecCredential",
"apiVersion": "client.authentication.k8s.io/v1beta1",
"spec": {},
"status": {
"expirationTimestamp": "2022-06-15T06:22:26Z",
"token": "k8s-aws-..snip.."
}
}
More details here: https://github.com/aws/aws-cli/issues/6920
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
I've the identical issue.
I tried, as a test, to set 'apiVersion: client.authentication.k8s.io/v1beta1' in my .kube/config file, and while that got me past the error described above (exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1") with (kubernetes.NewForConfig(config) it lead me to this further error below in the next part of the code (clientset.CoreV1().Pods) listing pods.
Get "https://**********************.us-east-1.eks.amazonaws.com/api/v1/namespaces/kube-system/pods": getting credentials: decoding stdout: no kind "ExecCredential" is registered for version "client.authentication.k8s.io/v1alpha1" in scheme "pkg/runtime/scheme.go:100"
I have a similar issue. Any help would be appreciated.
I'm facing the same problem
I'm facing the same problem
@clayrisser Updating AWS CLI V1 to V2 helped me solve this.
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Reopen this issue with
/reopen
- Mark this issue as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied- After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied- After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closedYou can:
- Reopen this issue with
/reopen
- Mark this issue as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
In my case, I was running the go command via Linux Cron. And the PATH variable contains only the "/usr/bin" path. AWS CLI v2 was in "/usr/local/bin". AWS CLI v1 was in "/usr/bin". Go program used AWS CLI v1 and hence this error.
After adding PATH=/usr/local/bin:$PATH to the Cron command, issue resolved.
PATH=/usr/local/bin:$PATH
This worked for me! Thank you!
doc for aws: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions