This commit is contained in:
huanqing.shao
2019-09-28 14:06:04 +08:00
parent 5cac30601d
commit a0d2fe90ba
5 changed files with 64 additions and 0 deletions

View File

@ -72,6 +72,13 @@ OCP 要求 mysql 版本 5.7 以上,当我们在 K8S 上部署 mysql 时,将
ADD 01.user-center.sql /docker-entrypoint-initdb.d/01.user-center.sql
EXPOSE 3306
```
::: warning SQL脚本问题
01.user-center.sql 脚本中包含一些 create FUNCTION 的语句,已经确认这些 FUNCTION 并不被用到。在执行 coker build 之前,请确保这些 create FUNCTION 的语句被删除,否则您将在 mysql 初始化时碰到如下错误:
```
ERROR 1064 (42000) at line 246: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
```
:::
* 执行命令 `docker build -f dockerfile_user-center -t ocpsample/user-center-mysql:latest .`

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -0,0 +1,55 @@
---
vssueId: 89
layout: LearningLayout
description: Kubernetes教程_使用Kuboard在Kubernetes上部署Spring_Cloud_open_capacity_platform微服务能力开放平台_部署redis
---
# 在K8S上部署redis
如 [在K8S上部署mysql](./mysql.html) 所述auth-center、user-center、api-gateway 都需要使用 redis 服务,本文描述如何使用 Kuboard 在 Kubernetes 上部署 redis。
本文将使用 [redis官方镜像](https://hub.docker.com/_/redis) 进行部署。
## 部署redis
* 在 Kuboard 界面进入名称空间 `ocp`,点击 **创建工作负载** 按钮,并填写表单,如下图所示:
| 字段名称 | 填写内容 | 备注 |
| -------- | ------------------------------------------------------------ | ---- |
| 服务类型 | StatefulSet | |
| 服务分层 | 中间件 | |
| 服务名称 | redis | |
| 服务描述 | Redis缓存 | |
| 容器名称 | redis | |
| 镜像 | redis:4.0.14 | |
| 抓取策略 | Always | |
| Service | ClusterIP集群内访问<br />协议:`TCP` 端口: `6379` 容器端口:`6379` | |
![Kubernetes教程_在K8S上部署Redis](./redis.assets/image-20190928132439770.png)
* 点击 **保存**
* 点击 **应用**
* 点击 **完成**
稍等片刻,即可完成 redis 的部署
## 检查redis
* 在 Kuboard 界面进入 `cloud-redis-0` 容器组的日志界面,可查看到 redis 可用的输出信息,如下所示:
```sh
1:M 28 Sep 05:25:07.302 * Ready to accept connections
```
![Kubernetes教程_在K8S上部署Redis_检查结果](./redis.assets/image-20190928132847904.png)
* :tada: :tada: :tada: 您已在 K8S 上完成了 Redis 的部署
::: tip 集群
www.kuboard.cn 将另外安排文章描述如何在 Kubernetes 上部署 Redis 的集群。此处为了保持 Spring Cloud 部署教程的简洁性,使用单节点 Redis
:::

View File

@ -181,6 +181,8 @@ Kuboard 为 Kubernetes 初学者设计了如下学习路径:
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server]
* [在K8S上部署user-center]
* [在K8S上部署api-gateway]