ci: add gitea deploy workflow and k3s manifests with cert-manager tls
Some checks failed
Deploy Noval to K3s / deploy (push) Failing after 1s

This commit is contained in:
2026-03-22 17:28:45 +08:00
parent 098ff4e16d
commit a470739190
8 changed files with 249 additions and 0 deletions

44
k8s/README.md Normal file
View File

@@ -0,0 +1,44 @@
# Noval K3s 部署说明
## 文件列表
- `namespace.yaml`:命名空间
- `pvc.yaml`SQLite 数据持久化存储
- `deployment.yaml`应用部署2 副本,滚动更新)
- `service.yaml`:集群内服务
- `cluster-issuer.yaml`cert-manager ClusterIssuerLet's Encrypt
- `ingress.yaml`Traefik 入口(域名 + TLS
## 一次性手动部署
```bash
cd /root/k8syaml/NovalRedot
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/cluster-issuer.yaml
kubectl apply -f k8s/pvc.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml
```
## CI/CD 自动部署
已配置 Gitea Actions`.gitea/workflows/deploy.yml`
触发条件:`main` 分支 push。
流水线逻辑:
1. 在 Runner 所在机器拉取最新代码
2. 构建 Docker 镜像并打 tag`noval-app:<commit>` + `latest`
3. 导入镜像到 k3s containerd
4. 应用 K8s 资源并滚动更新 Deployment
5. 等待 rollout 完成
## 你需要确认/调整
1. **域名**:当前写的是 `writing-reddot.roog-code.cn``k8s/ingress.yaml`
2. **TLS Secret**:当前是 `writing-reddot-roog-code-tls`
3. **ClusterIssuer**:当前是 `letsencrypt-prod``k8s/cluster-issuer.yaml`
4. **ClusterIssuer 邮箱**:当前是 `roog-code@outlook.com`(可改成你常用邮箱)
5. **Ingress 类**:当前按 Traefik 配置k3s 默认)
6. **StorageClass**`local-path`k3s 默认)