目标
验证在 Istio 金丝雀升级期间,不同 sidecar 版本 + 不同 mTLS 策略(STRICT / PERMISSIVE)下,服务间的双向互通性。
mTLS 背景
跨版本升级的风险点
- 新旧 Envoy 版本间的证书格式 / TLS 协商不兼容
- TLS 协议版本差异
- 不同版本 istiod 对 STRICT 策略的执行行为差异
测试架构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| ┌──────────────────────────────────────────────────┐ │ release namespace (helm test pods) │ │ │ │ test-1 test-2 test-3 ... test-8 │ │ (pod-level istio.io/rev 控制 sidecar 版本) │ └────┬────────┬────────┬──────────────┬───────────┘ │ │ │ │ ┌──────────────┼────────┼────────┼──────────────┼──────────────┐ │ ▼ │ ▼ │ │ │ ┌─────────────────┐ │ ┌─────────────────┐ │ │ │ │ ns: old-strict │ │ │ ns: new-strict │ │ │ │ │ rev: old │ │ │ rev: new │ │ │ │ │ PA: STRICT │ │ │ PA: STRICT │ │ │ │ │ httpbin ────────│ │ │ httpbin ────────│ │ │ │ └─────────────────┘ │ └─────────────────┘ │ │ │ ▲ ▼ ▲ ▼ │ │ ┌──────────────────┐ ┌──────────────────┐ │ │ │ ns: old-permissive│ │ ns: new-permissive│ │ │ │ rev: old │ │ rev: new │ │ │ │ PA: (默认) │ │ PA: (默认) │ │ │ │ httpbin ─────── │ │ httpbin ─────── │ │ │ └──────────────────┘ └──────────────────┘ │ └─────────────────────────────────────────────────────────────┘
|
测试场景矩阵
共 8 个场景,每场景 5 项断言 = 40 项检查。
关于用户需求 #4(未启用 mTLS 的旧版服务 → 启用 mTLS 的新版服务):
在 Istio 中调用方自身的 PeerAuthentication 不影响出站调用,auto-mTLS 会在目标有 sidecar 时自动升级为 mTLS。因此需求 #4 在网络层等价于场景 #1。场景 #1 + #3 已完整覆盖。
每场景 5 项断言
实施步骤
阶段一 — Chart 脚手架
阶段二 — Kubernetes 资源模板(可并行)
阶段三 — 自动化脚本
阶段四 — 文档
参考文件
验证方式
设计决策
待讨论
- DestinationRule 交互 — 是否需要测试显式
DestinationRule tls.mode: ISTIO_MUTUAL?建议初期不需要,auto-mTLS 已覆盖。
- 全网格 STRICT PA —
istio-system 中的全局 STRICT PA 属运维范畴,不在跨版本测试范围内。
环境变量(运行时可覆盖)
使用示例
1 2 3 4 5 6 7 8 9 10
| ./run.sh all
OLD_REV=1-25-0 NEW_REV=1-28-5 ./run.sh all
./run.sh install ./run.sh test ./run.sh uninstall
|
故障排查
常见失败场景
调试命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| kubectl get peerauthentication -n istio-mtls-old-strict -o yaml kubectl get peerauthentication -n istio-mtls-new-strict -o yaml
istioctl proxy-config listeners <pod> -n <namespace>
istioctl proxy-config routes <pod> -n <namespace>
istioctl proxy-config secret <pod> -n <namespace>
kubectl exec -it <caller-pod> -n <namespace> -- \ curl -sv http://httpbin.<callee-ns>.svc.cluster.local/status/200
kubectl logs <pod> -n <namespace> -c istio-proxy --tail=50
|