[Kubernetes] Add dashboard

Signed-off-by: Kang HuaiShuai <khs1994@khs1994.com>
This commit is contained in:
Kang HuaiShuai 2020-01-09 16:57:38 +08:00
parent 386b1e4cf6
commit e77c9ecbab
No known key found for this signature in database
GPG Key ID: 0A380828B1C243A7
5 changed files with 54 additions and 2 deletions

View File

@ -112,6 +112,7 @@ module.exports = {
"setup/kubeadm",
"setup/docker-desktop",
"setup/systemd",
"setup/dashboard",
]
},
{

View File

@ -124,6 +124,7 @@
* [使用 kubeadm 部署 kubernetes](kubernetes/setup/kubeadm.md)
* [ Docker Desktop 使用](kubernetes/setup/docker-desktop.md)
* [一步步部署 kubernetes 集群](kubernetes/setup/systemd.md)
* [部署 Dashboard](kubernetes/setup/dashboard.md)
* [Kubernetes 命令行 kubectl](kubernetes/kubectl/README.md)
* [容器与云计算](cloud/README.md)
* [简介](cloud/intro.md)
@ -160,8 +161,8 @@
* [MongoDB](appendix/repo/mongodb.md)
* [Redis](appendix/repo/redis.md)
* [附录三Docker 命令查询](appendix/command/README.md)
* [客户端命令 (docker)](appendix/command/docker.md)
* [服务端命令 (dockerd)](appendix/command/dockerd.md)
* [客户端命令 -- docker](appendix/command/docker.md)
* [服务端命令 -- dockerd](appendix/command/dockerd.md)
* [附录四Dockerfile 最佳实践](appendix/best_practices.md)
* [附录五如何调试 Docker](appendix/debug.md)
* [附录六资源链接](appendix/resources.md)

View File

@ -0,0 +1,45 @@
# Kubernetes Dashboard
[Kubernetes Dashboard](https://github.com/kubernetes/dashboard) 是基于网页的 Kubernetes 用户界面。
![](https://d33wubrfki0l68.cloudfront.net/349824f68836152722dab89465835e604719caea/6e0b7/images/docs/ui-dashboard.png)
## 部署
执行以下命令即可部署 Dashboard
```bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
```
## 访问
通过命令行代理访问执行以下命令
```bash
$ kubectl proxy
```
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ 即可访问。
## 登录
目前Dashboard 仅支持使用 Bearer 令牌登录下面教大家如何创建该令牌
```bash
$ kubectl create sa dashboard-admin -n kube-system
$ kubectl create clusterrolebinding dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
$ ADMIN_SECRET=$(kubectl get secrets -n kube-system | grep dashboard-admin | awk '{print $1}')
$ DASHBOARD_LOGIN_TOKEN=$(kubectl describe secret -n kube-system ${ADMIN_SECRET} | grep -E '^token' | awk '{print $2}')
echo ${DASHBOARD_LOGIN_TOKEN}
```
将结果粘贴到登录页面即可登录
## 参考文档
* [官方文档](https://kubernetes.io/zh/docs/tasks/access-application-cluster/web-ui-dashboard/)

View File

@ -181,3 +181,7 @@ $ kubectl taint nodes --all node-role.kubernetes.io/master-
# 恢复默认值
# $ kubectl taint nodes NODE_NAME node-role.kubernetes.io/master=true:NoSchedule
```
## 参考文档
* [官方文档](https://kubernetes.io/zh/docs/setup/independent/create-cluster-kubeadm/)

View File

@ -3,5 +3,6 @@ DOCKER_COMPOSE_VERSION=1.24.1
DOCKER_MACHINE_VERSION=0.16.1
ETCD_VERSION=3.4.0
KUBERNETES_VERSION=1.14.3
KUBERNETES_DASHBOARD=2.0.0-beta8
UBUNTU=18.04
DEBIAN=9