kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
kubectl apply -f recommended.yaml
spec: type: NodePort ports:
- port: 443
targetPort: 8443
nodePort: 30001
selector: k8s-app: kubernetes-dashboard
创建token,在master节点
kubectl create serviceaccount dashboard-admin -n kube-system
kubectl create clusterrolebinding dashboard-admin \
—clusterrole=cluster-admin \
—serviceaccount=kube-system:dashboard-admin
获取token的命令
kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret |awk ‘/dashboard-admin/{print $1}’)