← All incidents

[Eval][v2][zh] Regional 5xx spike after DNS TTL change

service: api-gatewaycreated: 6/3/2026, 12:03:06 AM

Raw incident context

Time: 22:10 UTC. api-gateway in us-west-2 returning HTTP 502 for ~35% of requests. us-east-1 unaffected.

Symptoms (us-west-2 only):
- 502 rate: 35% (baseline 0.05%)
- p99 latency: 4s (mostly DNS resolution timeouts in error trace)
- nginx upstream errors: "upstream timed out (110: Connection timed out) while connecting to upstream"

Recent changes:
- 21:40 UTC — DNS team changed TTL for internal-services.example.com from 300s → 30s as part of a planned migration
- Also changed CNAME target: internal-services.example.com now points to a NEW NLB (was pointing to a legacy ALB)
- Old ALB still up and answering, but its DNS records were not removed
- New NLB was created in us-east-1 only — no us-west-2 record exists

Logs:
- nginx in us-west-2 trying to resolve internal-services.example.com → getting NXDOMAIN or stale IPs
- ~30% of pods have cached the old ALB IP and are working; rest are failing
- us-east-1 pods all resolve correctly to the new NLB

On-call:
- 22:08 — pager
- 22:11 — DNS team confirms the planned change
- 22:12 — debate: revert DNS or hot-patch us-west-2 to point at us-east-1 NLB

Summary

SEV1

api-gateway 在 us-west-2 区域出现 35% 的 502 错误和 p99 4s 延迟,原因是 DNS 团队在 21:40 UTC 将 internal-services.example.com 的 CNAME 指向了一个仅部署在 us-east-1 的新 NLB,导致 us-west-2 的 pod 无法解析到有效后端。

Severity reasoning: 用户可见的 502 错误率 35% 远超 1%,且持续超过 5 分钟,符合 SEV1 标准。

deepseek-chat·prompt v2·output: zh·13550ms·2195↑ / 1944↓ tok·$0.00273

Root cause hypotheses

  • highDNS 变更导致 us-west-2 的 pod 无法解析 internal-services.example.com 到有效 IP

    Evidence: nginx 日志显示 'upstream timed out (110: Connection timed out) while connecting to upstream',且 us-west-2 的 DNS 解析返回 NXDOMAIN 或过期 IP。

  • high新 NLB 未在 us-west-2 创建,导致该区域无可用后端

    Evidence: DNS 团队确认新 NLB 仅部署在 us-east-1,us-west-2 无对应记录。

  • medium旧 ALB 的 DNS 记录未清理,导致部分 pod 使用过期 IP 但连接失败

    Evidence: 约 30% 的 pod 仍使用旧 ALB IP 并正常工作,其余 pod 因 DNS 解析失败而报错。

  • mediumDNS TTL 从 300s 改为 30s 导致缓存失效,加剧了解析失败的影响

    Evidence: TTL 变更发生在 21:40 UTC,与故障时间吻合,且 us-west-2 的 pod 因 TTL 缩短更快地获取到无效记录。

  • lowus-west-2 的 nginx 配置中 resolver 未正确配置,导致 DNS 解析超时

    Evidence: 虽然 us-east-1 正常,但 us-west-2 的 resolver 可能指向了错误的 DNS 服务器,需进一步检查。

