Files
lpt-infra/README.md
T

85 lines
2.1 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.
# LPT Infrastructure
Kubernetes 部署清单,按环境隔离。
```
lpt-infra/
├── dev/
│ ├── deployment-lpt-fe.yaml
│ ├── deployment-lpt-be.yaml
│ ├── deployment-lpt-ai.yaml
│ ├── service-lpt-ai.yaml
│ ├── configmap.yaml
│ ├── lpt-secrets.yaml (template)
│ └── regcred-secret.yaml (template)
├── prod/
│ ├── deployment-lpt-fe.yaml
│ ├── deployment-lpt-be.yaml
│ ├── deployment-lpt-ai.yaml
│ ├── service-lpt-ai.yaml
│ ├── configmap.yaml
│ ├── lpt-secrets.yaml (template)
│ └── regcred-secret.yaml (template)
└── README.md
```
## 首次部署
### 1. 创建 namespace
```bash
kubectl create namespace lpt-dev
kubectl create namespace lpt-prod
```
### 2. 创建 Secret(模板不包含真实值,需手动创建)
```bash
# dev
kubectl create secret generic lpt-secrets \
--from-literal=llm-api-key=sk-xxx \
--from-literal=mysql-root-password=xxx \
-n lpt-dev
kubectl create secret docker-registry regcred \
--docker-server=192.168.123.199:5000 \
--docker-username=admin \
--docker-password=xxx \
-n lpt-dev
# prod
kubectl create secret generic lpt-secrets \
--from-literal=llm-api-key=sk-xxx \
--from-literal=mysql-root-password=xxx \
-n lpt-prod
kubectl create secret docker-registry regcred \
--docker-server=192.168.123.199:5000 \
--docker-username=admin \
--docker-password=xxx \
-n lpt-prod
```
### 3. Apply 全部配置
```bash
# dev
kubectl apply -f dev/
# prod
kubectl apply -f prod/
```
## 日常更新(CI/CD
CI/CD 流程使用 `kubectl set image` 更新镜像,仓库内 `imagePullSecrets` 已配置,无需额外操作。
```bash
kubectl set image deployment/lpt-fe lpt-fe=192.168.123.199:5000/lpt-fe:<TAG> -n lpt-dev
kubectl set image deployment/lpt-be lpt-be=192.168.123.199:5000/lpt-be:<TAG> -n lpt-dev
kubectl set image deployment/lpt-ai lpt-ai=192.168.123.199:5000/lpt-ai:<TAG> -n lpt-dev
```
## 验证
```bash
kubectl get pods -n lpt-dev
kubectl get pods -n lpt-prod
```