README.md: Use `kubectl create token` for Generating Bearer Token
What happened:
The current documentation for obtaining a Bearer Token to log in to the Karmada Dashboard recommends using the following command:
kubectl -n karmada-system get secret $(kubectl -n karmada-system get sa/karmada-dashboard -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}"
However, this method may lead to errors if the ServiceAccount does not have an associated secret, as seen in the error message below:
Error executing template: template: output:1:16: executing "output" at <base64decode>: invalid value; expected string. Printing more information for debugging the template:
template was:
{{.data.token | base64decode}}
raw data was:
{"apiVersion":"v1","items":[],"kind":"List","metadata":{"resourceVersion":""}}
object given to template engine was:
map[apiVersion:v1 items:[] kind:List metadata:map[resourceVersion:]]
What you expected to happen:
The bearer token should be created successfully. I suggest using the kubectl create token command to directly generate a valid Bearer Token:
kubectl create token karmada-dashboard -n karmada-system
How to reproduce it (as minimally and precisely as possible):
- Follow the current documentation to get a Bearer Token.
- Encounter an error that the ServiceAccount does not have an associated secret.
- Use
kubectl create tokento successfully generate a Bearer Token.
Environment:
- Karmada Dashboard version:
mainbranch
I am willing to submit a PR to update the documentation accordingly. Please let me know if this is a valid issue.
Thanks, you are right. It's a valid issuse, the root cause is the [KEP-1205]. It's very glad to see that you're willing to help us improve the document. More info you can refer #38
/close The problem has been solved in the PR https://github.com/karmada-io/dashboard/pull/93
@warjiang: Closing this issue.
In response to this:
/close The problem has been solved in the PR https://github.com/karmada-io/dashboard/pull/93
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-sigs/prow repository.