yaml文件导入前处理清单
2026-07-11 · k8s · 4 次阅读
填写说明: 「目标值」列留空,按目标环境填写后执行批量替换。
一、域名替换(全局)
| # |
类型 |
源值 |
目标值 |
涉及文件 |
优先级 |
| 1 |
Ingress 主域名 |
baseAmom.igozhang.cn |
|
11 个 ingress |
高 |
| 2 |
Ingress 前端域名 |
baseAapp.igozhang.cn |
|
base-web / produce-web / quality-web ingress |
高 |
| 3 |
Ingress 独立域名 |
baseAmom-pre.igozhang.cn |
|
preprocess-api ingress |
高 |
| 4 |
Ingress 独立域名 |
baseAmom-post.igozhang.cn |
|
postprocess-api ingress |
高 |
| 5 |
API 网关 |
gateway-baseA.igozhang.cn |
|
5 个 web configmap(base-config.js) |
高 |
| 6 |
应用门户 |
app-baseA.igozhang.cn |
|
mom-main-web / report-web configmap |
中 |
| 7 |
认证中心 |
idm-baseA.igozhang.cn |
|
mom-main-web / report-web configmap |
高 |
二、镜像仓库替换
| # |
类型 |
源值 |
目标值 |
涉及文件 |
优先级 |
| 8 |
Harbor 仓库前缀 |
harbor-baseA.igozhang.cn/baseAmon/ |
|
全部 13 个 deployment |
高 |
| 9 |
imagePullSecrets |
(当前无) |
|
若目标 Harbor 需认证则补充 |
视情况 |
2.1 各服务镜像清单(含 tag)
| 服务 |
源镜像 |
目标镜像 |
| ext-a-mes-file-center |
harbor-baseA.igozhang.cn/baseAmon/ext-a-mes-file-center:v1.0.0-build001 |
|
| igo-mes-auth-center |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-auth-center:v1.0.0-build002 |
|
| igo-mes-base-server |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-base-server:v1.0.0-build003 |
|
| igo-mes-base-web |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-base-web:v1.0.0-build004 |
|
| igo-mes-data-sync |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-data-sync:v1.0.0-build005 |
|
| igo-mes-postprocess-api |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-postprocess-api:v1.0.0-build006 |
|
| igo-mes-preprocess-api |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-preprocess-api:v1.0.0-build007 |
|
| igo-mes-produce-server |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-produce-server:v1.0.0-build008 |
|
| igo-mes-produce-web |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-produce-web:v1.0.0-build009 |
|
| igo-mes-quality-server |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-quality-server:v1.0.0-build010 |
|
| igo-mes-quality-web |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-quality-web:v1.0.0-build011 |
|
| igo-mes-report-web |
harbor-baseA.igozhang.cn/baseAmon/igo-mes-report-web:v1.0.0-build012 |
|
| igo-mom-main-web |
harbor-baseA.igozhang.cn/baseAmon/igo-mom-main-web:v1.0.0-build013 |
|
三、NodePort 替换
| # |
服务 |
源 nodePort |
目标 nodePort |
文件 |
| 10 |
ext-a-mes-file-center |
30996 |
|
service-ext-a-mes-file-center.yaml |
| 11 |
igo-mes-auth-center |
32410 |
|
service-igo-mes-auth-center.yaml |
| 12 |
igo-mes-postprocess-api |
30256 |
|
service-igo-mes-postprocess-api.yaml |
目标集群需确认端口未被占用;若改 NodePort,同步检查防火墙/安全组。
四、Nacos / 配置中心
| # |
配置项 |
源值 |
目标值 |
涉及范围 |
优先级 |
| 13 |
Nacos 地址 |
nacos-hs.nacos.svc.cluster.local:8848 |
|
全部后端 configmap(bootstrap.properties) |
高 |
| 14 |
discovery namespace |
standard |
|
12 个服务 configmap |
高 |
| 15 |
config namespace |
standard |
|
大部分后端 configmap |
高 |
| 16 |
config namespace(特殊) |
<NAMESPACE_UUID> |
|
仅 ext-a-mes-file-center configmap |
高 |
| 17 |
Nacos 用户名 |
nacos |
|
7 个 configmap |
中 |
| 18 |
Nacos 密码 |
<REDACTED> |
|
7 个 configmap |
高 |
| 19 |
metadata.region |
dev |
|
全部后端 configmap |
中 |
| 20 |
metadata.group |
auto-group |
|
全部后端 configmap |
低 |
| 21 |
shared-config data-id |
common.properties |
|
全部后端 configmap |
中 |
4.1 含 Nacos 密码的 ConfigMap
- igo-mes-base-server
- igo-mes-data-sync
- igo-mes-postprocess-api / postprocess-api2
- igo-mes-preprocess-api
- igo-mes-produce-server
- igo-mes-quality-server
五、运行时环境变量(Deployment)
| # |
配置项 |
源值 |
目标值 |
涉及服务 |
优先级 |
| 22 |
Spring Profile |
baseA-prod |
|
8 个后端 deployment(JAVA_OPTS) |
高 |
| 23 |
时区 TZ |
Europe/Budapest |
|
多个后端 deployment |
中 |
| 24 |
SkyWalking OAP |
apm-oap.apm-ns.svc:11800 |
|
仅 igo-mes-preprocess-api |
中 |
| 25 |
SkyWalking agent |
/soft/agent/skywalking-agent.jar |
|
仅 igo-mes-preprocess-api |
中 |
5.1 使用 baseA-prod 的服务
ext-a-mes-file-center、igo-mes-auth-center、igo-mes-base-server、igo-mes-produce-server、igo-mes-postprocess-api、igo-mes-preprocess-api、igo-mes-data-sync、igo-mes-quality-server
六、前端 ConfigMap(base-config.js)
| # |
服务 |
关键源配置 |
目标值 |
优先级 |
| 26 |
igo-mes-base-web |
gatewayHost = https://gateway-baseA.igozhang.cn |
|
高 |
| 27 |
igo-mes-produce-web |
同上 |
|
高 |
| 28 |
igo-mes-quality-web |
同上 |
|
高 |
| 29 |
igo-mes-report-web |
gatewayHost + app-baseA + idm-baseA |
|
高 |
| 30 |
igo-mom-main-web |
gatewayHost + app-baseA + idm-baseA |
|
高 |
前端 configmap 内域名可通过「一、域名替换」批量 sed 处理。
七、Namespace
| # |
配置项 |
源值 |
目标值 |
涉及文件 |
优先级 |
| 31 |
namespace |
mes-app |
|
全部 55 个 yaml |
视情况 |
目标集群 namespace 不变则跳过。
八、无需替换(保留)
| 项目 |
说明 |
| 服务名 / Deployment 名 |
如 igo-mes-auth-center,目标环境保持一致则不改 |
| Ingress path 路由规则 |
如 `/igo-mes-auth-center(/ |
| Nacos config prefix |
与服务名一致,通常保留 |
| ClusterIP 类型 Service |
无 nodePort,仅需确认 selector 不变 |
| igo-mes-report-web |
无 Ingress,仅 ClusterIP 暴露 |
九、替换执行建议
9.1 推荐顺序
1. 备份 mes-app-cleans
2. 全局域名替换(第二节 + 第一节)
3. 镜像仓库前缀替换
4. Nacos 地址 / namespace / 密码
5. Spring Profile / TZ / SkyWalking
6. NodePort(按需)
7. namespace(按需)
9.2 批量替换示例(填好目标值后执行)
SRC="mes-app-cleans"
DEST="mes-app-replaced"
cp -a "${SRC}" "${DEST}"
# Example: domain replace
find "${DEST}" -name '*.yaml' -exec sed -i \
's/baseAmom\.igozhang\.cn/<TARGET_BASEAMOM>/g' \
's/baseAapp\.igozhang\.cn/<TARGET_BASEAAPP>/g' \
's/gateway-baseA\.igozhang\.cn/<TARGET_GATEWAY>/g' \
's/harbor-baseA\.igozhang\.cn/<TARGET_HARBOR>/g' \
{} +
9.3 替换后验证
grep -rE "igozhang\.cn|baseA-prod|nacos-hs\.nacos" mes-app-replaced/ | head -10 || echo "源环境残留: none"
grep -rE "<TARGET_BASEAMOM>|<TARGET_HARBOR>" mes-app-replaced/ | wc -l
十、统计摘要
| 类别 |
数量 |
| 待替换域名(去重) |
7 |
| 待替换镜像 |
13 |
| NodePort 服务 |
3 |
| Nacos ConfigMap |
14 |
| 前端 ConfigMap |
5 |
| Spring Profile 服务 |
8 |