Investigation checklist

  1. 确认 us-west-2 的 DNS 解析结果
    kubectl exec -n prod -l app=api-gateway -- nslookup internal-services.example.com 2>&1 | head -20

    Expected: 应返回新 NLB 的 IP(us-east-1 的 IP),但实际可能返回 NXDOMAIN 或旧 ALB IP。

  2. 检查新 NLB 是否在 us-west-2 存在
    aws elbv2 describe-load-balancers --region us-west-2 --names new-nlb-name 2>&1

    Expected: 应返回 NLB 信息,但可能报错 'LoadBalancerNotFound'。

  3. 查看 nginx 错误日志中的具体 upstream 错误
    kubectl logs -n prod -l app=api-gateway --since=30m | grep -i 'upstream timed out' | head -20

    Expected: 应显示 'upstream timed out (110: Connection timed out) while connecting to upstream'。

  4. 检查 us-west-2 的 pod 中 DNS 缓存状态
    kubectl exec -n prod -l app=api-gateway -- cat /etc/resolv.conf

    Expected: 应显示正确的 DNS 服务器地址(如 10.0.0.2)。

  5. 验证旧 ALB 是否仍在运行
    aws elbv2 describe-load-balancers --region us-west-2 --names old-alb-name 2>&1

    Expected: 应返回旧 ALB 信息,确认其仍处于 active 状态。

Mitigation plan

  • 立即回滚 DNS 变更:将 internal-services.example.com 的 CNAME 指向旧 ALB,并恢复 TTL 为 300s

    Risk: 回滚期间 DNS 传播延迟可能导致部分用户继续看到错误,但影响范围会逐渐缩小。无数据丢失风险。

    Rollback: 重新应用当前 DNS 记录(指向新 NLB),但需先确保 us-west-2 有可用后端。

  • 在 us-west-2 创建新 NLB,并将 DNS 记录指向该 NLB

    Risk: 创建 NLB 需要几分钟,期间故障持续。需确保安全组和路由配置正确。

    Rollback: 删除 us-west-2 的 NLB,并回滚 DNS 到旧 ALB。

  • 临时将 us-west-2 的 api-gateway 流量导向 us-east-1 的 NLB(通过修改 nginx upstream 配置)

    Risk: 跨区域流量会增加延迟,但可快速恢复服务。需确保 us-east-1 有足够容量。

    Rollback: 恢复 nginx 配置为原始 upstream 地址。

Customer impact

us-west-2 区域约 35% 的用户请求返回 502 错误,页面加载缓慢(p99 延迟 4 秒)。预计影响该区域约 35% 的活跃用户。

Postmortem draft

Summary

[FILL IN]

Timeline (UTC)

  • 21:40 - DNS 团队将 internal-services.example.com 的 CNAME 指向新 NLB(仅 us-east-1),TTL 从 300s 改为 30s
  • 22:08 - 收到告警,us-west-2 502 错误率 35%
  • 22:10 - 确认 us-west-2 故障,us-east-1 正常
  • 22:11 - DNS 团队确认变更
  • 22:12 - 讨论回滚方案
  • [FILL IN] - 执行回滚
  • [FILL IN] - 服务恢复

Impact

us-west-2 区域 35% 的请求返回 502,p99 延迟 4s,持续约 [FILL IN] 分钟。

Root Cause

DNS 变更将 internal-services.example.com 指向仅存在于 us-east-1 的 NLB,导致 us-west-2 的 pod 无法解析到有效后端。

Detection

监控告警触发(502 错误率 > 1%)。

Response

  • 22:08 告警响应
  • 22:11 确认 DNS 变更为根因
  • [FILL IN] 回滚 DNS 记录
  • [FILL IN] 服务恢复

What Went Well

  • 监控及时告警
  • DNS 团队快速确认变更

What Went Poorly

  • DNS 变更未在 us-west-2 验证
  • 变更未经过充分测试
  • 回滚流程未提前准备

Action Items

  • [FILL IN] 增加 DNS 变更的自动化验证
  • [FILL IN] 建立跨区域部署检查清单
  • [FILL IN] 改进告警响应流程

Follow-ups

  • P0增加 DNS 变更的自动化验证,确保所有区域均有对应后端平台团队
  • P1建立跨区域部署检查清单,要求 DNS 变更前验证所有目标区域SRE 团队
  • P1改进告警响应流程,增加 DNS 变更相关告警监控团队
  • P2审查 DNS TTL 变更策略,避免类似问题DNS 团队
  • P2为 api-gateway 增加 DNS 解析健康检查服务所有者