dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

README.md: Use `kubectl create token` for Generating Bearer Token

Open mohamedawnallah opened this issue 1 year ago • 1 comments

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):

  1. Follow the current documentation to get a Bearer Token.
  2. Encounter an error that the ServiceAccount does not have an associated secret.
  3. Use kubectl create token to successfully generate a Bearer Token.

Environment:

  • Karmada Dashboard version: main branch

I am willing to submit a PR to update the documentation accordingly. Please let me know if this is a valid issue.

mohamedawnallah avatar Jul 23 '24 17:07 mohamedawnallah

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

warjiang avatar Jul 25 '24 04:07 warjiang

/close The problem has been solved in the PR https://github.com/karmada-io/dashboard/pull/93

warjiang avatar Aug 27 '24 07:08 warjiang

@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.

karmada-bot avatar Aug 27 '24 07:08 karmada-bot