部署DashBoard
- 下载yaml,需要外网,无外网访问yaml文件夹下recommended.yaml
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
- 修改kubenets-dashboard的Service类型
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort # 新增
ports:
- port: 443
targetPort: 8443
nodePort: 30009 # 新增
selector:
k8s-app: kubernetes-dashboard
- 部署DashBoard
kubectl create -f recommended.yaml
- 查看namespace为kubernetes-dashboard下的资源
kubectl get pod,svc -n kubernetes-dashboard
- 创建账户
kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard
- 授权
kubectl create clusterrolebinding dashboard-admin-rb --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin
- 获取账号token
kubectl get secrets -n kubernetes-dashboard | grep dashboard-admin
kubectl describe secrets dashboard-admin-token-b992l -n kubernetes-dashboard
- 通过浏览器访问DashBoard的UI,在登录页面上输入上面的token,访问地址为:
https://192.168.75.133:30009/#/login