Kubernets
简介
kubeadm-单节点-ubuntu
kubeadm-高可用集群-ubuntu
资源管理
Namespace
Pod
Pod控制器
Pod生命周期
Pod调度
Label
Service
数据存储
安全认证
DashBoard
kubeadm-单节点-centos
kubeadm-高可用集群-centos
本文档使用 MrDoc 发布
-
+
首页
DashBoard
# 简介 除了通过命令行工具kubectl,为了提供更丰富的用户体验,k8s还开发了一个基于web的用户界面(DashBoard)。 用户可以使用DashBoard部署容器化的应用,而且还可以监控应用的状态,执行故障排查以及管理kubernetes中的各种资源。 下载recommended.yaml [官方下载](https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml "官方下载") ```asp wget https://pan.cddone.com/d/package/tar/k8s/recommended.yaml ``` 修改配置添加2条信息 ```asp vim recommended.yaml ``` ```asp spec: type: NodePort # 新增 ports: - port: 443 targetPort: 8443 nodePort: 30000 # 新增 selector: k8s-app: kubernetes-dashboard ``` 运行 ```asp kubectl create -f recommended.yaml ``` 查看 ```asp kubectl get pod,svc -n kubernetes-dashboard ``` ```asp NAME READY STATUS RESTARTS AGE pod/dashboard-metrics-scraper-6b4884c9d5-kl9qr 0/1 ContainerCreating 0 2m6s pod/kubernetes-dashboard-7b544877d5-qv5h8 0/1 ContainerCreating 0 2m6s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/dashboard-metrics-scraper ClusterIP 10.102.219.175 <none> 8000/TCP 2m6s service/kubernetes-dashboard NodePort 10.102.48.204 <none> 443:30009/TCP 2m6s ``` 创建账户 ```asp kubectl create serviceaccount dashboard-admin -n kubernetes-dashboard ``` 授权 ```asp kubectl create clusterrolebinding dashboard-admin-rb --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard-admin ``` 查看密钥 ```asp kubectl get secrets -n kubernetes-dashboard | grep dashboard-admin ``` ```asp dashboard-admin-token-st4fj kubernetes.io/service-account-token 3 14s ``` 获取token ```asp kubectl describe secrets dashboard-admin-token-st4fj -n kubernetes-dashboard ``` ```asp Name: dashboard-admin-token-st4fj Namespace: kubernetes-dashboard Labels: <none> Annotations: kubernetes.io/service-account.name: dashboard-admin kubernetes.io/service-account.uid: f89f0c4a-6fdc-400a-8af4-c9f0df386a99 Type: kubernetes.io/service-account-token Data ==== ca.crt: 1025 bytes namespace: 20 bytes token: eyJhbGciOiJSUzI1NiIsImtpZCI6IjlENWlRVjZkUjZKQ1RZMmlyWmJydTk1b3l3c21ZR21SSHN1WjQtLWRNd2cifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tc3Q0ZmoiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZjg5ZjBjNGEtNmZkYy00MDBhLThhZjQtYzlmMGRmMzg2YTk5Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmVybmV0ZXMtZGFzaGJvYXJkOmRhc2hib2FyZC1hZG1pbiJ9.WIG1b_rx7WSDMPRPU_5kkcoNn8gYoulmpDJ9oveV6epjOZx-X_PPEK2Y98KoRAsYO5F08F-mbOBR_COzS9yUpqrUVEacYA-RaK45BmEQoSb2ifMfXvqhsJbD0PgjAGmWVStY-0O5YqJKJI2nhArsbuQxezrrtxXnAHWqRmzio4OuqIOT8vUNDzNGMHp_a3Wh-fXuQn5hHDbzFkX6UyQTi2WdgMAK4SRkytbguDlkw4yb23uVzayAypEE4K2-_5xzbTmwoBIwdY5IuRvEgnqJSr14dYuDKSnCeWhaaaVyGzf9uZsCL5i7t9zbj2qqLvVG2Pgh3ybvl_vaf_8t2KdzTw ``` 使用浏览器登陆:https://192.168.1.100:30000 ![](/media/202407/2024-07-02_181046_0165110.7048559071218611.png) ![](/media/202407/2024-07-02_181148_2671800.19008791382976997.png)
done
2024年11月27日 12:14
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码