Skip to content

Commit

Permalink
自定义namespace layout
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohq committed Mar 1, 2020
1 parent c30e027 commit 68bebbc
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 101 deletions.
12 changes: 10 additions & 2 deletions .vuepress/config-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ module.exports = {
]
},
{
title: '管理 Kubernetes',
title: '安装 Kubernetes 管理工具',
collapsable: false,
children: [
'install-dashboard',
'install-dashboard-offline',
'install-dashboard-upgrade',
{
title: '配置Kuboard',
collapsable: true,
children: [
'install-dashboard-upgrade',
'install-kuboard-layout',
'install-kuboard-env',
]
},
{
title: 'kubectl',
collapsable: true,
Expand Down
5 changes: 3 additions & 2 deletions install/install-kuboard-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ vssueId: 126
description: Kubernetes_Dashboard_是Kubernetes的官方WebUI_本文描述了在K8S集群上安装Kuberentes_Dashboard后_如何修改Kuboard登录页末尾的ICP备案编号_以及其他的一些Kuboard的环境变量
meta:
- name: keywords
content: Kubernetes Dashboard,安装Kubernetes Dashboard,K8S Dashboard,K8S管理界面
content: Kubernetes Dashboard,配置Kuboard环境变量,K8S Dashboard,K8S管理界面
---

# 安装Kubernetes Dashboard
# 配置Kuboard环境变量

<AdSenseTitle/>

Expand Down Expand Up @@ -86,6 +86,7 @@ Kuboard 用于管理的 Kubernetes 集群上部署的各类资源,如果您想

* 建议您限制可以访问 Kuboard 的 IP 地址白名单;
* 不要泄露 ServiceAccount 的 Token,如需要修改 ServiceAccount 的 Token,请参考 [为名称空间创建管理员用户](/learning/k8s-advanced/sec/kuboard.html) 中,关于在 ServiceAccount 界面上删除 Secret 的部分;
* 建议使用 [GitLab/GitHub 单点登录](/learning/k8s-advanced/sec/authenticate/install.html)
* 请为 Kuboard 配置 https 证书,配置方式有:
* 在 `http://节点IP:32567/namespace/kube-system/workload/edit/Deployment/kuboard` 界面上互联网入口(Ingress)这一部分开启 https 即可配置;
* 如果您在 Kuboard 前面另外配置了反向代理,请在您自己的反向代理中配置 https 证书;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions install/install-kuboard-layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
vssueId: 126
description: Kuboard 以微服务分层结构的形式展示名称空间中的所有工作负载
meta:
- name: keywords
content: Kuboard 自定义名称空间布局
---

# 自定义Kuboard名称空间布局

<AdSenseTitle/>

## 名称空间布局

Kuboard 名称空间界面中,以微服务分层架构的形式对工作负载进行分类展示,默认布局模式如下图所示:

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301165307517.png)

## 自定义布局

自 Kuboard v1.0.7-beta.5 开始,允许用户自定义名称空间的布局。本章节描述了如何配置自定义布局的参数。

* 在 Kuboard 界面中,导航到 `kube-system` 名称空间;

* 创建 ConfigMap

> 点击名称空间左侧 **配置** 标题后面的 ***创建*** 按钮,可以创建 ConfigMap。
在名称空间 `kube-system` 中创建一个名为 `kuboard-namespace-layout` 的 ConfigMap,并在其中添加一个 Key 为 `kuboard-namespace-layout.yaml` ,Value 为如下 yaml 内容的配置数据条目,如图所示:

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301175541579.png)

yaml 文件内容为:

```yaml
version: "0.1"

layers:
frontend:
name: 前端
color: "blue"
backend:
name: 后端
color: "rgba(0,120,246)"
db:
name: 数据库
color: "#3EAF7C"
midware:
name: 中间件
color: "#003366"
direction: vertical-right
width: 180
```
yaml 文件中,各字段的描述如下:
::: tip Layer ID
layers 下每一个字段代表一个分层的 id。例如,此配置文件中定义了 4 个分层:`frontend`、`backend`、`db`、`midware`。对于每个分层,可以配置的参数见下表:

:::

| 字段名 | 字段类型 | 必填 | 字段描述 |
| --------- | -------- | ---- | ------------------------------------------------------------ |
| name | String | 是 | 分层的名称,显示在界面上 |
| color | String | 是 | 分层中工作负载对象的主题色,可以使用 rgba 编码、颜色名称颜色编码等 html 支持的形式; |
| direction | String | 否 | 如果不填写,则该分层按 yaml 中出现的顺序自上而下显示在中间。如果填写,必须从下面两个取值当中选择:<ul><li>`vertical-right`:垂直显示在右侧</li><li>`vertical-left`: 垂直显示在左侧</li></ul> |
| width | Number | 条件 | 如果填写了 `direction` 字段,则此字段为必填;<br />该字段标识了垂直显示时,该区块的宽度,单位为像素 `px`。 |



* 挂载 ConfigMap 到 Kuboard 容器

* 在 `kube-system` 名称空间中,导航到 `kuboard` 工作负载页面;

* 在 `kuboard` 工作负载页面,点击 ***编辑*** 按钮,进入工作负载编辑页面;

* 在工作负载编辑页面,增加数据卷

为 `kuboard` 增加一个数据卷,字段描述及截图如下:

| 字段名称 | 字段取值 | 字段描述 |
| ------------- | ------------------------------- | ------------------------------------------------------------ |
| 数据卷名称 | kuboard-namespace-layout-volume | 数据卷名称,在该工作负载内可用 |
| 数据卷类型 | configMap | 选择 configMap 类型的数据卷 |
| ConfigMap名称 | kuboard-namespace-layout | 选择前一个步骤中创建的 kuboard-namespace-layout 这个 ConfigMap |

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301180313243.png)

