71 lines
1.7 KiB
Markdown
71 lines
1.7 KiB
Markdown
# Gitea Kubernetes 部署配置
|
||
|
||
本目录包含在Kubernetes集群中部署Gitea的配置文件。
|
||
|
||
## 文件说明
|
||
|
||
### 1. gitea-deployment.yaml
|
||
Gitea应用的主要部署配置:
|
||
|
||
- **nodeSelector**: 确保Gitea只在主节点(control-plane)上运行
|
||
- **image**: 使用官方Gitea镜像 `gitea/gitea:latest`
|
||
- **ports**:
|
||
- 3000: HTTP Web界面端口
|
||
- 22: SSH Git操作端口
|
||
- **volumes**:
|
||
- `/opt/gitea/data`: 数据存储目录(主机路径)
|
||
- `/opt/gitea/config`: 配置文件目录(主机路径)
|
||
- **env**: 设置用户UID和GID为1000
|
||
|
||
### 2. gitea-service.yaml
|
||
Gitea服务配置:
|
||
|
||
- **type**: ClusterIP(集群内部访问)
|
||
- **ports**: 暴露3000和22端口
|
||
- **selector**: 匹配app=gitea的pod
|
||
|
||
### 3. gitea-ingress.yaml
|
||
Gitea外部访问配置:
|
||
|
||
- **host**: git-ops.t-aaron.com(外部访问域名)
|
||
- **annotations**: 配置Traefik入口点
|
||
- **path**: 根路径(/)转发到Gitea服务
|
||
|
||
### 4. install-gitea.sh
|
||
一键安装脚本:
|
||
|
||
- 按顺序应用所有yaml文件
|
||
- 等待部署完成
|
||
- 显示访问信息
|
||
|
||
## 部署步骤
|
||
|
||
1. 确保k3s集群正常运行
|
||
2. 运行安装脚本:
|
||
```bash
|
||
./install-gitea.sh
|
||
```
|
||
3. 访问 http://git-ops.t-aaron.com 进行Gitea初始化
|
||
|
||
## 注意事项
|
||
|
||
- Gitea数据存储在主机 `/opt/gitea/` 目录
|
||
- 确保主节点有足够的存储空间
|
||
- 首次访问需要完成Gitea初始化配置
|
||
|
||
|
||
Gitea 安装配置
|
||
配置:git-ops.t-aaron.com
|
||
配置:https://git-ops.t-aaron.com/
|
||
|
||
注册用户:
|
||
tuoheng
|
||
tuoheng@qq.com
|
||
tuoheng2023
|
||
|
||
设置安全配置:管理 OAuth2 应用程序
|
||
https://drone-ops.t-aaron.com/login
|
||
客户端:87ef56d3-c8ef-40d3-9dd5-d9214fdac09f
|
||
密钥:tHe6Cq3dNpelsCA2NRTaGB3EueIFRkyLxh9USwBbxe4A
|
||
|
||
参考:https://readme.drone.io/server/provider/gitea/ |