https://rancher.com/ logo
Title
b

brave-policeman-40622

06/01/2022, 4:35 PM
Hi Team, I have installed Rancher Desktop ( Version: 1.3.0) on my mac for the first time. Getting the following error with kubectl config. Appreciate any help
~ nerdctl -v
nerdctl version 0.19.0
➜  ~ kubectl config current-context
I0601 09:02:51.539733   35360 versioner.go:58] invalid configuration: no configuration has been provided
error: current-context is not set
q

quick-keyboard-83126

06/01/2022, 4:42 PM
You could try:
kubectl config get-contexts
or, alternatively, click the Rancher icon in the menu bar and select a kubernetes context (e.g.
rancher-desktop
)
b

brave-policeman-40622

06/01/2022, 4:43 PM
Thank you. It worked
f

fast-garage-66093

06/01/2022, 5:08 PM
The only way I've been able to reproduce this issue is when the
~/.kube/config
file already exists, and the
current-context
property is set to the empty string:
current-context: ""
If the file doesn't exist, or if
current-context
is just
null
, it will automatically be set to
rancher-desktop
.
q

quick-keyboard-83126

06/01/2022, 5:10 PM
I can get it w/ the file present but no line
current-context:
(i commented mine out)
f

fast-garage-66093

06/01/2022, 5:11 PM
Really? I have to try that. I set
current-context: ~
, and the value was set afterwards
If I delete the line, it will be set too. Now going to test with commenting it out, but that would be really surprising if that is handled differently from deleting the line.
q

quick-keyboard-83126

06/01/2022, 5:14 PM
Client Version: <http://version.Info|version.Info>{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"darwin/amd64"}
f

fast-garage-66093

06/01/2022, 5:15 PM
Yeah, commented out line disappears and regular line is added in.
q

quick-keyboard-83126

06/01/2022, 5:15 PM
For me, i get the same complaint if i don't have the line at all
f

fast-garage-66093

06/01/2022, 5:16 PM
Did you wait long enough? The file is only updated once k3s is running
q

quick-keyboard-83126

06/01/2022, 5:16 PM
oh, i don't have k3s enabled 🙂
f

fast-garage-66093

06/01/2022, 5:16 PM
In that case there is no kube context we could set it to 🙂
q

quick-keyboard-83126

06/01/2022, 5:16 PM
And the reporter didn't mention k3s 🙂
f

fast-garage-66093

06/01/2022, 5:18 PM
Well,
kubectl
can only work (meaningfully) if you run
k3s
, otherwise you are limited to
info
and
context
subcommands, which are pretty useless on their own
Still curious how you can end up with the empty string in there, but it doesn't really matter; I'll just file an issue to treat it the same as being unset.
q

quick-keyboard-83126

06/01/2022, 5:55 PM
We use kubectl with various gke clusters...