Skip to content

Document a way how to use TokenRequest for existing ServiceAccount #5133

@pjastrzabek-roche

Description

@pjastrzabek-roche

Is your task related to a problem? Please describe

I am trying to create new expiring token for existing ServiceAccount, basically equivalent of

kubect create serviceaccount my-service-account -n xxx
kubectl create token my-service-account -n xxx --duration=1h

I see there is TokenRequestBuilder and TokenRequest but the latter do not extend HasMetadata thus I cannot use generic API for creation.

Is there any way to call this api?

Describe the solution you'd like

Having an API for easy token creation.
See something similar in go sdk
https://github.com/kubernetes/client-go/blob/686b396dc0681d7f140bd2ee6b3c3bdea56cab4d/kubernetes/typed/core/v1/serviceaccount.go#L214

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions