Custom Thumbnail 

drop img here or browse to upload

add answer
create album
  • feeling
  • traveling
  • watching
  • playing
  • listening
  • Happy
  • Loved
  • Sad
  • Very sad
  • Angry
  • Confused
  • Hot
  • Broken
  • expressionless
  • Cool
  • Funny
  • Tired
  • Lovely
  • Blessed
  • Shocked
  • Sleepy
  • Pretty
  • Bored
0%

How to generate kubernetes dashboard access token

How to generate kubernetes dashboard access token

How to generate kubernetes dashboard access token

 

1. Create the dashboard service account

Run the following command to create a service account

kubectl create serviceaccount kubernetes-dashboard-admin-sa -n kube-system

The command will create a service account in the namespace of kube-system. replace your namespace instate of kube-system

 

2. Bind the service account to the cluster-admin role

kubectl create clusterrolebinding kubernetes-dashboard-admin-sa --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard-admin-sa

 

3. List Secretes

kubectl get secrets -n kube-system

 

if you using kubernetes 1.23 or above please use following to get secret

kubectl -n kube-system create token kubernetes-dashboard-admin-sa --duration=8760h 
# --duration=8760h   1 year
# --duration=87600h  10 years

then you dont have to follow step 4.

 

4. get the token from secret

kubectl describe secret kubernetes-dashboard-admin-sa-token-lj8cc -n kube-system

 

Here your secret name can be different. Now copy the token and use it to login kubernetes dashboard.

 

Lucky , Bidyut and
28 more liked this
    Back
    friends & family