Kubernetes二进制部署——UI界面的部署(4)-创新互联
前言:
接上一篇负载均衡部署(3)部署UI界面
yaml下载:https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dashboard
部署环境
负载均衡
创新互联公司2013年成立,是专业互联网技术服务公司,拥有项目网站设计制作、成都网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元蔡家坡做网站,已为上家服务,为蔡家坡各地企业和个人服务,联系电话:18980820575
Nginx1:192.168.13.128/24
Nginx2:192.168.13.129/24
Master节点
master1:192.168.13.131/24 kube-apiserver kube-controller-manager kube-scheduler etcd
master2:192.168.13.130/24 kube-apiserver kube-controller-manager kube-scheduler etcd
Node节点
node1:192.168.13.132/24 kubelet kube-proxy docker flannel etcd
node2:192.168.13.133/24 kubelet kube-proxy docker flannel etcd
1,在master01上创建dashboard
[root@master01 ~]# cd k8s/
[root@master01 k8s]# mkdir dashboard ##创建工作目录
[root@master01 k8s]# cd dashboard/
[root@master01 dashboard]# rz -E ##上传dashboard的yaml文件
[root@master01 dashboard]# ls
dashboard-configmap.yaml ##配置应用
dashboard-rbac.yaml ##授权访问api
dashboard-service.yaml ##发布应用
dashboard-controller.yaml ##控制器
dashboard-secret.yaml ##安全加密
k8s-admin.yaml ##生成令牌
[root@master01 dashboard]# kubectl create -f dashboard-rbac.yaml ##创建api授权
[root@master01 dashboard]# kubectl create -f dashboard-secret.yaml ##创建安全加密
[root@master01 dashboard]# kubectl create -f dashboard-configmap.yaml ##创建配置
[root@master01 dashboard]# kubectl create -f dashboard-controller.yaml ##创建应用
[root@master01 dashboard]# kubectl create -f dashboard-service.yaml ##创建发布
[root@master01 dashboard]# kubectl get pods -n kube-system
##查看创建在指定的kube-system命名空间
NAME READY STATUS RESTARTS AGE
kubernetes-dashboard-65f974f565-xwhcb 1/1 Running 0 2m31s
[root@master01 dashboard]# kubectl get pods,svc -n kube-system ##查看如何访问
NAME READY STATUS RESTARTS AGE
pod/kubernetes-dashboard-65f974f565-xwhcb 1/1 Running 0 4m55s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes-dashboard NodePort 10.0.0.119 443:30001/TCP 4m51s
2,用浏览器访问node节点ip(Google浏览器无法访问的问题)
##更多工具——开发者工具——security
3,进行自签证书
[root@master01 dashboard]# vim dashboard-cert.sh ##创建证书脚本文件
cat > dashboard-csr.json <
4,重新用浏览器访问node1节点地址
5,生成令牌,进行使用UI界面
vim k8s-admin.yaml ##证书生成的yaml配置文件
apiVersion: v1
kind: ServiceAccount
metadata:
name: dashboard-admin
namespace: kube-system
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: dashboard-admin
subjects:
- kind: ServiceAccount
name: dashboard-admin
namespace: kube-system
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
[root@master01 dashboard]# kubectl create -f k8s-admin.yaml ##生成令牌
[root@master01 dashboard]# kubectl get secret -n kube-system ##保存令牌
NAME TYPE DATA AGE
dashboard-admin-token-489x2 kubernetes.io/service-account-token 3 2m2s
[root@master01 dashboard]# kubectl describe secret dashboard-admin-token-489x2 -n kube-system
##查看令牌
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tNDg5eDIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiY2Q2NzQ4NGYtNGJjZi0xMWVhLThkZTAtMDAwYzI5ZjNiNTNiIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.lXmRZS2TSk5HHmXzrjvp8ISj4fna_anekJDCZW5NV7vB45s-IZTq7VLG1qd8MfMP0MCOQgKdE-1ulg9b6ql3a6zbUJe848mk99yVOIwKbZTN2M-SG848ljSAjCt66rUkilbcTqByK719rTLbwTtmibgI7jy1NXeZXp_Q_8QE8aXAfJz1EnxI3kbz7Qr1FetZ1O1hTnzc-hEwCgUOMhMZsheBBry9SahXj-3fYNRyK1MpuhkDleNyjQnuNfdsSmgrJI1HvVNczw_tYNQb1QqpppegAdLNvIArMmIDA15q_vL9Wg7h9nb8Ay3KSss7IgHkqN1YxTNdWZyeMpEt9pPQOw
6,利用令牌进行登录
##成功访问到UI界面
k8s部署全部完成,谢谢阅读!!!
网站名称:Kubernetes二进制部署——UI界面的部署(4)-创新互联
文章来源:http://myzitong.com/article/cdcopj.html