关于k8s安装dashboard的一点记录
1、kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.1.0/aio/deploy/recommended.yaml
2、查看得到如图的pod和service即可
3、暴露端口:
kubectl patch svc kubernetes-dashboard -n kubernetes-dashboard -p '{"spec":{"type":"NodePort","ports":[{"port":443,"targetPort":8443,"nodePort":30001}]}}'
暴露30001端口后即可访问,记得是https请求。
4、获取token:
a、kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard 创建账户
b、kubectl create clusterrolebinding dashboard-admin-rb --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin
c、kubectl get secrets -n kubernetes-dashboard | grep dashboard-admin 得出如下
d、kubectl describe secret dashboard-admin-token-pmkh7(上一步得出tocken名) -n kubernetes-dashboard
tocken即为登录所用tocken。
***关于k8s环境搭建可以读 wenjiajun 的此文章实属不错**
https://www.cnblogs.com/processing/p/14865209.html