DashBoard kubernetes图形化界面工具 yyds!!!
Posted 我的紫霞辣辣
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DashBoard kubernetes图形化界面工具 yyds!!!相关的知识,希望对你有一定的参考价值。
DashBoard用户界面
为了提供更丰富的用户体验,kubernetes还开发了一个基于web的用户界面(Dashboard)。用户可以使用Dashboard部署容器化的应用,还可以监控应用的状态,执行故障排查以及管理kubernetes中各种资源。
部署Dashboard
1. 下载yaml,并运行Dashboard
# 下载yaml
[root@k8s-master-01 ~]# wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
...
2021-08-13 23:07:15 (33.9 MB/s) - ‘recommended.yaml’ saved [7552/7552]
# 修改kubernetes-dashboard的Service类型
[root@k8s-master-01 ~]# vim recommended.yaml
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kubernetes-dashboard
spec:
type: NodePort # 新增
ports:
- port: 443
targetPort: 8443
nodePort: 30009 # 新增
selector:
k8s-app: kubernetes-dashboard
# 部署
[root@k8s-master-01 ~]# kubectl create -f recommended.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
# 查看namespace下的kubernetes-dashboard下的资源
[root@k8s-master-01 ~]# kubectl get pod,svc -n kubernetes-dashboard
NAME READY STATUS RESTARTS AGE
pod/dashboard-metrics-scraper-5594697f48-j5lzj 0/1 ContainerCreating 0 33s
pod/kubernetes-dashboard-57c9bfc8c8-x6x29 0/1 ContainerCreating 0 33s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/dashboard-metrics-scraper ClusterIP 10.106.212.138 <none> 8000/TCP 33s
service/kubernetes-dashboard NodePort 10.110.232.191 <none> 443:30096/TCP 33s
2. 创建访问账户,获取token
# 创建账号
[root@k8s-master-01 ~]# kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard
serviceaccount/dashboard-admin created
# 授权
[root@k8s-master-01 ~]# kubectl create clusterrolebinding dashboard-admin-rb --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin
clusterrolebinding.rbac.authorization.k8s.io/dashboard-admin-rb created
# 获取账号token
[root@k8s-master-01 ~]# kubectl get secrets -n kubernetes-dashboard | grep dashboard-admin
dashboard-admin-token-7zh87 kubernetes.io/service-account-token 3 59s
[root@k8s-master-01 ~]# kubectl describe secrets dashboard-admin-token-7zh87 -n kubernetes-dashboard
Name: dashboard-admin-token-7zh87
Namespace: kubernetes-dashboard
Labels: <none>
Annotations: kubernetes.io/service-account.name: dashboard-admin
kubernetes.io/service-account.uid: bf11d801-b762-4db7-b6a0-8de1510c3fa0
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1066 bytes
namespace: 20 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImM2U01Nb2IteFRCSEwySmJ6VFZpa1BDaXg0ZHhBZm1yY1pweHgydmdoMUkifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tN3poODciLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiYmYxMWQ4MDEtYjc2Mi00ZGI3LWI2YTAtOGRlMTUxMGMzZmEwIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmVybmV0ZXMtZGFzaGJvYXJkOmRhc2hib2FyZC1hZG1pbiJ9.GDfExzTPmB6LJhE0F-u37_elMkGKs6QWQCawkUwGCfIll3FU-oOGRTXwDHyaj6WuU9RaBKteSM2qtztmWefTrEo_Qf3jHf-w8R1upiARdEX4RPELmQxXgqfBFfy-gbNMutEh6DeKLd3RImKeZ2YURtoDYcAb3Q6fCBRZH1_X0i66UQehp6juULSfvF9gpro1AzePPnRuqREkVWenD_bTYo55pAIIiDSnJeredidQCSxXlYuLMx3yOMza1QOK1h9Gq8eva0cM9XFTsrUMro04ZY6s-9F6U6tsvCUZnudvl0iVd90tTvauVQa6P80FEhbi-dor5G2YYIb-Kx2rWafBAg
3. 通过浏览器访问Dashboard的图形界面
使用DashBoard
以上是关于DashBoard kubernetes图形化界面工具 yyds!!!的主要内容,如果未能解决你的问题,请参考以下文章
Kubernetes(k8s)之部署让k8s图形化的Dashboard
k8s 安装 kubernetes-dashboard-2.X
k8s 安装 kubernetes-dashboard-2.X