https://rancher.com/ logo
Title
b

better-wolf-9235

04/13/2023, 10:13 AM
Hi Folks, Rancher desktop is using set my Kubectl version to latest 1.26. But currently most of my K8s clusters are running in 1.19 and its giving few warning while running Kubectl command with old cluster.
-> kubectx
I0413 15:29:59.844450   64080 versioner.go:56] Remote kubernetes server unreachable
I0413 15:30:05.131215   64088 versioner.go:56] Remote kubernetes server unreachable
how can I set my kubectl version to 1.21 or similar
ls -la /usr/local/bin/kubectl
lrwxr-xr-x  1 root  admin  55 Nov 11 11:08 /usr/local/bin/kubectl -> /Applications/Docker.app/Contents/Resources/bin/kubectl
s

salmon-zebra-10173

04/13/2023, 10:34 AM
Hi @better-wolf-9235! Thank you for re-posting your message here 🙂 Just to be sure I understand your question correctly. Do you want to downgrade your configured kubectl version in Rancher Desktop?
b

better-wolf-9235

04/13/2023, 10:35 AM
Nope I want to stop warning messages we are getting while access or switching to any of my in house clusters
I am not using K8s with Rancher dasktop, I am only using it to build images and push or pull to Repos
s

salmon-zebra-10173

04/13/2023, 10:53 AM
The warning message you are referring to is
Remote kubernetes server unreachable
, right?
c

clever-mouse-42560

04/13/2023, 11:27 AM
Hi @better-wolf-9235, could check if you have multiple contexts inside
~/.kube/config
file?
kubectl config get-contexts
b

better-wolf-9235

04/13/2023, 11:32 AM
@clever-mouse-42560 Yes I have around 12 K8s clusters in my config file and all are accessible.
I have checked and found that while we have Rancher dasktop running that time only I am getting above warning message. If I remove rancher Desktop then its working fine and not showing this error.
c

clever-mouse-42560

04/13/2023, 1:26 PM
Ok, did you switch to the right context when you use the other clusters?
kubectl config use-context your-context
b

better-wolf-9235

04/13/2023, 1:27 PM
Ye we are using
kubectx
to switch between clusters
c

clever-mouse-42560

04/13/2023, 1:27 PM
ok
b

better-wolf-9235

04/13/2023, 1:29 PM
one more thing in Rancher desktop I haven't enable Kubernetes settings. its uncheck along with enable Traefik
t

tall-toddler-89966

04/13/2023, 2:26 PM
@better-wolf-9235 Did you ever enable Kubernetes in Rancher Desktop? Is there a version listed in the drop down? I haven't experienced this particular problem, but I don't have clusters running on that old a version of k8s.
I suspect that if you choose a version in the drop down closer to the version you are using then rancher-desktop may default to that when running kubectl.
Maybe it is also related to this.
w

witty-honey-18052

04/13/2023, 3:38 PM
you need to select a kubernetes version within the version skew policy https://kubernetes.io/releases/version-skew-policy/ (that shows latest version numbers, but same concept applies)