Use static token while login into kubernetes dashboard

633 Views Asked by At

I have setup k3s. Also I have setup kubernetes-dashboard on k3s.

But I want to use static token while login into the kubernetes dashboard. I does not want to use different token each time when I setup k3s and kubernetes-dashboard.

I found this link for using user/pass in kubernetes. Similarly I want to use static token for kubernetes dashboard in k3s setup.

Is there any way to do this?

1

There are 1 best solutions below

1
Rupesh Shinde On BEST ANSWER

Based on my findings we need to create file(token.csv) which contains password/token:

 admin123 admin admin system:masters

After that while installing k3s we can pass this file:

curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.8+k3s1 sh -s - --kube-apiserver-arg='token-auth-file=/home/ubuntu/token.csv'

After that we can use the token "admin123" to login into kubernetes dashboard.