a-cloud-all/k8s/02-redis/README.md

46 lines
916 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 02-Redis 部署
## 说明
部署 Redis 缓存服务,使用 StatefulSet 保证数据持久化。
## 部署流程
1. **构建镜像** - 使用 docker-compose 构建 Redis 镜像
2. **导入镜像** - 如果是 Minikube 环境,自动导入镜像
3. **部署到 K8s** - 部署 Service 和 StatefulSet
4. **等待启动** - 等待 Pod 就绪
## 配置说明
- **Service 名称**: ruoyi-redis
- **端口**: 6379
- **存储**: 5Gi PVC
- **镜像**: redis-runtime通过 docker-compose 构建)
## 文件说明
- `service.yaml` - Redis Service 配置
- `statefulset.yaml` - Redis StatefulSet 配置
- `deploy.sh` - 一键部署脚本(包含镜像构建)
## 部署步骤
```bash
# 进入目录
cd 02-redis
# 执行部署脚本
./deploy.sh
```
## 验证
```bash
# 查看 Pod 状态
kubectl get pods -n ruoyi -l app=redis
# 测试 Redis 连接
kubectl exec -it redis-0 -n ruoyi -- redis-cli ping
```