lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.53k stars 1.47k forks source link

Error upon connecting to cluster on Windows #6866

Closed dcole-gsn closed 1 year ago

dcole-gsn commented 1 year ago

Describe the bug When attempting to connect to a cluster on Windows require the following error message

F0103 14:46:21.817744 53236 main.go:82] failed to initialize proxyexec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1" goroutine 1 [running]: k8s.io/klog/v2.stacks(0x1) C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:860 +0x8a k8s.io/klog/v2.(loggingT).output(0x2dfff40, 0x3, 0x0, 0xc000212af0, 0x1, {0x25c5de7, 0x20}, 0x2e00e20, 0x0) C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:825 +0x686 k8s.io/klog/v2.(loggingT).printDepth(0x2dfff40, 0x0, 0x0, {0x0, 0x0}, 0x0, {0xc00013a2c0, 0x2, 0x2}) C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:608 +0x1c7 k8s.io/klog/v2.(*loggingT).print(...) C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:590 k8s.io/klog/v2.Fatal(...) C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:1490 main.main() D:/a/lens-k8s-proxy/lens-k8s-proxy/main.go:82 +0x725

goroutine 36 [syscall]: os/signal.signal_recv() C:/hostedtoolcache/windows/go/1.17.13/x64/src/runtime/sigqueue.go:169 +0x98 os/signal.loop() C:/hostedtoolcache/windows/go/1.17.13/x64/src/os/signal/signal_unix.go:24 +0x19 created by os/signal.Notify.func1.1 C:/hostedtoolcache/windows/go/1.17.13/x64/src/os/signal/signal.go:151 +0x2c

proxy exited with code: 255

To Reproduce Steps to reproduce the behavior:

  1. Connect to added cluster.

Expected behavior Be able to connect to configured cluster.

Screenshots image

Environment (please complete the following information):

Logs: When you run the application executable from command line you will see some logging output. Please paste them here:

F0103 14:46:21.817744 53236 main.go:82] failed to initialize proxyexec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
goroutine 1 [running]:
k8s.io/klog/v2.stacks(0x1)
C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:860 +0x8a
k8s.io/klog/v2.(*loggingT).output(0x2dfff40, 0x3, 0x0, 0xc000212af0, 0x1, {0x25c5de7, 0x20}, 0x2e00e20, 0x0)
C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:825 +0x686
k8s.io/klog/v2.(*loggingT).printDepth(0x2dfff40, 0x0, 0x0, {0x0, 0x0}, 0x0, {0xc00013a2c0, 0x2, 0x2})
C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:608 +0x1c7
k8s.io/klog/v2.(*loggingT).print(...)
C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:590
k8s.io/klog/v2.Fatal(...)
C:/Users/runneradmin/go/pkg/mod/k8s.io/klog/v2@v2.60.1/klog.go:1490
main.main()
D:/a/lens-k8s-proxy/lens-k8s-proxy/main.go:82 +0x725

goroutine 36 [syscall]:
os/signal.signal_recv()
C:/hostedtoolcache/windows/go/1.17.13/x64/src/runtime/sigqueue.go:169 +0x98
os/signal.loop()
C:/hostedtoolcache/windows/go/1.17.13/x64/src/os/signal/signal_unix.go:24 +0x19
created by os/signal.Notify.func1.1
C:/hostedtoolcache/windows/go/1.17.13/x64/src/os/signal/signal.go:151 +0x2c

proxy exited with code: 255

Kubeconfig: Quite often the problems are caused by malformed kubeconfig which the application tries to load. Please share your kubeconfig, remember to remove any secret and sensitive information.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
  name: arn:aws:eks:us-east-1:xxxxxxxxx:cluster/seam-eks-development
contexts:
- context:
    cluster: arn:aws:eks:us-east-1:xxxxxxxxx:cluster/seam-eks-development
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:xxxxxxxxx:cluster/seam-eks-development
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-east-1
      - eks
      - get-token
      - --cluster-name
      - seam-eks-development
      command: aws
      env:
      - name: AWS_PROFILE
        value: saml
      provideClusterInfo: false

Additional context Add any other context about the problem here.

bolshoytoster commented 1 year ago

@dcole-gsn I found this stackoverflow question about this error

Short answer:

Just change v1alpha1 to v1beta1:

diff ~/.kube/config-backup ~/.kube/config
691c691
<             apiVersion: client.authentication.k8s.io/v1alpha1
---
>             apiVersion: client.authentication.k8s.io/v1beta1
dcole-gsn commented 1 year ago

@dcole-gsn I found this stackoverflow question about this error

Short answer:

Just change v1alpha1 to v1beta1:

diff ~/.kube/config-backup ~/.kube/config
691c691
<             apiVersion: client.authentication.k8s.io/v1alpha1
---
>             apiVersion: client.authentication.k8s.io/v1beta1

Hi bolshoytoster, Thanks for the link, I had seen that. Tentatively, it seems the issue for me was related to an outdated aws cli version. I updated aws cli from 1.25.55 to 2.9.12 and that seemed to resolve the issue. From my limited understanding aws cli 1.x should be fine, but updating it resolved the issue. Sorry for wasting peoples time. Kind regards.