C语言学习网

Kubernetes二进制部署之UI界面部署

发表于:2022-11-27 作者:安全数据网编辑
编辑最后更新 2022年11月27日,接上一篇博客《Kubernetes二进制部署之多节点部署 》官方文件下载地址:https://github.com/kubernetes/kubernetes/tree/master/cluster/

接上一篇博客《Kubernetes二进制部署之多节点部署 》

官方文件下载地址:
https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dashboard

UI界面部署

在master01上操作

#创建dashborad工作目录[root@localhost k8s]# mkdir dashboard[root@localhost dashboard]# lsdashboard-configmap.yaml   dashboard-rbac.yaml    dashboard-service.yamldashboard-controller.yaml  dashboard-secret.yaml  k8s-admin.yaml#组件创建[root@localhost dashboard]# kubectl create -f dashboard-rbac.yaml role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal createdrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created[root@localhost dashboard]# kubectl create -f dashboard-secret.yaml secret/kubernetes-dashboard-certs createdsecret/kubernetes-dashboard-key-holder created[root@localhost dashboard]# kubectl create -f dashboard-configmap.yaml configmap/kubernetes-dashboard-settings created[root@localhost dashboard]# kubectl create -f dashboard-controller.yaml serviceaccount/kubernetes-dashboard createddeployment.apps/kubernetes-dashboard created[root@localhost dashboard]# kubectl create -f dashboard-service.yaml service/kubernetes-dashboard created

完成后查看创建在指定的kube-system命名空间下

[root@localhost dashboard]# kubectl get pods -n kube-systemNAME                                    READY   STATUS              RESTARTS   AGEkubernetes-dashboard-65f974f565-jzcs9   0/1     ContainerCreating   0          12s

查看如何访问

[root@localhost dashboard]# kubectl get pods,svc -n kube-systemNAME                                        READY   STATUS    RESTARTS   AGEpod/kubernetes-dashboard-65f974f565-jzcs9   1/1     Running   0          34sNAME                           TYPE       CLUSTER-IP   EXTERNAL-IP   PORT(S)         AGEservice/kubernetes-dashboard   NodePort   10.0.0.154           443:30001/TCP   24s

访问nodeIP就可以访问
https://192.168.18.145:30001/


排错:Google浏览器无法访问的问题

[root@localhost dashboard]# vim dashboard-cert.shcat > dashboard-csr.json <

重新部署

[root@localhost dashboard]# kubectl apply -f dashboard-controller.yaml Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl applyserviceaccount/kubernetes-dashboard configuredWarning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl applydeployment.apps/kubernetes-dashboard configured

生成令牌

[root@localhost dashboard]# kubectl create -f k8s-admin.yaml serviceaccount/dashboard-admin createdclusterrolebinding.rbac.authorization.k8s.io/dashboard-admin created//保存[root@localhost dashboard]# kubectl get secret -n kube-systemNAME                               TYPE                                  DATA   AGEdashboard-admin-token-qctfr        kubernetes.io/service-account-token   3      65sdefault-token-mmvcg                kubernetes.io/service-account-token   3      7d15hkubernetes-dashboard-certs         Opaque                                11     10mkubernetes-dashboard-key-holder    Opaque                                2      63mkubernetes-dashboard-token-nsc84   kubernetes.io/service-account-token   3      62m

查看令牌

[root@localhost dashboard]# kubectl describe secret dashboard-admin-token-qctfr -n kube-systemName:         dashboard-admin-token-qctfrNamespace:    kube-systemLabels:       Annotations:  kubernetes.io/service-account.name: dashboard-admin              kubernetes.io/service-account.uid: 73f19313-47ea-11ea-895a-000c297a15fbType:  kubernetes.io/service-account-tokenData====ca.crt:     1359 bytesnamespace:  11 bytestoken:      eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tcWN0ZnIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiNzNmMTkzMTMtNDdlYS0xMWVhLTg5NWEtMDAwYzI5N2ExNWZiIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.v4YBoyES2etex6yeMPGfl7OT4U9Ogp-84p6cmx3HohiIS7sSTaCqjb3VIvyrVtjSdlT66ZMRzO3MUgj1HsPxgEzOo9q6xXOCBb429m9Qy-VK2JxuwGVD2dIhcMQkm6nf1Da5ZpcYFs8SNT-djAjZNB_tmMY_Pjao4DBnD2t_JXZUkCUNW_O2D0mUFQP2beE_NE2ZSEtEvmesB8vU2cayTm_94xfvtNjfmGrPwtkdH0iy8sH-T0apepJ7wnZNTGuKOsOJf76tU31qF4E5XRXIt-F2Jmv9pEOFuahSBSaEGwwzXlXOVMSaRF9cBFxn-0iXRh0Aq0K21HdPHW1b4-ZQwA

此时我们就可以使用令牌登录了

使用令牌登录后的界面

0