* 在工作负载编辑页面,挂载配置文件到 `kuboard` 容器

仍然在工作负载编辑页面,将 ConfigMap 中的配置内容挂载到 `kuboard` 容器,字段描述及截图如下:

| 字段名称 | 字段取值 | 字段描述 |
| ---------------------- | --------------------------------------------------- | --------------------------------------------- |
| 镜像 | eipwork/kuboard:v1.0.7-beta.5 | Kuboard 版本不能低于 v1.0.7-beta.5 |
| 挂载点:容器内路径 | /usr/share/nginx/html/kuboard-namespace-layout.yaml | 替换容器中该路径中的配置文件 |
| 挂载点:数据卷名称 | kuboard-namespace-layout-volume | 选择前一个步骤中添加的数据卷 |
| 挂载点:数据卷内子路径 | kuboard-namespace-layout.yaml | 此字段取值为 configMap 中,对应配置条目的名称 |

> 上述配置可以将 configMap 中 `kuboard-namspace-layout.yaml` 的内容映射为容器内路径为 `/usr/share/nginx/html/kuboard-namespace-layout.yaml` 的一个文件

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301185053459.png)

* 保存对 `kuboard` 工作负载的修改

* 刷新 Kuboard 界面

刷新 Kuboard 界面后,可以看到,名称空间的布局被调整为如下形式:

* 省略了左侧的 `监控层`;
* 中间三层被调整为 `前端`、`后端`、`数据库`;
* 右侧名称仍然为 `中间件` ,但是标识已经从 `cloud` 调整为 `midware`,所以原本在此处的 `服务注册` 工作负载现在显示在 `默认` 分层中。

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301192027811.png)

## 调整工作负载所在分层

如果您在使用 Kuboard 之前,就已经创建了许多的工作负载,然后您安装了 Kuboard,此时,所有的工作负载都是显示在 `默认` 这个分层的。

Kuboard 通过工作负载(Deployment / StatefulSet / DaemonSet 等)的 `k8s.eip.work/layer` 这个标签来识别工作负载应该显示在哪个分层。

如果您想要将工作负载调整到对应的分层,可以按照如下步骤操作:

* 进入工作负载查看页面,如下图所示:

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301193155997.png)

* 点击上图中 ***调整所在分层*** 按钮,将打开编辑标签的界面:

编辑 `k8s.eip.work/layer` ,并选择您想要的分层后,点击 ***确定*** 按钮。

![Kuboard名称空间布局](./install-kuboard-layout.assets/image-20200301193427725.png)

* 该工作负载将显示到您所期望的分层当中。

17 changes: 0 additions & 17 deletions support/change-log/change-log-on-the-way.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
Kuboard v1.0.x 的更新说明


## v1.0.7-beta.5

**优化**

* KuboardProxy 权限判断,登录用户必须具备 `services/proxy` 或者 `pods/proxy` 的 create 操作权限,才能访问 Kuboard Proxy;


**BUG修正**

* 创建工作负载时,layer 不能选择默认;
* RoleBinding/ClusterRolebinding 对话框 --> 部分情况下不能点击删除按钮;




* 工作负载编辑页 --> 容器 --> 就绪检查 --> 当未填写容器名称时,出现 undefined 的显示

------------------

**新特性**
Expand Down
79 changes: 0 additions & 79 deletions support/change-log/import-bug.yaml

This file was deleted.

22 changes: 21 additions & 1 deletion support/change-log/v1.0.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,30 @@ description: 本文描述了Kuboard_v1.0.x的版本变更说明
了解如何 [升级Kuboard](/install/install-dashboard-upgrade.html)

* eipwork/kuboard:<span style="font-weight: 800; color: #007af5">latest</span> 当前对应的版本是 kuboard <span style="font-weight: 800; color: #007af5">v1.0.6.3</span>
* eipwork/kuboard:<span style="font-weight: 800; color: #42b983">beta</span> 当前对应的版本是 kuboard <span style="font-weight: 800; color: #42b983">v1.0.7-beta.3</span>
* eipwork/kuboard:<span style="font-weight: 800; color: #42b983">beta</span> 当前对应的版本是 kuboard <span style="font-weight: 800; color: #42b983">v1.0.7-beta.5</span>

Kuboard v1.0.x 的更新说明

## v1.0.7-beta.5

**发布日期**

2020年3月1日

**优化**

* KuboardProxy 权限判断,登录用户必须具备 `services/proxy` 或者 `pods/proxy` 的 create 操作权限,才能访问对应的 Kuboard Proxy;
* 工作负载页 --> 修改工作负载的标签
* [自定义 Kuboard namespace 布局](/install/install-kuboard-layout.html)

**BUG修正**

* 创建工作负载时,layer 不能选择默认;
* RoleBinding/ClusterRolebinding 对话框 --> 部分情况下不能点击删除按钮;
* 集群概览页 --> 计算资源区最大化时的布局问题
* 工作负载编辑页 --> 容器 --> 就绪检查 --> 当未填写容器名称时,出现 undefined 的显示


## v1.0.7-beta.4

**发布日期**
Expand Down

0 comments on commit 68bebbc

Please sign in to comment.