This commit is contained in:
huanqing.shao
2019-07-25 06:22:52 +08:00
parent 97d19726a4
commit 493e4272d7
622 changed files with 3007 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,103 +0,0 @@
# 部署 busybox
## 前提
必须具备如下条件:
* Kubernetes 集群
* 已在集群中安装 Kuboard
假设您已经进入了 Kuboard 名称空间界面,如下图所示。可参考 [创建名称空间](/guide/cluster/namespace.html#创建名称空间)
![image-20190723115721514](./pre-condition.assets/image-20190723115721514.png)
## 部署 busybox
[查看 busybox 介绍](https://hub.docker.com/_/busybox)
Busybox 是一个非常小巧不到5M的容器此处用它来展示如何将一个 docker image 通过 Kuboard 部署到 kubernetes 集群中。
* 点击 ***创建工作负载按钮***
填写表单如下:
| 字段名称 | 填写内容 | 说明 |
| -------- | ------------ | ------------------------------------------------------------ |
| 服务类型 | Deployment | Kubernetes 的 Deployment 类型 |
| 服务分层 | 中间件 | 生成的Kuberenetes对象以 cloud- 作为前缀,<br />并显示在中间件分层中 |
| 服务名称 | busybox | 显示在 Kuboard 中的名称 |
| 副本数量 | 1 | replicas |
| 容器名称 | busybox | |
| 镜像 | busybox:1.29 | hub.docker.com 中的 busybox 镜像 |
| Command | sleep | |
| Command | 3600 | |
![image-20190723115852719](./busybox.assets/image-20190723115852719.png)
* 完成表单填写后,点击***保存***
Kuboard 将对表单参数进行校验,通过后,方可执行对集群的变更操作。
![image-20190723115912645](./busybox.assets/image-20190723115912645.png)
* 点击***应用***
Kuboard 执行对集群的变更操作,变更的过程中,产生的事件以通知消息的形式显示出来。
![image-20190723115940862](./busybox.assets/image-20190723115940862.png)
## 验证工作负载
* 点击***完成***
点击完成后,可查看工作负载的信息。该界面分成四个区域:
* 页头区
页头区包含对该工作负载(本案例中为 Deployment的操作按钮。可执行的操作有***编辑*** / ***伸缩*** / ***刷新*** / ***删除***
* 工作负载基本信息
基本信息区显示了工作负载的 ***基本信息*** 、***运行时信息***、***访问方式***Service、***互联网入口***Ingress
* 容器组列表
容器组列表区显示了该当前对应的所有容器组Pod容器组列表区监听集群的动态变化当您执行伸缩操作、或者删除容器组操作时无需刷新就可以查看到最新的容器组信息。
* 容器组详情
容器组详情区显示了当前选中容器组的信息,其中包括:
* 容器组相关事件
* 容器组基本信息,及删除容器组的操作按钮。(此区域还包括容器组相关的监控操作,监控模块在后续的章节中介绍)
* 容器基本信息,及查看容器日志、打开容器终端的按钮。(此区域还包括容器相关的监控操作,监控模块在后续的章节中介绍)
![image-20190723120011972](./busybox.assets/image-20190723120011972.png)
* 点击***终端***
此时打开了该容器的控制台Kuboard 默认使用 /bin/bash 终端程序,而 busybox 镜像中并不包含 /bin/bash因此您会看到一个如下图所示的错误提示
![image-20190723120050894](./busybox.assets/image-20190723120050894.png)
* 点击***切换到 /bin/sh***
点击屏幕左上角的 ***切换到 /bin/sh***
![image-20190723120104474](./busybox.assets/image-20190723120104474.png)
* 输入 *export* 并回车
输入 *export* 并回车后,可查看该容器当前的环境变量。您也可以在终端中执行任何容器内部的命令。在您完成容器的部署之后,终端界面是非常有效的问题诊断工具之一。
![image-20190723120125425](./busybox.assets/image-20190723120125425.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,165 +0,0 @@
# 导入 example 微服务
## 前提
必须具备如下条件:
* Kubernetes 集群 (安装在阿里云,本文将使用阿里云的 NFS 服务作为存储资源Kuboard 也可以运行在其他云环境或者私有环境中。)
* 已在集群中安装 Kuboard
## 创建存储资源
example中用到了存储卷声明请在 Kuboard 中 [创建存储类](/guide/cluster/storage?id=创建存储类) ,否则不能完成 example 的导入操作。
## 创建名称空间
创建新的名称空间,用来导入 exmaple。可参考 [创建名称空间](/guide/cluster/namespace?id=创建名称空间)
假设您已经进入了 Kuboard 名称空间界面,如下图所示:
![image-20190723115721514](./pre-condition.assets/image-20190723115721514.png)
## 导入 example
* 下载 <a :href="$withBase('/kuboard_example.yaml')" download="kuboard_example.yaml">kuboard_example.yaml</a> 文件
> 在 Kuboard 中,您无需手写 yaml 文件,此 yaml 文件的内容生成步骤如下:
> * 通过 [创建工作负载](busybox) 完成微服务应用的部署
> * 通过 **导出工作负载** 将名称空间中的微服务配置导出到一个 yaml 文件中
* 点击 ***导入工作负载*** 按钮
![image-20190723120730196](./import.assets/image-20190723120730196.png)
* 点击 ***上传文件*** 按钮
并选择刚才下载的 export_example.yaml 文件
![image-20190723120753533](./import.assets/image-20190723120753533.png)
* 点击 ***下一步***
默认选择所有的工作负载
![image-20190723120832778](./import.assets/image-20190723120832778.png)
* 点击***下一步***
默认选择所有要导入的配置example中没有使用到配置信息
![image-20190723120912377](./import.assets/image-20190723120912377.png)
* 点击 ***下一步***
默认选择所有 Secrets
![image-20190723120926747](./import.assets/image-20190723120926747.png)
* 点击***下一步***
填写表单:
| 字段名称 | 填写内容 | 说明 |
| ------------------ | ------------------ | ------------------------------------------------------------ |
| 数据卷类型 | db-example-storage | NFS容器组直连NFS<br />存储卷声明:容器组使用存储卷声明 |
| 是否新建存储卷声明 | 创建新存储卷声明 | 使用已有存储卷声明:可以使用事先创建好的存储卷声明<br />创建新存储卷声明:可以创建新存储卷声明 |
| 分配模式 | 动态分配 | |
| 读写模式 | 可被多节点读写 | 只能被单节点读写、可被多节点只读、可被多节点读写 |
| 总量 | 2Gi | 2Gi代表 2G空间 |
![image-20190723120956821](./import.assets/image-20190723120956821.png)
* 点击***下一步***
填写表单:
| 字段名称 | 填写内容 | 说明 |
| ---------------- | ---------------------------------- | ------------------------------------------------------------ |
| cloud-eureka域名 | cloud-eureka.example.demo.eip.work | 使用您自己的域名,<br />在测试环境建议使用如下域名格式:<br />workloadname.namespace-name.cluster-name.domain.com<br />该域名应该解析到您worker节点的外网地址或者worker 节点 80/443 端口对应负载均衡服务器的外网地址。 |
| web-example | web-example.example.demo.eip | |
![image-20190723121019167](./import.assets/image-20190723121019167.png)
* 点击***下一步***
![image-20190723121035917](./import.assets/image-20190723121035917.png)
* 点击 ***确定***
![image-20190723121055648](./import.assets/image-20190723121055648.png)
* 点击 ***应用***
![image-20190723121117514](./import.assets/image-20190723121117514.png)
* 点击 ***完成***
![image-20190723121132991](./import.assets/image-20190723121132991.png)
* 点击 ***已完成***
可再名称空间中查看到刚才导入的 example 的所有工作负载及存储卷声明
![image-20190723121433809](./import.assets/image-20190723121433809.png)
## 验证 web-example
* 点击工作负载 ***web-example***
![image-20190723121412027](./import.assets/image-20190723121412027.png)
* 点击 互联网入口中的域名 ***http://web-example.example.demo.eip.work***
**Example 部署成功**
![image-20190717193548703](./import.assets/image-20190717193548703.png)
> web-example容器的日志中会出现如下异常错误原因是example使用了一个监控套件该监控套件要求将容器注册到monitor-eureka中当下我们并没有安装该监控套件。此错误并不影响 example 程序的使用。暂时忽略该异常。
>
> ```
> [DiscoveryClient-InstanceInfoReplicator-0] WARN com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient - Request execution failed with message: java.net.UnknownHostException: monitor-eureka
> [DiscoveryClient-InstanceInfoReplicator-0] WARN com.netflix.discovery.DiscoveryClient - DiscoveryClient_WEB-ADMIN/web-example-7f668c75db-j7ncx - registration failed Cannot execute request on any known server
> com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
> at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112)
> at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
> at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59)
> at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
> at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
> at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:829)
> at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:121)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> [DiscoveryClient-InstanceInfoReplicator-0] WARN com.netflix.discovery.InstanceInfoReplicator - There was a problem with the instance info replicator
> com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
> at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112)
> at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
> at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59)
> at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
> at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
> at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:829)
> at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:121)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> ```
>
>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,211 +0,0 @@
# 监控 example (alpha)
## 前提
必须具备如下条件:
* 已完成 [导入 example 微服务](/guide/example/import)
!> 监控套件相关的功能目前处于 alpha 状态,虽然在实际投产项目中取得了非常好的效果,但是产品化封装还需要进一步改进。
假设您已进入 example 名称空间,如下图所示:
![image-20190723121433809](./import.assets/image-20190723121433809.png)
## 安装监控套件
### 安装全局监控套件
* 在 master 节点执行
```bash
kubectl -n kube-system create secret generic etcd-certs --from-file=/etc/kubernetes/pki/etcd/server.crt --from-file=/etc/kubernetes/pki/etcd/server.key
```
* 将鼠标移到 ***设置*** 菜单
![image-20190723150525017](./monitor.assets/image-20190723150525017.png)
* 点击 ***监控套件 - example***
![image-20190723150616633](./monitor.assets/image-20190723150616633.png)
* 点击 ***全局监控套件 / 查找并安装***
![image-20190723150853277](./monitor.assets/image-20190723150853277.png)
* 点击 ***资源层监控套件 / 安装***
![image-20190723151045112](./monitor.assets/image-20190723151045112.png)
* 点击 ***全局监控套件 / 资源层监控套件 / 安装***
![image-20190723151103353](./monitor.assets/image-20190723151103353.png)
* 根据向导提示,完成工作负载的导入
![image-20190723151339137](./monitor.assets/image-20190723151339137.png)
* 点击 ***资源层监控套件 / 初始化***
由于下载镜像需要时间您可能需要等待5-10分钟后才能成功执行初始化。初始化成功的话您将看到如下提示信息。
![image-20190723151357262](./monitor.assets/image-20190723151357262.png)
### 安装名称空间监控套件
* 点击 ***名称空间监控套件 example / 查找并安装***
![image-20190723151422460](./monitor.assets/image-20190723151422460.png)
* 重复前述过程,安装监控套件
重复前述过程,完成如下监控套件的安装和初始化:
* Pinpoint 监控套件
* Prometheus 监控套件
* 熔断及限流 Sentinel
安装完成后,界面如下图所示:
![image-20190723151711230](./monitor.assets/image-20190723151711230.png)
### 查看监控套件的工作负载
* 点击 ***后退***
回到名称空间后,可查看到刚才安装监控套件时导入的监控层工作负载。
> 全局监控套件安装在 kube-system 名称空间
![image-20190723151804727](./monitor.assets/image-20190723151804727.png)
## 重启 example 容器组
* 点击导航栏中的 ***容器组列表***
在筛选条件中选择
* 展现层
* 网关层
* 服务层
* 持久层
* 中间件
并点击刷新
> * Kuboard 创建工作负载时,默认将其 imagePullPolicy 设置为 **Always**
>
> * 删除容器组时Kubernetes 将为该工作负载启动一个新的容器组以尽可能地使工作负载的容器组数量等于该工作负载期望的副本数replicas
> * Kubernetes 在启动容器组时,根据 imagePullPolicy 的设置 Always将会尝试从镜像仓库抓取最新镜像这一特性可以用于开发环境和测试环境的版本更新因为您的 devops 系统肯能不会为 daily build 生成新的镜像标签;
> * 此处删除容器组的目的是,重新启动容器,以便容器中的监控探针能够检测到其对应监控套件的存在。
![image-20190723151845303](./monitor.assets/image-20190723151845303.png)
* 在列表中选择
选中如下容器组:
* cloud-eureka-0
* db-example-xxxxxx-xxxx
* gateway-example-xxxxxx-xxxx
* svc-example-xxxxxx-xxxx
* web-example-xxxxxx-xxxx
![image-20190723151902003](./monitor.assets/image-20190723151902003.png)
* 点击 ***删除*** 按钮
![image-20190723151914994](./monitor.assets/image-20190723151914994.png)
* 点击 ***确定***
![image-20190723151932871](./monitor.assets/image-20190723151932871.png)
* 点击 ***应用***
![image-20190723151951910](./monitor.assets/image-20190723151951910.png)
* 等待,直到容器组调整完成
![image-20190723152020605](./monitor.assets/image-20190723152020605.png)
* 点击 ***后退***
![image-20190723152040219](./monitor.assets/image-20190723152040219.png)
## 查看监控信息
### 查看资源层监控信息
* 点击 ***展现层 / web-example***
如果您在下图中没有看到 ***Nginx 监控*** ***容器组监控*** 等,请刷新您的页面,因为监控套件初始化之后需要刷新页面才能加载并显示。
![image-20190723152124196](./monitor.assets/image-20190723152124196.png)
* 点击 ***所在节点监控***
可查看所在节点的资源使用情况监控信息
![image-20190718104156232](./monitor.assets/image-20190718104156232.png)
### 查看中间件层监控信息
#### 查看 Nginx 监控
* 点击 Nginx 监控
![image-20190718104729472](./monitor.assets/image-20190718104729472.png)
#### 查看 MySQL 监控
* 返回 ***example*** 名称空间
* 点击 ***持久层 / example db***
* 点击 ***MySQL 监控***
![image-20190718105420599](./monitor.assets/image-20190718105420599.png)
#### 查看 JVM 监控
* 返回 ***example*** 名称空间
* 点击 ***微服务层 / example***
* 点击 ***Java 虚拟机监控***
![image-20190718105641651](./monitor.assets/image-20190718105641651.png)
### 查看链路追踪监控信息
****微服务层 / example*** 中点击 ***链路追踪***
![image-20190718120957255](./monitor.assets/image-20190718120957255.png)
![image-20190718121133160](./monitor.assets/image-20190718121133160.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB