-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
rancher/cli
#348Labels
QA/XSarea/authenticationkind/bugIssues that are defects reported by users or that we know have reached a real releaseIssues that are defects reported by users or that we know have reached a real releasepriority/0team/colliethe team that is responsible for auth and rbac within rancherthe team that is responsible for auth and rbac within rancher
Milestone
Description
Rancher Server Setup
- Rancher version: latest (ed24843)
- Installation option: local k3d/k3s
Describe the bug
Install Rancher and in the settings set the kubeconfig-generate-token
to false
.
Running a rancher kubectl
you will be asked to login:
-> % rancher kubectl get pods -A
FATA[0000] no configuration found, run `login`
Login with a just generated token:
-> % rancher login https://rancher-local.enrichman.it --name rancher-local.enrichman.it --token token-xbXXX:dg4stnjbt5vg2XXXXXXXXXXXXXXXXXXXXX
INFO[0000] Saving config to /home/enrico/.rancher/cli2.json
Download a kubeconfig and export the KUBECONFIG
env var. Try to rancher kubectl
:
-> % rancher kubectl get pods -A
INFO[0000] Saving config to /home/enrico/.rancher/cli2.json
https://rancher-local.enrichman.it/v3-public/authProviders
Enter credentials for localProvider
Enter username: admin
Enter password:
panic: assignment to entry in nil map
goroutine 1 [running]:
github.com/rancher/cli/cmd.cacheCredential(0xc00047e9a0, 0xc00001f020, {0xc000025530, 0x6})
/go/src/github.com/rancher/cli/cmd/kubectl_token.go:297 +0x11a
github.com/rancher/cli/cmd.runCredential(0xc00047e9a0)
/go/src/github.com/rancher/cli/cmd/kubectl_token.go:179 +0x4f8
github.com/urfave/cli.HandleAction({0x1766420?, 0x1b1bd40?}, 0xc000314fc0?)
/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:524 +0x50
github.com/urfave/cli.(*App).RunAsSubcommand(0xc000314fc0, 0xc00047e840)
/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:410 +0xabd
github.com/urfave/cli.Command.startApp({{0x1a1d7e7, 0x5}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1a5dbe4, 0x2e}, {0x0, ...}, ...}, ...)
/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:372 +0xb7f
github.com/urfave/cli.Command.Run({{0x1a1d7e7, 0x5}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1a5dbe4, 0x2e}, {0x0, ...}, ...}, ...)
/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:102 +0x845
github.com/urfave/cli.(*App).Run(0xc000314000, {0xc0002dca40, 0x4, 0x4})
/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:277 +0xb67
main.mainErr()
/go/src/github.com/rancher/cli/main.go:136 +0x1fdd
main.main()
/go/src/github.com/rancher/cli/main.go:57 +0x19
Unable to connect to the server: getting credentials: exec: executable rancher failed with exit code 2
exit status 1
This seems to be due to the "kubeCredentials": null
in the config. Changing it to an empty object will prevent this:
// changed to '"kubeCredentials":{}'
-> % rancher kubectl get pods -A
FATA[0000] failed to parse kubeconfig token
Expected Result
CLI should not panic. Eventually fail with an error.
Metadata
Metadata
Assignees
Labels
QA/XSarea/authenticationkind/bugIssues that are defects reported by users or that we know have reached a real releaseIssues that are defects reported by users or that we know have reached a real releasepriority/0team/colliethe team that is responsible for auth and rbac within rancherthe team that is responsible for auth and rbac within rancher