I created a token for my service account using the command 'kubectl create token admin-user'. But after a while it becomes unusable and I have to create it again. How can I generate a token for my service account without expire time?
Try the token for one year using the below command. You can define duration as appropriate, say --duration=87600h for 10 years and so on
kubectl create token admin-user --duration=8760h
As of v1.24, when using kubectl create token --duration it will not allow the creation of long lived tokens
This can be now be accomplished via the manual approach as explained in the official documentation.
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#manually-create-a-long-lived-api-token-for-a-serviceaccount
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With