kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended.yaml
kubectl -n kube-system create serviceaccount TOKEN-NAME
kubectl create clusterrolebinding TOKEN-NAME --clusterrole=cluster-admin --serviceaccount=kube-system:TOKEN-NAME
Replace TOKEN-NAME
with your custom token name;
kubectl -n kube-system get secret $(kubectl -n kube-system get serviceaccount/TOKEN-NAME -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}'| base64 --decode
Replace TOKEN-NAME
with your custom token name;