解决 Linkerd 报错 proxy injection failed MutatingWebhook 超时修复
排查 Kubernetes 创建 Pod 报 Internal error occurred: failed calling webhook linkerd-proxy-injector: failed to call webhook: Post timeout,分析 准入控制器故障。
问题现象
在带有 linkerd.io/inject: enabled 标签的命名空间创建新 Pod 时被 API Server 拒绝:
Error from server (InternalError): Internal error occurred: failed calling webhook "linkerd-proxy-injector.linkerd.io": failed to call webhook: Post "https://linkerd-proxy-injector.linkerd.svc:443/meshed?timeout=10s": context deadline exceeded
触发根因
- 负责拦截并修改 Pod 规范注入边车的
linkerd-proxy-injectorPod 处于崩溃或调度不均状态; - API Server 节点与集群工作节点之间的 443/8443 准入控制通信被防火墙或云 VPC 安全组阻断;
- Webhook 证书过期导致准入握手挂死。
解决步骤
检查 linkerd-proxy-injector 的 Pod 存活状态
执行:
kubectl get pods -n linkerd -l linkerd.io/control-plane-component=proxy-injector
确认其处于 Running 状态。
排查控制平面节点的出站网络安全组
确保 Master/API Server 能够直连工作节点的 Pod 虚拟网络。
若需紧急恢复业务部署,临时调整 Webhook 故障容忍策略
将拦截策略由强校验 Fail 调整为 Ignore(先放通 Pod 创建):
kubectl patch mutatingwebhookconfiguration linkerd-proxy-injector-webhook-config \
--type='json' -p='[{"op": "replace", "path": "/webhooks/0/failurePolicy", "value": "Ignore"}]'
验证确认
修复网络通道后重新提交 Pod:
边车容器被极速注入,Pod 顺畅进入就绪状态。


