k8s(二)—dashboard安装

1. 下载dashboard yaml文件

wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc7/aio/deploy/recommended.yaml

2. 配置nodePort

官方部署dashboard的服务没使用nodeport,将yaml文件下载到本地,在service里添加nodeport

# kubectl create -f recommended.yaml

即可通过https://ip:30000访问

3. 配置账号密码登录

添加配置文件:

# echo "admin,admin,1" > /etc/kubernetes/pki/basic_auth_file

修改apiserver配置文件:

# vim /etc/kubernetes/manifests/kube-apiserver.yaml

重新部署apiserver

# kubectl apply -f /etc/kubernetes/manifests/kube-apiserver.yaml

创建集群角色权限绑定

# kubectl create clusterrolebinding login-on-dashboard-with-cluster-admin --clusterrole=cluster-admin --user=admin

查看集群角色权限绑定

# kubectl get clusterrolebinding login-on-dashboard-with-cluster-admin

recommended.yaml 就是dashboard相关部署文件

posted @ 2020-01-20 15:30  fisherbook  阅读(405)  评论(0编辑  收藏  举报