Nikit Swaraj
Nikit Swaraj

Reputation: 647

Specific name to auto generated secret token of namespace in Kubernetes

I came up with the use case where I need to give specific name of secret token when it gets generated during creation of namespace.

So when we create a namespace in K8S we will get one secret token like below.

NAMESPACE               NAME                                    TYPE                                  DATA      AGE
dev                     secrets/default-token-vvlzv             kubernetes.io/service-account-token   3         1d
devops                  secrets/default-token-0xpt0             kubernetes.io/service-account-token   3         9d

So What we want is "default-token-vvlzv" should be generated as user given name like "dev-token".

Is there any way to achieve this ?

Upvotes: 2

Views: 411

Answers (2)

Frank Reno
Frank Reno

Reputation: 243

echoing chrishuen's answer above, I do not believe there is a way to do this currently. However, you might be able to write your own Custom Resource Definition and Controller to help automate this.

Upvotes: 0

chrishuen
chrishuen

Reputation: 151

To the best of my knowledge, there is no such option. However, if you're creating your namespaces via software and not manually through kubectl, you can always clone the secret token to a copy with a name of your liking upon namespace creation. Do you automatically create namespaces or is that for a manual use-case?

Cheers, Christian

Upvotes: 1

Related Questions