这个dashbord仅仅用来了解,知道有这么一个东西,生产环境基本都是自研或者是第三方或者kubectl命令操作,很少用到这个。
默认官方下载的安装包(kubernetes-src.tar.gz,需解压)已经自带dashboard,只需要修改里边的image以及添加集群角色绑定就可以直接使用了,路径:
/usr/local/src/kubernetes/cluster/addons/dashboard
1,修改dashboard-controller.yaml
编辑镜像,将kubernetes-dashboard的镜像修改成阿里云:
registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64:v1.10.0
国外的镜像没法下载,这里到dev.aliyun.com 搜索需要的镜像进行替换。凡事国外镜像无法下载的,思路一般都是改成国内的镜像
2,设置集群角色绑定,否则登陆资源无法列出
vi dashboard-clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: kubernetes-dashboard labels: k8s-app: kubernetes-dashboard roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: kubernetes-dashboard namespace: kube-system
修改和设置完以后,将里边的yaml进行创建即可。 比如控制器,配置,secret以及svc等。
3,测试访问
[root@master01 dashboard]# kubectl get svc -n kube-system | grep dashboard kubernetes-dashboard NodePort 10.254.16.128 443:31552/TCP 8d
通过任意节点https://nodeIp:31552即可访问到dashborad,我们这里选择token登陆,具体token可以这里查看:
[root@master01 dashboard]# kubectl get secret -n kube-system NAME TYPE DATA AGE default-token-m5xv9 kubernetes.io/service-account-token 3 23d heapster-token-w48jm kubernetes.io/service-account-token 3 6d1h kube-dns-token-wnrxq kubernetes.io/service-account-token 3 47h kubernetes-dashboard-certs Opaque 0 8d kubernetes-dashboard-key-holder Opaque 2 8d kubernetes-dashboard-token-smtwt kubernetes.io/service-account-token 3 8d
查看token值:
[root@master01 dashboard]# kubectl describe secret kubernetes-dashboard-token-smtwt -n kube-system Name: kubernetes-dashboard-token-smtwt Namespace: kube-system Labels: Annotations: kubernetes.io/service-account.name: kubernetes-dashboard kubernetes.io/service-account.uid: 5a417204-f2db-11e8-8d01-5254003ef9b0 Type: kubernetes.io/service-account-token Data ==== ca.crt: 1359 bytes namespace: 11 bytes token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlcm5ldGVzLWRhc2hib2FyZC10b2tlbi1zbXR3dCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjVhNDE3MjA0LWYyZGItMTFlOC04ZDAxLTUyNTQwMDNlZjliMCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTprdWJlcm5ldGVzLWRhc2hib2FyZCJ9.R8oPq1Z0bqieOjAdyVXjUP9h2cRwPAI7WCrG3B0dTbCYBBT7UbUVP9b3rc_OLabNYGzLxYFZhMRHIBGesFXjEwRTx2O9GjHSsairXL-78sv_zJZ9YBsBc6ZlKT5ZDoUGMrHtPS8oMqbjOubkcQgpghxPL_DoLEWSbvU3nKxvn6RuyV6QiA34HLjPgYKuLE1CyBn8AOTsYC5hhuIh0K1zV3PYmbHviebgXQSYP6pR9vQ7cxmc1_HALsArEweTvukslAp8dejHSD2VWabXNXg7fOfM5FC7_iuL2IdARTl-BxJBr4uMQJJP-eCteYRLPzkoJQCBBdIoveFC8-FgGaLawg
登陆:
话说这个控制面板比较鸡肋,毕竟集成度比较低,仅了解即可。 命令用习惯了比这个更舒服。
如果要更好的控制面板,最好是自己开发,将kubernetes里边的管理功能加上部署、cicd等。
转载请注明:西数超哥博客www.ysidc.top» kubenetes 安装自带dashbord控制面板
https://www.ysidc.top 西数超哥博客,数据库,西数超哥,虚拟主机,域名注册,域名,云服务器,云主机,云建站,ysidc.top