Files
k3s/apps/template/README.md

56 lines
1.4 KiB
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.
# 新增應用範本
## 使用步驟
1. **複製範本**
```bash
cp -r apps/template apps/your-app
```
2. **替換佔位符**
- `{{APP_NAME}}` → 應用名稱(如 `myapp`
- `{{IMAGE}}` → Docker 映像(如 `nginx`
- `{{TAG}}` → 版本標籤(如 `1.25`
- `{{PORT}}` → 容器端口(如 `80`
- `{{HOST}}` → 網域名稱(如 `app.example.com`
- `{{SIZE}}` → 儲存大小(如 `10Gi`
- `{{DATA_MOUNT_PATH}}` → 資料掛載路徑
3. **權限設定**
```bash
chmod +x apps/your-app/*.sh
```
4. **部署**
```bash
cd apps/your-app
./deploy.sh
```
## 目錄結構
```
apps/your-app/
├── manifests/ # K8s YAML 檔案
│ ├── app-deployment.yaml
│ ├── app-pvc.yaml
│ ├── app-ingress.yaml
│ └── app-service.yaml
├── deploy.sh # 部署腳本
├── stop.sh # 停止腳本
├── status.sh # 狀態檢查
├── backup.sh # 備份腳本
└── backup/ # 備份檔案目錄
```
## 常見調整
### 有資料庫的應用
在 `manifests/` 新增 `db-deployment.yaml`、`db-service.yaml`
### 需要密碼/金鑰
在 `manifests/` 新增 `secret.yaml`(參考 `apps/codimd/manifests/01-codimd-secrets.yaml`
### 需要特殊設定
在 `manifests/` 新增 `configmap.yaml`