How to create a k8s service account with a shorter token length?

420 views Asked by At

I’m using Kubernetes Dashboard and can log into it with a Service Account Token, which is created according to the docs.

kubernetes dashboard login screen

All works technically well and I can view my cluster resources as expected. As a user of Bitwarden for password management, I expect that I can store my token in the vault as a normal password and autofill it the next time I return to the Dashboard. However, because of the hard cap on password length in Bitwarden, an attempt to store my token there fails:

failing to save k8s token into Bitwarden vault

Although the problem generally lies on the Bitwarden side, I’m wondering if it can be solved within Kubernetes. It would be great if it was possible to generate a Service Account with a shorter token if that’s theoretically allowed.

I tried editing my Service Account Secret by naively cutting the token in half, but the trick did not work – I started getting 401 response in the Dashboard Login form. Not a big surprise.

editing service account token

So my question is: how can one create a Service Account Token that would be, say, 500 characters long instead of about a thousand? Being able to do that can improve the user experience for me and other users of Bitwarden and should probably not affect cluster security too badly.

0

There are 0 answers