1. 安装kubernetes-dashboard

wget -q https://mirrors.yangxingzhen.com/kubernetes/recommended.yaml

 

kubectl create -f recommended.yaml

 

  1. 查看凭证

kubectl -n kubernetes-dashboard get secret

 

echo "Token$(kubectl describe secrets -n kubernetes-dashboard ${Token} |grep token |awk 'NR==3 {print $2}')"

 

kubectl get node

 

kubectl get pod --all-namespaces

 

kubectl get svc -n kubernetes-dashboard

 

 

  1. 授权kubernetes-dashboard,防止找不到namespace资源

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

 

注意: 这里安装好dashbord之后, 可以通过Lens获取账号的token来赋权登录.