LinuxK8S集群搭建三(部署dashboard)
系统环境:
CentOS 7 64位
准备工作:
通过虚拟机创建三台CentOS服务器,可参照之前的文章
192.168.28.128 –master
192.168.28.130 –node01
192.168.28.131 –node02
安装步骤:
1.执行语句部署
—在开启vpn的情况下执行以下语句即可(要修改)
$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
修改如下:
kind: Service下的spec位置
a.增加“type: NodePort”,与ports目录同级
b.ports目录下增加“nodePort: 30001”,与targetPort目录同级
—如果没有vpn则执行以下语句(已经修改好了)
$ kubectl apply -f http://res.chinaskinhospital.com/Upload/Academic/20191219/2019121918412312049088.yaml
2.使用浏览器(Firefox)访问任意节点都能打开,格式为:https://节点中任意IP地址:300001
https://192.168.28.128:30001
https://192.168.28.130:30001
https://192.168.28.131:30001
3.获取令牌
$ kubectl create serviceaccount dashboard-admin -n kube-system
$ kubectl create clusterrolebinding dashboard-admin –clusterrole=cluster-admin –serviceaccount=kube-system:dashboard-admin
$ kubectl describe secrets -n kube-system $(kubectl -n kube-system get secret | awk \’/dashboard-admin/{print $1}\’)
4.使用令牌的方式登录
5.登录成功