docs(k8s): document cross-cloud install.sh capabilities

- env var table (IMAGE/NS/STORAGE_CLASS/PVC_SIZE/LOCAL_STORAGE/NODE_NAME),
  cloud detection + storage class chain + zero-dependency local PV
  fallback, examples/ layout in file table
This commit is contained in:
Logan.Li committed 2026-10-26 22:10:08 +08:00
1 parent 738498fea3
commit dbe9e4ab86
1 file changed
+25 -8
+25 -8
View File
@@ -4,31 +4,48 @@
| 文件 | 说明 | | 文件 | 说明 |
|---|---| |---|---|
| `install.sh` | **一键部署**(推荐):建命名空间/生成密钥/应用全部清单/等待就绪 | | `install.sh` | **一键部署**(推荐):云探测/SC 探测/本地 PV 兜底/密钥/清单渲染/失败诊断 |
| `namespace.yaml` | `opsxsql` 命名空间 | | `namespace.yaml` | `opsxsql` 命名空间 |
| `secret.example.yaml` | 密钥模板(建议用 `kubectl create secret`,install.sh 已自动处理) |
| `pvc.yaml` | 数据卷(默认 10Gi,集群默认 StorageClass) | | `pvc.yaml` | 数据卷(默认 10Gi,集群默认 StorageClass) |
| `deployment.yaml` | 平台本体,**单副本 + Recreate** | | `deployment.yaml` | 平台本体,**单副本 + Recreate** |
| `service.yaml` | ClusterIP `opsxsql:80` | | `service.yaml` | ClusterIP `opsxsql:80` |
| `service-nodeport.yaml` | 可选 NodePort 入口(`:30900`) | | `service-nodeport.yaml` | 可选 NodePort 入口(`:30900`) |
| `ingress.yaml` | 可选,按集群 ingressClass 调整 | | `ingress.yaml` | 可选,通用 nginx Ingress |
| `examples/` | 跨云模板:阿里 ALB / 腾讯 qcloud Ingress、Secret 模板 |
## 一键部署 ## 一键部署(自动跨云适配)
`install.sh` 自动探测云平台(阿里 ACK / 腾讯 TKE / AWS EKS / 华为 CCE / GCP GKE / Azure AKS / K3s / 自建)
与 StorageClass(显式指定 > default 注解 > 唯一 SC);**自建集群无 SC 时自动创建零依赖的节点本地 PV**
(hostPath + nodeAffinity 锁节点 + Retain,无需 local-path-provisioner 镜像);部署失败时按云平台给出
镜像仓库/SC 定制诊断。幂等:重复执行不覆盖密钥、不重建数据卷。
```bash ```bash
# 默认(镜像 opsxsql:latest,需先 build&push 或 node 可用) # 默认(镜像 opsxsql:latest)
bash kubernetes/install.sh bash kubernetes/install.sh
# 指定镜像 + NodePort 入口 # 指定镜像 + NodePort 入口
IMAGE=registry.example.com/opsxsql:v1.0.0 bash kubernetes/install.sh --nodeport IMAGE=registry.example.com/opsxsql:v1.0.0 bash kubernetes/install.sh --nodeport
# 指定镜像 + Ingress 域名 # 指定镜像 + 通用 nginx Ingress 域名(其他云模板见 examples/)
IMAGE=registry.example.com/opsxsql:v1.0.0 bash kubernetes/install.sh --ingress opsxsql.example.com IMAGE=registry.example.com/opsxsql:v1.1.0 bash kubernetes/install.sh --ingress opsxsql.example.com
# 自定义命名空间 / 卷大小 # 自定义命名空间 / 卷大小 / 手动指定 StorageClass / 强制本地存储
NS=sql-audit PVC_SIZE=20Gi bash kubernetes/install.sh NS=sql-audit PVC_SIZE=20Gi bash kubernetes/install.sh
STORAGE_CLASS=alicloud-disk-essd bash kubernetes/install.sh
LOCAL_STORAGE=force NODE_NAME=node1 bash kubernetes/install.sh # 数据固定 node1:/var/lib/opsxsql-data
``` ```
| 环境变量 | 默认 | 说明 |
|---|---|---|
| `IMAGE` | `opsxsql:latest` | 镜像(构建:仓库根 `docker compose build` 或 `docker build .`) |
| `NS` | `opsxsql` | 命名空间 |
| `STORAGE_CLASS` | 自动探测 | 指定 StorageClass |
| `PVC_SIZE` | `10Gi` | 数据卷容量 |
| `WITH_NODEPORT` / `--nodeport` | `0` | 附带 NodePort `:30900` 入口 |
| `LOCAL_STORAGE` | `auto` | 无 SC 时:`auto` 自动建本地 PV / `off` 仅提示 / `force` 强制本地 |
| `NODE_NAME` / `PV_PATH` | 自动 / `/var/lib/opsxsql-data` | 本地存储落点 |
## 分步部署(等价于 install.sh) ## 分步部署(等价于 install.sh)
```bash ```bash